-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
103 lines (86 loc) · 2.52 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif ()
project(doodle-jump)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(WIN)
set(RES)
if (WIN32 AND CMAKE_BUILD_TYPE MATCHES Release)
set(WIN WIN32)
endif ()
if (WIN32 AND EXISTS ${CMAKE_SOURCE_DIR}/resources.rc)
find_program(WINDRES "windres.exe")
if (WINDRES)
execute_process(
COMMAND windres.exe resources.rc -o resources.o
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
set(RES resources.o)
endif ()
endif ()
add_executable(doodle-jump ${WIN}
resources
lib/incbin/incbin.h
src/main.cpp
src/consts.h
src/EventLoop.cpp
src/EventLoop.h
src/Doodler.cpp
src/Doodler.h
src/IEntity.h
src/Platform.cpp
src/Platform.h
src/IPhysicsObject.h
src/Engine.cpp
src/Engine.h
src/KeyboardState.cpp
src/KeyboardState.h
src/View.cpp
src/View.h
src/GameState.cpp
src/GameState.h
src/IState.h
src/enums.h
src/States.cpp
src/States.h
src/Menu.cpp
src/Menu.h
src/Overlay.cpp
src/Overlay.h
src/Assets.cpp
src/Assets.h
src/Sprite.cpp
src/Sprite.h
${RES})
target_compile_features(doodle-jump PUBLIC cxx_std_17)
if (EXISTS ${CMAKE_SOURCE_DIR}/cmake_modules)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
endif ()
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/SFML/)
set(SFML_ROOT "${CMAKE_SOURCE_DIR}/lib/SFML/")
endif ()
set(SFML_STATIC_LIBRARIES TRUE)
find_package(Freetype REQUIRED)
find_package(JPEG REQUIRED)
find_package(SFML 2 COMPONENTS window graphics system REQUIRED)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
if (${SFML_FOUND})
include_directories(${SFML_INCLUDE_DIR})
target_include_directories(doodle-jump PRIVATE ${SFML_INCLUDE_DIR})
target_link_libraries(doodle-jump ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
target_compile_definitions(doodle-jump PRIVATE SFML_STATIC)
endif ()
if (${ZLIB_FOUND})
target_include_directories(doodle-jump PRIVATE ${ZLIB_INCLUDE_DIRS})
target_link_libraries(doodle-jump ${ZLIB_LIBRARIES})
endif ()
if (${BZIP2_FOUND})
target_include_directories(doodle-jump PRIVATE ${BZIP2_INCLUDE_DIR})
target_link_libraries(doodle-jump ${BZIP2_LIBRARIES})
endif ()