-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
83 lines (72 loc) · 1.87 KB
/
Copy pathCMakeLists.txt
File metadata and controls
83 lines (72 loc) · 1.87 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
cmake_minimum_required(VERSION 4.0)
project(editor)
include(GNUInstallDirs)
set(BUILD_SHARED_LIBS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_COLOR_DIAGNOSTICS ON)
set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "ccache")
set(CMAKE_CXX_COMPILER_LAUNCHER "ccache")
endif()
add_subdirectory(glfw)
add_subdirectory(harfbuzz)
add_subdirectory(unicode)
add_subdirectory(glad)
add_subdirectory(cglm)
set(CMAKE_C_STANDARD 23)
add_compile_options(-std=gnu2x)
add_executable(editor
source/editor.c
source/shader.c
source/filesystem.c
source/text.c
source/layout.c
source/renderer.c
source/window.c
source/fontmanager.c
source/utils.c
source/sanitizers.c
)
target_compile_options(editor PRIVATE
-Wall
-Wextra
-Wundef
-Wshadow
-Wpointer-arith
-Wcast-align
-Wstrict-prototypes
-Wwrite-strings
-Wswitch-enum
-Wconversion
-Wunreachable-code
-Wpedantic
-Wno-override-init
-Werror=return-type
-Wdouble-promotion
-fno-omit-frame-pointer
$<$<CONFIG:Debug>:-Og -g3>
$<$<CONFIG:Debug>:-fsanitize=undefined,address>
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_options(editor PUBLIC
-fsanitize=undefined
-fsanitize=address
)
endif()
if (TEXT_LINE_IMPLEMENTATION)
add_definitions(-DTEXT_LINE_IMPLEMENTATION=1)
endif()
target_compile_definitions(editor PRIVATE GLFW_INCLUDE_NONE ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets/")
target_include_directories(editor PUBLIC include)
target_link_libraries(editor PRIVATE harfbuzz-gpu harfbuzz glfw glad cglm unicode)
install(
TARGETS editor
EXPORT editor
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)