-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
113 lines (96 loc) · 3.36 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
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.26)
project(Isoberry)
set(CMAKE_CXX_STANDARD 17)
set(OpenGL_GL_PREFERENCE GLVND)
add_subdirectory("submodules/olcPixelGameEngine")
add_subdirectory("submodules/fpng")
add_subdirectory("submodules/stbImage")
file (GLOB MY_SRC
"src/header/*.h"
"src/main.cpp"
"src/utility/*.cpp"
"src/utility/*.h"
"src/utility/settings/*.cpp"
"src/utility/settings/*.h"
"src/objects/collision/*.cpp"
"src/objects/collision/*.h"
"src/objects/animation/*.cpp"
"src/objects/animation/*.h"
"src/objects/*.cpp"
"src/objects/*.h"
"src/editor/*.cpp"
"src/editor/*.h"
"src/tool/*.cpp"
"src/tool/*.h"
"src/tool/sprite_saving/*.cpp"
"src/tool/sprite_saving/*.h"
"src/tool/draw_sprites/*.cpp"
"src/tool/draw_sprites/*.h"
"src/tool/layering/*.cpp"
"src/tool/input/*.cpp"
"src/tool/input/*.h"
"src/tool/art/*.cpp"
"src/tool/art/*.h"
"src/tool/memory/*.cpp"
"src/tool/memory/*.h"
"src/level/*.cpp"
"src/level/*.h"
"src/*.cpp"
"src/*.h")
if (WIN32 OR LINUX)
add_executable(Isoberry ${MY_SRC})
file(COPY resources/assets/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/assets/)
endif (WIN32 OR LINUX)
if (WIN32)
# Windows moment
target_compile_definitions(Isoberry PRIVATE NOMINMAX)
endif (WIN32)
if (APPLE)
add_compile_options(-stdlib=libc++)
set(CUR_TARGET Isoberry)
set(MACOSX_BUNDLE_ICON_FILE isoberry.icns)
file(COPY resources/assets/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Isoberry.app/Contents/assets)
set(myApp_ICON resources/app/icon/isoberry.icns)
set_source_files_properties(${myApp_ICON} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
add_executable(${CUR_TARGET} MACOSX_BUNDLE ${MY_SRC} ${myApp_ICON})
set_target_properties(${CUR_TARGET} PROPERTIES
BUNDLE True
MACOSX_BUNDLE_GUI_IDENTIFIER my.domain.style.identifier.${CUR_TARGET}
MACOSX_BUNDLE_BUNDLE_NAME ${CUR_TARGET}
MACOSX_BUNDLE_BUNDLE_VERSION ${ISOBERRY_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${ISOBERRY_VERSION}
)
set(OPENSSL_INCLUDE_DIR /usr/local/opt/openssl)
set(OPENSSL_CRYPTO_LIBRARY /usr/local/opt/openssl/lib)
endif(APPLE)
target_include_directories(Isoberry PRIVATE
"submodules/olcPixelGameEngine"
"submodules/fpng"
"submodules/stbImage")
if(${CMAKE_SYSTEM} MATCHES "Linux")
set(LINUX 1)
endif(${CMAKE_SYSTEM} MATCHES "Linux")
if (UNIX)
# X11
if(LINUX)
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
link_directories(${X11_LIBRARIES})
target_link_libraries(Isoberry PRIVATE ${X11_LIBRARIES})
endif(LINUX)
# GLUT
if(APPLE)
find_package(GLUT REQUIRED)
include_directories(${GLUT_INCLUDE_DIR})
link_directories(${GLUT_LIBRARIES})
target_link_libraries(Isoberry PRIVATE ${GLUT_LIBRARIES})
endif(APPLE)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
link_directories(${OPENGL_LIBRARIES})
target_link_libraries(Isoberry PRIVATE ${OPENGL_LIBRARIES})
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(Isoberry PRIVATE Threads::Threads)
endif (UNIX)