-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
79 lines (66 loc) · 2.89 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.0)
project(kops VERSION 1.2.0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/cmake-modules)
if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake-modules/FindSDL2.cmake")
file(DOWNLOAD "https://github.com/tcbrindle/sdl2-cmake-scripts/raw/master/FindSDL2.cmake" "${CMAKE_BINARY_DIR}/cmake-modules/FindSDL2.cmake")
endif()
if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake-modules/FindSDL2_mixer.cmake")
file(DOWNLOAD "https://github.com/tcbrindle/sdl2-cmake-scripts/raw/master/FindSDL2_mixer.cmake" "${CMAKE_BINARY_DIR}/cmake-modules/FindSDL2_mixer.cmake")
endif()
if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake-modules/FindZLIB.cmake")
file(DOWNLOAD "https://raw.githubusercontent.com/Kitware/CMake/master/Modules/FindZLIB.cmake" "${CMAKE_BINARY_DIR}/cmake-modules/FindZLIB.cmake")
endif()
if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake-modules/SelectLibraryConfigurations.cmake")
file(DOWNLOAD "https://raw.githubusercontent.com/Kitware/CMake/master/Modules/SelectLibraryConfigurations.cmake" "${CMAKE_BINARY_DIR}/cmake-modules/SelectLibraryConfigurations.cmake")
endif()
if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake-modules/FindPackageHandleStandardArgs.cmake")
file(DOWNLOAD "https://raw.githubusercontent.com/Kitware/CMake/master/Modules/FindPackageHandleStandardArgs.cmake" "${CMAKE_BINARY_DIR}/cmake-modules/FindPackageHandleStandardArgs.cmake")
endif()
if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake-modules/FindPackageMessage.cmake")
file(DOWNLOAD "https://raw.githubusercontent.com/Kitware/CMake/master/Modules/FindPackageMessage.cmake" "${CMAKE_BINARY_DIR}/cmake-modules/FindPackageMessage.cmake")
endif()
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(ZLIB REQUIRED)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
if (WIN32)
add_compile_options(/MP /MT /WX /wd4996)
else()
# Warnings to be fixed
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()
file(GLOB SOURCES
src/*.h src/*.c
src/util/*.h src/util/*.c
src/kops-bot/reactive-agent/*.h)
if (EXPERIMENTAL_BOT_SUPPORT)
file(GLOB BOT_SOURCES
src/kops-bot/reactive-agent/*.c)
list(APPEND SOURCES ${BOT_SOURCES})
endif()
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/SRC
${SDL2_INCLUDE_DIR}
${SDL2_MIXER_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME}
${SDL2_LIBRARY}
${SDL2_MIXER_LIBRARIES}
${ZLIB_LIBRARIES})
if (WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "KOPS" SUFFIX ".exe")
target_link_libraries(${PROJECT_NAME} winmm.lib)
elseif (UNIX)
target_link_libraries(${PROJECT_NAME} m)
endif()
if (APPLE)
target_compile_definitions(${PROJECT_NAME} PRIVATE PATH_MAX=260)
endif()
if (EXPERIMENTAL_BOT_SUPPORT)
message(STATUS "Enabled incomplete experimental bot support")
target_compile_definitions(${PROJECT_NAME} PRIVATE EXPERIMENTAL_BOT_SUPPORT=1)
endif()