]> git.lizzy.rs Git - nothing.git/blob - CMakeLists.txt
Merge pull request #150 from tsoding/109
[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   src/mat3x3.c
42   src/algo.c
43 )
44
45 set(HEADER_FILES
46   src/player.h
47   src/platforms.h
48   src/rect.h
49   src/point.h
50   src/camera.h
51   src/error.h
52   src/game.h
53   src/lt.h
54   src/lt/lt_slot.h
55   src/level.h
56   src/goals.h
57   src/renderer.h
58   src/triangle.h
59   src/pi.h
60   src/color.h
61   src/rigid_rect.h
62   src/dying_rect.h
63   src/lava.h
64   src/wavy_rect.h
65   src/sound_medium.h
66   src/path.h
67   src/mat3x3.h
68   src/algo.h
69 )
70
71 add_executable(nothing ${SOURCE_FILES} ${HEADER_FILES})
72 target_link_libraries(nothing ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY})
73
74 if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "CLANG"))
75   set(CMAKE_C_FLAGS
76     "${CMAKE_C_FLAGS} \
77      -Wall \
78      -Werror \
79      -Wextra \
80      -Wconversion \
81      -Wunused \
82      -Wunused-function \
83      -Wunused-label \
84      -Wunused-macros \
85      -Wunused-parameter \
86      -Wunused-value \
87      -Wunused-variable \
88      -Wcast-align \
89      -Wcast-qual \
90      -Wmissing-declarations \
91      -Wredundant-decls \
92      -Wmissing-prototypes \
93      -Wnested-externs \
94      -Wpointer-arith \
95      -Wshadow \
96      -Wstrict-prototypes \
97      -Wwrite-strings \
98      -fno-common \
99      -pedantic \
100      -std=c11 \
101      -O3")
102   target_link_libraries(nothing m)
103 endif()
104 if(WIN32)
105   target_link_libraries(nothing Imm32 Version winmm)
106 endif()
107
108 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/sounds DESTINATION ${CMAKE_CURRENT_BINARY_DIR})