-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
157 lines (132 loc) · 4.55 KB
/
CMakeLists.txt
File metadata and controls
157 lines (132 loc) · 4.55 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
cmake_minimum_required(VERSION 3.25)
# # Enable ASAN (Address Sanitizer) globally
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
#compile option (-mavx) for is_tile_blank() in tiles_patterns.cpp
#applies to current directory & below?
add_compile_options(
-mavx #support for AVX instructions
# -fsanitize=address # used for memory leak checking
)
#sets PROJECT_NAME
#PROJECT_NAME is auto set when name is passed as 1st arg
#https://cmake.org/cmake/help/latest/command/project.html#project
project(
QFO2Solution VERSION 1.2.1
# ${PROJECT_NAME} VERSION 0.1.0
# DESCRIPTION "${PROJECT_NAME}"
)
set(EXECUTABLE_NAME "QFO2Tool")
add_executable(${EXECUTABLE_NAME})
# Windows compile stuff
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(
${EXECUTABLE_NAME}
PUBLIC QFO2_WINDOWS
)
# Linux compile stuff
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_compile_definitions(
${EXECUTABLE_NAME}
PUBLIC QFO2_LINUX
)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS FALSE)
target_sources(
${EXECUTABLE_NAME} PRIVATE
src/msk2bmpGUI.cpp
)
#these are directories that have CMakeLists.txt files
#they automatically compile into libraries
#just have to figure out how to hook them in
add_subdirectory(src/dependencies/GLAD SYSTEM)
add_subdirectory(src/dependencies/GLFW/glfw-3.4 SYSTEM)
add_subdirectory(src/QFO2Tool SYSTEM)
add_subdirectory(src/dependencies/ImFileDialog SYSTEM)
#is this what allows <> around local #includes?
target_include_directories(
${EXECUTABLE_NAME}
PUBLIC src/QFO2Tool
)
#this creates a new "library" for the linker (.dll/.so)
#(don't have to add a CMakeLists.txt file tinyfiledialogs folder)
#library still needs to be added to target_link_libraries()
add_library(ImFileDialog
src/dependencies/ImFileDialog/ImFileDialog.cpp
src/dependencies/ImFileDialog/ImFileDialog.h
)
add_library(STB
src/dependencies/stb/stb_c_lexer.h
src/dependencies/stb/stb_connected_components.h
src/dependencies/stb/stb_divide.h
src/dependencies/stb/stb_ds.h
src/dependencies/stb/stb_dxt.h
src/dependencies/stb/stb_easy_font.h
src/dependencies/stb/stb_herringbone_wang_tile.h
src/dependencies/stb/stb_hexwave.h
src/dependencies/stb/stb_image_resize2.h
src/dependencies/stb/stb_image_write.h
src/dependencies/stb/stb_image.h
src/dependencies/stb/stb_include.h
src/dependencies/stb/stb_leakcheck.h
src/dependencies/stb/stb_perlin.h
src/dependencies/stb/stb_rect_pack.h
src/dependencies/stb/stb_sprintf.h
src/dependencies/stb/stb_textedit.h
src/dependencies/stb/stb_tilemap_editor.h
src/dependencies/stb/stb_truetype.h
src/dependencies/stb/stb_voxel_render.h
src/dependencies/stb/stb_vorbis.c
)
add_library(imgui_docking
src/dependencies/imgui-1.90.8-docking/backends/imgui_impl_opengl3.h
src/dependencies/imgui-1.90.8-docking/backends/imgui_impl_opengl3.cpp
src/dependencies/imgui-1.90.8-docking/backends/imgui_impl_glfw.h
src/dependencies/imgui-1.90.8-docking/backends/imgui_impl_glfw.cpp
src/dependencies/imgui-1.90.8-docking/imgui.h
src/dependencies/imgui-1.90.8-docking/imgui.cpp
src/dependencies/imgui-1.90.8-docking/imgui_demo.cpp
src/dependencies/imgui-1.90.8-docking/imgui_draw.cpp
src/dependencies/imgui-1.90.8-docking/imgui_tables.cpp
src/dependencies/imgui-1.90.8-docking/imgui_widgets.cpp
)
#must include target directories
#_AFTER_ the target is declared w/add_library()
target_include_directories(
imgui_docking PUBLIC
src/dependencies/imgui-1.90.8-docking
src/dependencies/imgui-1.90.8-docking/backends
src/dependencies/GLFW/glfw-3.4/include
)
target_include_directories(
STB PUBLIC
src/dependencies/stb/
)
target_include_directories(
ImFileDialog PUBLIC
src/dependencies/ImFileDialog
)
# finally we link these libraries to our executable
# PRIVATE because nothing (target) will depend on our executable
target_link_libraries(
${EXECUTABLE_NAME} PRIVATE
glad
imgui_docking
QFO2ToolLib
STB
glfw
ImFileDialog
)
#this custom command copies the contents of src/resources
#to the compilation directory
#so the program will start without manually copying stuff
add_custom_command(DEPENDS
TARGET ${EXECUTABLE_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/src/resources
$<TARGET_FILE_DIR:${EXECUTABLE_NAME}>/resources
)