]> git.lizzy.rs Git - nothing.git/blob - CMakeLists.txt
(#132) Initialize Audio
[nothing.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.2)
2 project(nothing)
3
4 if(WIN32)
5   # Conan integration
6   include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
7   conan_basic_setup()
8 endif()
9
10 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
11
12 find_package(SDL2 REQUIRED)
13
14 find_package(SDL2_mixer REQUIRED)
15
16 include_directories(${SDL2_INCLUDE_DIR})
17 include_directories(${SDL2_MIXER_INCLUDE_DIR})
18
19 set(SOURCE_FILES
20   src/main.c
21   src/player.c
22   src/platforms.c
23   src/rect.c
24   src/point.c
25   src/camera.c
26   src/error.c
27   src/game.c
28   src/lt.c
29   src/lt/lt_slot.c
30   src/level.c
31   src/goals.c
32   src/renderer.c
33   src/triangle.c
34   src/color.c
35   src/rigid_rect.c
36   src/dying_rect.c
37   src/lava.c
38   src/wavy_rect.c
39   src/sound_medium.c
40   src/path.c
41 )
42
43 set(HEADER_FILES
44   src/player.h
45   src/platforms.h
46   src/rect.h
47   src/point.h
48   src/camera.h
49   src/error.h
50   src/game.h
51   src/lt.h
52   src/lt/lt_slot.h
53   src/level.h
54   src/goals.h
55   src/renderer.h
56   src/triangle.h
57   src/pi.h
58   src/color.h
59   src/rigid_rect.h
60   src/dying_rect.h
61   src/lava.h
62   src/wavy_rect.h
63   src/sound_medium.h
64   src/path.h
65 )
66
67 add_executable(nothing ${SOURCE_FILES} ${HEADER_FILES})
68 target_link_libraries(nothing ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY})
69
70 if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "CLANG"))
71   set(CMAKE_C_FLAGS
72     "${CMAKE_C_FLAGS} \
73      -Wall \
74      -Werror \
75      -Wextra \
76      -Wconversion \
77      -Wunused \
78      -Wunused-function \
79      -Wunused-label \
80      -Wunused-macros \
81      -Wunused-parameter \
82      -Wunused-value \
83      -Wunused-variable \
84      -Wcast-align \
85      -Wcast-qual \
86      -Wmissing-declarations \
87      -Wredundant-decls \
88      -Wmissing-prototypes \
89      -Wnested-externs \
90      -Wpointer-arith \
91      -Wshadow \
92      -Wstrict-prototypes \
93      -Wwrite-strings \
94      -fno-common \
95      -pedantic \
96      -std=c11 \
97      -O3")
98   target_link_libraries(nothing m)
99 endif()
100 if(WIN32)
101   target_link_libraries(nothing Imm32 Version winmm)
102 endif()
103
104 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/sounds DESTINATION ${CMAKE_CURRENT_BINARY_DIR})