|
1 | 1 | cmake_minimum_required(VERSION 3.21) |
2 | 2 |
|
3 | | -# Set C++ standard and project properties |
4 | 3 | set(CMAKE_CXX_STANDARD 20) |
5 | 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
6 | 5 | set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") |
7 | 6 | set(CMAKE_CXX_VISIBILITY_PRESET hidden) |
8 | 7 |
|
9 | 8 | project(Geodify VERSION 1.0.0) |
10 | 9 |
|
11 | | -# Collect source files |
12 | 10 | file(GLOB_RECURSE SOURCES src/*.cpp) |
13 | 11 |
|
14 | | -# Define the shared library target |
15 | 12 | add_library(${PROJECT_NAME} SHARED ${SOURCES}) |
16 | 13 |
|
17 | | -# Ensure Geode SDK is available |
18 | 14 | if (NOT DEFINED ENV{GEODE_SDK}) |
19 | 15 | message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode") |
20 | 16 | else() |
21 | 17 | message(STATUS "Found Geode: $ENV{GEODE_SDK}") |
22 | 18 | endif() |
23 | 19 |
|
24 | | -# Special case for GitHub Actions |
25 | 20 | if (DEFINED ENV{GITHUB_ACTIONS}) |
26 | 21 | message("Github Actions Build") |
27 | 22 | add_definitions(-DGITHUB_ACTIONS) |
28 | 23 | endif() |
29 | 24 |
|
30 | | -# Include CPM.cmake |
31 | 25 | include("cmake/CPM.cmake") |
32 | 26 |
|
33 | | -# Fetch the external-hook-api package using the new CPM syntax |
34 | 27 | CPMAddPackage( |
35 | 28 | NAME external-hook-api |
36 | 29 | GIT_REPOSITORY https://github.com/OmgRod/External-Hook-API.git |
37 | 30 | GIT_TAG master |
38 | 31 | ) |
| 32 | +target_link_libraries(${PROJECT_NAME} external-hook-api) |
39 | 33 |
|
40 | | -# Add Geode SDK as a subdirectory |
41 | | -add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode) |
| 34 | +CPMAddPackage( |
| 35 | + NAME nlohmann_json |
| 36 | + GIT_REPOSITORY https://github.com/nlohmann/json.git |
| 37 | + VERSION 3.11.3 |
| 38 | +) |
| 39 | +target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json) |
42 | 40 |
|
43 | | -# Link the external-hook-api target to your project |
44 | | -target_link_libraries(${PROJECT_NAME} external-hook-api) |
| 41 | +add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode) |
45 | 42 |
|
46 | | -# Setup Geode module (if applicable) |
47 | 43 | setup_geode_mod(${PROJECT_NAME}) |
0 commit comments