-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
102 lines (82 loc) · 2.46 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
cmake_minimum_required (VERSION 3.19)
project(graphtail)
set(GRAPHTAIL_VERSION 1.0.4)
macro(graphtail_option OPTION_NAME OPTION_TEXT OPTION_DEFAULT)
option(${OPTION_NAME} ${OPTION_TEXT} ${OPTION_DEFAULT})
if(DEFINED ENV{${OPTION_NAME}})
# Allow overriding the option through an environment variable
set(${OPTION_NAME} $ENV{${OPTION_NAME}})
endif()
if(${OPTION_NAME})
add_definitions(-D${OPTION_NAME})
endif()
message(STATUS "${OPTION_NAME}: ${${OPTION_NAME}}")
endmacro()
graphtail_option(GRAPHTAIL_PRECOMPILED_HEADERS "Enable precompiled headers." ON)
set(BUILD_SHARED_LIBS OFF)
include(FetchContent)
# ------ brotli ------
set(BROTLI_DISABLE_TESTS ON)
set(BROTLI_BUNDLED_MODE ON)
FetchContent_Declare(
brotli
GIT_REPOSITORY https://github.com/google/brotli
GIT_TAG v1.0.9)
FetchContent_MakeAvailable(brotli)
set(BROTLI_LIBRARIES_STATIC brotlidec-static)
# ------ SDL2 ------
set(SDL_TEST OFF)
set(SDL_SHARED OFF)
set(SDL_STATIC ON)
set(SDL_ATOMIC OFF)
set(SDL_AUDIO OFF)
set(SDL_JOYSTICK OFF)
set(SDL_HAPTIC OFF)
set(SDL_HIDAPI OFF)
set(SDL_POWER OFF)
set(SDL_THREADS OFF)
set(SDL_TIMERS ON)
set(SDL_FILE OFF)
set(SDL_CPUINFO OFF)
set(SDL_FILESYSTEM OFF)
set(SDL_SENSOR OFF)
set(SDL_LOCALE OFF)
set(SDL_MISC OFF)
set(SDL2_DISABLE_INSTALL ON)
set(SDL2_DISABLE_UNINSTALL ON)
FetchContent_Declare(
SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL
GIT_TAG release-2.0.22)
FetchContent_MakeAvailable(SDL2)
set(SDL2_INCLUDE_DIRS "${SDL2_SOURCE_DIR}/include")
set(SDL2_LIBRARIES SDL2-static SDL2main)
# ------ SDL2_ttf ------
set(SDL2TTF_SAMPLES OFF)
set(SDL2TTF_BUILD_SHARED_LIBS OFF)
set(SDL2TTF_INSTALL OFF)
FetchContent_Declare(
SDL_ttf
GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf
GIT_TAG release-2.20.1)
FetchContent_MakeAvailable(SDL_ttf)
set(SDL_TTF_INCLUDE_DIRS "${SDL2_ttf_SOURCE_DIR}/include")
set(SDL_TTF_LIBRARIES SDL2_ttf)
# ------ Compile options ------
if (MSVC)
# warning level 4 and all warnings as errors
add_compile_options(/W4 /WX /wd4996)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
else()
# lots of warnings and all warnings as errors
add_compile_options(
-Wall
-Wextra
-pedantic
-Werror
-Wno-unused-function # I want unused functions for debugging purposes
-Wno-reorder # I want to be able to initialize class members in any order
-Wno-class-memaccess # I want to be able to memset() things that I know are safe to memset()
)
endif()
add_subdirectory(src)