-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
90 lines (74 loc) · 2.4 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
cmake_minimum_required(VERSION 3.16)
project(DSHBA LANGUAGES C CXX)
# set(CMAKE_VERBOSE_MAKEFILE ON)
# check of LTO
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# clang12 does not like our static_for loop in ARM7TDMI
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fbracket-depth=5000")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast") # -march=native
set(CMAKE_C_FLAGS_RELEASE "-Ofast")
if (NOT WIN32)
# we need to specify this
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
if (CMAKE_COMPILER_IS_GNUCC)
message(STATUS "GCC compiler detected")
# for some reason, GCC complained about this
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mbmi")
endif()
# add_compile_options($<$<CONFIG:DEBUG>:-Wall>)
add_compile_definitions(
$<$<CONFIG:RELEASE>:NDEBUG>
$<$<CONFIG:RELEASE>:BOOST_DISABLE_ASSERTS>
)
add_executable(DSHBA
main.cpp
include/default.h
include/helpers.h
include/flags.h
include/log.h
include/sleeping.h
include/const.h
modules/glad/glad.h
modules/glad/glad.c
modules/KHR/khrplatform.h
debugging.h
init.cpp
init.h
)
# add link time optimizations for extra speed
if( ipo_supported )
message(STATUS "${CMAKE_BUILD_TYPE}")
if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
message(STATUS "IPO / LTO enabled")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(STATUS "IPO / LTO enabled when compiled in release mode")
endif ()
else()
message(STATUS "IPO / LTO not supported: <${ipo_error}>")
endif()
add_subdirectory(modules/imgui)
add_subdirectory(src/Core)
add_subdirectory(src/Frontend)
include_directories(
include
modules
$<TARGET_PROPERTY:Core,INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:Frontend,INCLUDE_DIRECTORIES>
)
if (WIN32)
target_link_libraries(DSHBA PRIVATE Core Frontend imgui)
else()
target_link_libraries(DSHBA PRIVATE Core Frontend imgui ${CMAKE_DL_LIBS})
endif()
# copy over files with settings
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/imgui.ini
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/input.map
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})