-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
149 lines (130 loc) · 4.27 KB
/
CMakeLists.txt
File metadata and controls
149 lines (130 loc) · 4.27 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
# See https://cliutils.gitlab.io/modern-cmake/chapters/basics.html
# Require 3.25 due to SYSTEM in FetchContent_Declare calls.
cmake_minimum_required(VERSION 3.15)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # We need this lol.
option(SANITIZE "Whether or not to sanitize builds" "NO_SANITIZE")
project(
trAAcker
VERSION 0.1
DESCRIPTION "trAAcker - A cross-platform Minecraft advancements tracker."
LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD
20
CACHE STRING "The C++ standard to use")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(DOWNLOAD_EXTRACT_TIMESTAMP ON)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
# list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(FetchContent)
#FetchContent_Declare(RmlUi
# GIT_REPOSITORY https://github.com/hobyst/RmlUi
# GIT_TAG 104fdb35d3ea6320733bde72b38b1c4365ec49a5)
#FetchContent_MakeAvailable(RmlUi)
if (CMAKE_VERSION VERSION_LESS "3.25.0")
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG master
#SYSTEM)
)
FetchContent_MakeAvailable(fmt)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.6.x
#SYSTEM)
)
FetchContent_MakeAvailable(SFML)
# We would use fetchcontent but nlohmann json is...
# it doesn't appear to have proper cmake setup for that.
# Not sure what's going on with that but we just download it.
#FetchContent_Declare(json
# URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
# SYSTEM)
#FetchContent_MakeAvailable(json)
# Also note: https://github.com/nlohmann/json/pull/4080
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.11.3
#SYSTEM)
)
FetchContent_MakeAvailable(json)
else()
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG master
SYSTEM)
FetchContent_MakeAvailable(fmt)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.6.x
SYSTEM)
FetchContent_MakeAvailable(SFML)
# We would use fetchcontent but nlohmann json is...
# it doesn't appear to have proper cmake setup for that.
# Not sure what's going on with that but we just download it.
#FetchContent_Declare(json
# URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
# SYSTEM)
#FetchContent_MakeAvailable(json)
# Also note: https://github.com/nlohmann/json/pull/4080
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.11.2
SYSTEM)
FetchContent_MakeAvailable(json)
endif()
set(CROSS_PLATFORM_DEPENDENCIES )
if (APPLE)
list(APPEND CROSS_PLATFORM_DEPENDENCIES "include/osx/Focus2Wrapper.mm")
endif()
if(WIN32)
# find_package(WDK REQUIRED)
endif()
add_executable(
trAAcker
# Library things
include/dmon.cpp include/dmon.hpp
include/logging.cpp include/logging.hpp
# Cursed things
include/app_finder.cpp include/app_finder.hpp
include/compat.cpp include/compat.hpp
${CROSS_PLATFORM_DEPENDENCIES}
# Source things? Hmmm
src/Application.cpp src/Application.hpp
src/Advancements.cpp src/Advancements.hpp
src/Map.cpp src/Map.hpp
src/Overlay.cpp src/Overlay.hpp
src/WindowManager.cpp src/WindowManager.hpp
src/ResourceManager.cpp src/ResourceManager.hpp
src/FileProvider.cpp src/FileProvider.hpp
main.cpp)
if(${SANITIZE} STREQUAL "address")
message("! Building with ASAN.")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()
target_include_directories(trAAcker PRIVATE "include/")
#target_link_libraries(trAAcker PRIVATE
# # RmlUi::RmlUi
# )
if(APPLE)
# Required for dmon
target_link_libraries(trAAcker PRIVATE
"-framework CoreFoundation"
"-framework CoreServices"
"-framework AppKit"
)
endif()
if(WIN32)
target_link_libraries(trAAcker PRIVATE ntdll)
else()
target_link_libraries(trAAcker PRIVATE "-lpthread")
endif()
target_link_libraries(trAAcker PUBLIC sfml-graphics sfml-window sfml-system)
target_link_libraries(trAAcker PRIVATE fmt::fmt)
target_link_libraries(trAAcker PRIVATE nlohmann_json::nlohmann_json)
if (EXISTS ${PROJECT_BINARY_DIR}/compile_commands.json)
file(COPY ${PROJECT_BINARY_DIR}/compile_commands.json DESTINATION ${PROJECT_SOURCE_DIR})
endif()