-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
90 lines (70 loc) · 2.88 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.21)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
project(blaze VERSION 1.0.0)
option(BLAZE_USE_TRACY "Use tracy" OFF)
option(BLAZE_DEBUG "Debug mode" OFF)
# source files
file(GLOB_RECURSE SOURCES
src/*.cpp
external/*.c
external/*.cpp
)
add_library(${PROJECT_NAME} SHARED ${SOURCES})
if (NOT DEFINED ENV{GEODE_SDK})
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
else()
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
endif()
add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)
setup_geode_mod(${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} PRIVATE external/)
target_include_directories(${PROJECT_NAME} PRIVATE src/)
# make spng use miniz instead of zlib
target_compile_definitions(${PROJECT_NAME} PRIVATE SPNG_USE_MINIZ=1 SPNG_STATIC=1)
CPMAddPackage("gh:dankmeme01/asp2#8e25afa")
CPMAddPackage(
NAME Boost
VERSION 1.84.0
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
URL_HASH SHA256=2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e
OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES container" # escape with \\\;
)
CPMAddPackage("gh:simdutf/simdutf#83c0e74")
CPMAddPackage(
NAME libdeflate
GIT_REPOSITORY "https://github.com/ebiggers/libdeflate.git"
GIT_TAG "v1.20"
OPTIONS "LIBDEFLATE_BUILD_SHARED_LIB OFF" "LIBDEFLATE_BUILD_GZIP OFF"
)
if (BLAZE_DEBUG)
target_compile_definitions(${PROJECT_NAME} PRIVATE BLAZE_DEBUG=1)
target_compile_definitions(asp PRIVATE _HAS_ITERATOR_DEBUGGING=0)
target_compile_definitions(simdutf PRIVATE _HAS_ITERATOR_DEBUGGING=0)
endif()
# Suppress some warnings
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(boost_container PRIVATE "-Wno-incompatible-pointer-types")
endif()
# silly thing
if (ANDROID)
if (ANDROID_ABI STREQUAL "arm64-v8a")
target_compile_options(${PROJECT_NAME} PRIVATE "-march=armv8-a+crc")
endif()
endif()
if (BLAZE_USE_TRACY)
# taken from https://github.com/cgytrus/AlgebraDash/blob/main/CMakeLists.txt
set(TRACY_ENABLE ON CACHE BOOL "" FORCE)
set(TRACY_ON_DEMAND ON CACHE BOOL "" FORCE)
set(TRACY_ONLY_LOCALHOST OFF CACHE BOOL "" FORCE)
set(TRACY_NO_CALLSTACK OFF CACHE BOOL "" FORCE)
set(TRACY_CALLSTACK OFF CACHE BOOL "" FORCE)
CPMAddPackage("gh:dankmeme01/tracy#95a3b94")
target_include_directories(${PROJECT_NAME} PRIVATE ${Tracy_SOURCE_DIR}/public/tracy)
target_link_libraries(${PROJECT_NAME} Tracy::TracyClient)
target_compile_definitions(${PROJECT_NAME} PRIVATE BLAZE_TRACY=1)
add_compile_options("-Wno-incompatible-pointer-types")
endif()
target_link_libraries(${PROJECT_NAME} asp Boost::container simdutf libdeflate_static)