-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
146 lines (113 loc) · 3.72 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
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
# This file is automatically generated from cmake.toml - DO NOT EDIT
# See https://github.com/build-cpp/cmkr for more information
cmake_minimum_required(VERSION 3.15)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
endif()
# Regenerate CMakeLists.txt automatically in the root project
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)
# Bootstrap cmkr
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()
# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
# Create a configure-time dependency on cmake.toml to improve IDE support
if(CMKR_ROOT_PROJECT)
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
project(starwars-proj)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(ASMJIT_STATIC ON CACHE BOOL "" FORCE)
if ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
# Statically compile runtime
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
message(NOTICE "Building in Release mode")
endif()
include(FetchContent)
message(STATUS "Fetching bddisasm (v1.34.10)...")
FetchContent_Declare(bddisasm
GIT_REPOSITORY
"https://github.com/bitdefender/bddisasm"
GIT_TAG
v1.34.10
)
FetchContent_MakeAvailable(bddisasm)
message(STATUS "Fetching spdlog (76fb40d95455f249bd70824ecfcae7a8f0930fa3)...")
FetchContent_Declare(spdlog
GIT_REPOSITORY
"https://github.com/gabime/spdlog"
GIT_TAG
76fb40d95455f249bd70824ecfcae7a8f0930fa3
)
FetchContent_MakeAvailable(spdlog)
message(STATUS "Fetching kananlib (main)...")
FetchContent_Declare(kananlib
GIT_REPOSITORY
"https://github.com/cursey/kananlib"
GIT_TAG
main
)
FetchContent_MakeAvailable(kananlib)
# Target starwars-standalone
set(CMKR_TARGET starwars-standalone)
set(starwars-standalone_SOURCES "")
list(APPEND starwars-standalone_SOURCES
"src/Main.cpp"
)
list(APPEND starwars-standalone_SOURCES
cmake.toml
)
set(CMKR_SOURCES ${starwars-standalone_SOURCES})
add_library(starwars-standalone SHARED)
if(starwars-standalone_SOURCES)
target_sources(starwars-standalone PRIVATE ${starwars-standalone_SOURCES})
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${starwars-standalone_SOURCES})
target_compile_features(starwars-standalone PUBLIC
cxx_std_20
)
target_compile_options(starwars-standalone PUBLIC
"/GS-"
"/bigobj"
"/EHa"
"/MP"
)
target_include_directories(starwars-standalone PUBLIC
"src/"
)
target_link_libraries(starwars-standalone PUBLIC
kananlib
)
set_target_properties(starwars-standalone PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
)
target_compile_definitions(starwars-standalone PUBLIC
NOMINMAX
WINVER=0x0A00
)
unset(CMKR_TARGET)
unset(CMKR_SOURCES)