-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (45 loc) · 1.37 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
cmake_minimum_required(VERSION 3.7)
project(Jump)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set this flag to true if you want to paly jumping with yourself
set(BODY_CONTROL true)
# Set this flag to true if you want to debug the code
set(DEBUG false)
add_definitions(-std=c++17)
set(CXX_FLAGS "-Wall")
# enable threading
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(PLATFORM_SPECIFIC_LIBS "-lpthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
if(BODY_CONTROL)
add_definitions(-DBODY_CONTROL)
message("BODY_CONTROL MODE: ON")
endif()
if(DEBUG)
add_definitions(-DDEBUG)
message("DEBUG MODE: ON")
set (CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Og")
else()
set (CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(OpenCV REQUIRED)
if(OpenCV_FOUND)
message("OpenCV found")
endif()
find_package(SDL2 REQUIRED)
if(SDL2_FOUND)
message("SDL2 found")
endif()
include_directories(include ${SDL2_INCLUDE_DIRS} src)
file(GLOB SOURCE "src/*.cpp")
add_executable(Jump ${SOURCE})
string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
target_link_libraries(Jump ${SDL2_LIBRARIES} ${OpenCV_LIBRARIES})