-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (36 loc) · 1.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required (VERSION 3.10.2)
set (CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
project (crisp8-sdl LANGUAGES C)
# Include crisp8 backend
add_subdirectory (external/crisp8)
file (GLOB SOURCES src/*.c src/*.h)
add_executable (crisp8-sdl ${SOURCES})
# Sets the c standard
set_target_properties (crisp8-sdl PROPERTIES C_STANDARD 99)
# Find sdl2
find_package (SDL2 REQUIRED)
if (WIN32)
# This has to come first for some strange reason
target_link_libraries(crisp8-sdl PRIVATE mingw32)
# My (working but should not) attempt at including SDL2_Mixer
# You have to specify SDL2_MIXER_PATH on the command line
target_include_directories (crisp8-sdl PRIVATE ${SDL2_MIXER_PATH}/include)
target_link_directories (crisp8-sdl PRIVATE ${SDL2_MIXER_PATH}/lib)
# Bundle the sdl libraries on windows
set (SDL2_MIXER_DEPENDENCIES ${SDL2_MIXER_PATH}/bin/libogg-0.dll
${SDL2_MIXER_PATH}/bin/libvorbis-0.dll
${SDL2_MIXER_PATH}/bin/LICENSE.ogg-vorbis.txt
${SDL2_MIXER_PATH}/bin/libvorbisfile-3.dll
${SDL2_MIXER_PATH}/bin/SDL2_mixer.dll
)
install (FILES ${SDL2_MIXER_DEPENDENCIES} DESTINATION bin)
install (FILES ${SDL2_DIR}/../bin/SDL2.dll DESTINATION bin)
# WinMain because windows is windows
target_link_libraries (crisp8-sdl PRIVATE SDL2::SDL2main)
else()
# See how easy this would be on a sane os
target_link_libraries (crisp8-sdl PRIVATE SDL2_mixer)
endif ()
target_link_libraries (crisp8-sdl PRIVATE SDL2_mixer SDL2::SDL2 crisp8)
install (TARGETS crisp8-sdl DESTINATION bin)
install (FILES sound/beep.ogg DESTINATION sound)