-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (51 loc) · 1.57 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
cmake_minimum_required(VERSION 3.9)
project(wireframe C)
#set(CMAKE_C_STANDARD 90)
#set(CMAKE_C_STANDARD_REQUIRED ON)
#set(CMAKE_C_EXTENSIONS OFF)
#set(CMAKE_VERBOSE_MAKEFILE 1)
# Set warnings globally
add_compile_options(-Wall -Wextra)
# LTO removes debug symbols so prevents debugging and profiling
#add_compile_options(-flto)
set(CMAKE_C_FLAGS_DEBUG "-g3")
set(CMAKE_C_FLAGS_RELEASE "-g3 -O2 -flto -march=native")
#set(CMAKE_C_FLAGS_RELEASE "-g3 -O3 -march=native")
# Backend to use for windowing and events"
set(GuiBackend "MLX")
#set(GuiBackend "SDL")
# AdressSanitizer (linux/mac only)
set(USE_ASAN OFF)
# On Windows, Force SDL and disable Asan
if (CMAKE_SYSTEM_NAME MATCHES Windows)
set(GuiBackend SDL)
set(USE_ASAN OFF)
endif()
message(STATUS "AddressSanitizer: ${USE_ASAN}")
message(STATUS "Backend: ${GuiBackend}")
if (USE_ASAN)
# Set flags for ASAN globally
add_compile_options(-fsanitize=address -g3)
link_libraries(-fsanitize=address)
endif()
add_executable(fdf "")
include(libft/CMakeLists.txt)
include(core/CMakeLists.txt)
if (GuiBackend STREQUAL SDL)
include(sdl_gui/CMakeLists.txt)
elseif(GuiBackend STREQUAL MLX)
include(mlx_gui/CMakeLists.txt)
else()
message(error "Unrecognized backend name")
endif()
target_link_libraries(fdf ft)
# OSX-only: generates symbol for debug
if (CMAKE_SYSTEM_NAME MATCHES Darwin AND NOT USE_ASAN)
add_custom_command(TARGET fdf
POST_BUILD
COMMAND rm -rf fdf.dSYM && dsymutil fdf
)
endif()
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR})
install(TARGETS fdf
DESTINATION bin)