2022-07-30 12:24:03 -04:00
|
|
|
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
2024-05-31 13:25:26 -04:00
|
|
|
cmake_policy(SET CMP0097 NEW)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-10-05 08:41:05 -04:00
|
|
|
project(geode-loader VERSION ${GEODE_VERSION} LANGUAGES C CXX)
|
2023-02-22 05:19:17 -05:00
|
|
|
if (GEODE_VERSION_TAG_TYPE)
|
|
|
|
if (GEODE_VERSION_TAG_NUMBER)
|
|
|
|
set(PROJECT_VERSION_TAG_CONSTR "geode::VersionTag(geode::VersionTag::${GEODE_VERSION_TAG_TYPE}, ${GEODE_VERSION_TAG_NUMBER})")
|
|
|
|
else()
|
|
|
|
set(PROJECT_VERSION_TAG_CONSTR "geode::VersionTag::${GEODE_VERSION_TAG_TYPE}")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(PROJECT_VERSION_TAG_CONSTR "std::nullopt")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (GEODE_VERSION_TAG)
|
2024-04-12 17:56:33 -04:00
|
|
|
set(PROJECT_VERSION_SUFFIX "-${GEODE_VERSION_TAG}" CACHE INTERNAL "" )
|
2023-02-22 05:19:17 -05:00
|
|
|
else()
|
2024-04-12 17:56:33 -04:00
|
|
|
set(PROJECT_VERSION_SUFFIX "" CACHE INTERNAL "" )
|
2023-02-22 05:19:17 -05:00
|
|
|
endif()
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2024-04-10 16:16:42 -04:00
|
|
|
# I think CMake is trying to link zlib from the host system?
|
|
|
|
# This prevents it from doing that.
|
2024-04-10 16:59:54 -04:00
|
|
|
if (WIN32 AND CMAKE_CROSSCOMPILING)
|
2024-04-10 16:16:42 -04:00
|
|
|
set(MZ_FORCE_FETCH_LIBS ON)
|
2023-02-22 05:19:17 -05:00
|
|
|
endif()
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2023-02-26 07:49:14 -05:00
|
|
|
# https://stackoverflow.com/a/63924044/9124836
|
2024-02-11 13:58:46 -05:00
|
|
|
# https://stackoverflow.com/a/72396471
|
2023-02-26 07:49:14 -05:00
|
|
|
execute_process(
|
2024-02-11 13:58:46 -05:00
|
|
|
COMMAND git describe --always --dirty
|
2023-02-26 07:49:14 -05:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GEODE_COMMIT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
|
2024-01-04 16:36:44 -05:00
|
|
|
if (NOT GEODE_COMMIT_HASH)
|
|
|
|
set(GEODE_COMMIT_HASH "(?)")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
execute_process(
|
2024-02-11 13:58:46 -05:00
|
|
|
COMMAND git describe --always --dirty
|
2024-01-04 16:36:44 -05:00
|
|
|
WORKING_DIRECTORY ${GEODE_BINDINGS_REPO_PATH}
|
|
|
|
OUTPUT_VARIABLE GEODE_BINDINGS_COMMIT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
|
|
|
|
if (NOT GEODE_BINDINGS_COMMIT_HASH)
|
|
|
|
set(GEODE_BINDINGS_COMMIT_HASH "(?)")
|
|
|
|
endif()
|
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Package info file for internal representation
|
2023-09-16 04:38:11 -04:00
|
|
|
set(GEODE_RESOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
2022-10-03 06:51:48 -04:00
|
|
|
configure_file(resources/mod.json.in ${CMAKE_CURRENT_SOURCE_DIR}/resources/mod.json)
|
2023-05-01 06:06:46 -04:00
|
|
|
file(READ resources/mod.json LOADER_MOD_JSON)
|
2023-09-16 04:38:11 -04:00
|
|
|
configure_file(${GEODE_ROOT_PATH}/VERSION ${GEODE_RESOURCES_PATH}/version COPYONLY)
|
|
|
|
configure_file(${GEODE_RESOURCES_PATH}/about.md.in ${GEODE_RESOURCES_PATH}/about.md NEWLINE_STYLE LF)
|
|
|
|
configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${GEODE_RESOURCES_PATH}/changelog.md NEWLINE_STYLE LF)
|
|
|
|
configure_file(${GEODE_RESOURCES_PATH}/support.md.in ${GEODE_RESOURCES_PATH}/support.md NEWLINE_STYLE LF)
|
2024-02-11 13:58:46 -05:00
|
|
|
configure_file(src/internal/about.cpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/internal/about.cpp)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Source files
|
2022-11-28 12:45:23 -05:00
|
|
|
file(GLOB SOURCES CONFIGURE_DEPENDS
|
2022-07-30 12:24:03 -04:00
|
|
|
src/cocos2d-ext/*.cpp
|
2022-11-28 13:03:30 -05:00
|
|
|
src/cocos2d-ext/zip/*.cpp
|
2022-07-30 12:24:03 -04:00
|
|
|
src/core/*.cpp
|
|
|
|
src/hooks/*.cpp
|
2022-10-10 13:58:47 -04:00
|
|
|
src/ids/*.cpp
|
2022-07-30 12:24:03 -04:00
|
|
|
src/internal/*.cpp
|
2024-02-26 15:14:53 -05:00
|
|
|
src/server/*.cpp
|
2022-11-29 17:48:06 -05:00
|
|
|
src/loader/*.cpp
|
2023-06-09 11:29:19 -04:00
|
|
|
src/load.cpp
|
2022-07-30 12:24:03 -04:00
|
|
|
src/utils/*.cpp
|
2023-01-25 03:06:21 -05:00
|
|
|
src/ui/*.cpp
|
2022-08-01 11:18:03 -04:00
|
|
|
src/ui/nodes/*.cpp
|
2024-04-25 10:50:00 -04:00
|
|
|
src/ui/other/*.cpp
|
2024-02-21 19:04:38 -05:00
|
|
|
src/ui/mods/*.cpp
|
2024-03-23 13:34:10 -04:00
|
|
|
src/ui/mods/list/*.cpp
|
|
|
|
src/ui/mods/popups/*.cpp
|
|
|
|
src/ui/mods/sources/*.cpp
|
2024-04-24 05:04:08 -04:00
|
|
|
src/ui/mods/settings/*.cpp
|
2024-04-21 17:08:10 -04:00
|
|
|
src/ui/mods/test/*.cpp
|
2024-02-26 11:27:42 -05:00
|
|
|
src/ui/*.cpp
|
2023-12-22 16:09:58 -05:00
|
|
|
src/c++stl/*.cpp
|
2023-08-03 16:24:04 -04:00
|
|
|
hash/hash.cpp
|
2022-07-30 12:24:03 -04:00
|
|
|
)
|
|
|
|
|
2022-11-28 12:45:23 -05:00
|
|
|
# Obj-c sources
|
2022-07-30 12:24:03 -04:00
|
|
|
file(GLOB OBJC_SOURCES
|
2023-02-09 05:25:23 -05:00
|
|
|
src/platform/Objcpp.mm
|
2022-07-30 12:24:03 -04:00
|
|
|
)
|
2022-11-28 12:45:23 -05:00
|
|
|
set_source_files_properties(${OBJC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
|
|
|
|
2024-01-09 14:59:57 -05:00
|
|
|
if (WIN32)
|
|
|
|
# This allows you to compile in debug mode
|
|
|
|
add_compile_definitions(_HAS_ITERATOR_DEBUGGING=0)
|
|
|
|
add_definitions(-D_HAS_ITERATOR_DEBUGGING=0)
|
|
|
|
endif()
|
|
|
|
|
2023-02-08 09:37:37 -05:00
|
|
|
|
2022-11-28 12:45:23 -05:00
|
|
|
# Add platform sources
|
|
|
|
if (WIN32)
|
|
|
|
|
|
|
|
file(GLOB WIN_SOURCES CONFIGURE_DEPENDS
|
|
|
|
src/platform/windows/*.cpp
|
|
|
|
)
|
|
|
|
list(APPEND SOURCES ${WIN_SOURCES})
|
|
|
|
|
2022-11-28 13:49:21 -05:00
|
|
|
elseif(IOS)
|
2022-11-28 12:45:23 -05:00
|
|
|
|
|
|
|
file(GLOB IOS_SOURCES CONFIGURE_DEPENDS
|
|
|
|
src/platform/ios/*.cpp
|
|
|
|
)
|
|
|
|
list(APPEND SOURCES ${IOS_SOURCES})
|
|
|
|
list(APPEND SOURCES ${OBJC_SOURCES})
|
|
|
|
|
|
|
|
elseif(APPLE)
|
|
|
|
|
|
|
|
file(GLOB MAC_SOURCES CONFIGURE_DEPENDS
|
|
|
|
src/platform/mac/*.cpp
|
|
|
|
)
|
|
|
|
list(APPEND SOURCES ${MAC_SOURCES})
|
|
|
|
list(APPEND SOURCES ${OBJC_SOURCES})
|
|
|
|
|
2023-06-05 20:42:22 -04:00
|
|
|
elseif(ANDROID)
|
|
|
|
|
|
|
|
file(GLOB ANDROID_SOURCES CONFIGURE_DEPENDS
|
|
|
|
src/platform/android/*.cpp
|
|
|
|
)
|
|
|
|
list(APPEND SOURCES ${ANDROID_SOURCES})
|
|
|
|
|
2022-11-28 12:45:23 -05:00
|
|
|
endif()
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Embed version info in binary
|
2022-07-30 12:24:03 -04:00
|
|
|
if (WIN32)
|
2022-11-28 12:45:23 -05:00
|
|
|
configure_file(src/platform/windows/info.rc.in info.rc)
|
|
|
|
set(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/info.rc)
|
2022-07-30 12:24:03 -04:00
|
|
|
endif()
|
|
|
|
|
2024-02-02 04:40:07 -05:00
|
|
|
|
2024-02-03 06:40:44 -05:00
|
|
|
if (ANDROID AND GEODE_USE_BREAKPAD)
|
2024-02-10 20:48:35 -05:00
|
|
|
CPMAddPackage("gh:qimiko/breakpad#161e908")
|
2024-02-02 04:40:07 -05:00
|
|
|
endif()
|
|
|
|
|
2022-11-28 12:45:23 -05:00
|
|
|
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-12-13 00:36:50 -05:00
|
|
|
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
|
|
|
|
|
2024-02-03 12:28:47 -05:00
|
|
|
file(MAKE_DIRECTORY "${GEODE_BIN_PATH}/nightly")
|
2022-07-30 12:24:03 -04:00
|
|
|
|
|
|
|
# Prevent SDK from activating a loader build
|
2023-08-01 14:57:01 -04:00
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
|
|
PREFIX ""
|
2023-12-23 08:15:55 -05:00
|
|
|
OUTPUT_NAME ${GEODE_OUTPUT_NAME}
|
2022-10-06 13:46:07 -04:00
|
|
|
# i'm going to say a slur that not a single soul has uttered in the last 200 years
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
2022-10-04 10:45:08 -04:00
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
2022-07-30 12:24:03 -04:00
|
|
|
)
|
|
|
|
|
2022-10-06 13:46:07 -04:00
|
|
|
if (GEODE_NO_UNDEFINED_VIRTUALS)
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PUBLIC GEODE_NO_UNDEFINED_VIRTUALS)
|
|
|
|
endif()
|
|
|
|
|
2024-05-31 08:46:07 -04:00
|
|
|
# CA Bundle
|
2024-05-31 13:25:26 -04:00
|
|
|
CPMAddPackage(
|
|
|
|
GITHUB_REPOSITORY geode-sdk/net_libs
|
|
|
|
GIT_TAG 1f5ffb3
|
|
|
|
# CPM is bugged and will not allow an empty string.
|
|
|
|
# https://github.com/cpm-cmake/CPM.cmake/issues/467
|
|
|
|
# https://github.com/cpm-cmake/CPM.cmake/issues/461
|
|
|
|
GIT_SUBMODULES "nghttp3"
|
|
|
|
GIT_SUBMODULES_RECURSE OFF
|
|
|
|
)
|
2024-05-31 08:46:07 -04:00
|
|
|
target_link_libraries(${PROJECT_NAME} ca-bundle)
|
|
|
|
|
2022-10-14 14:22:51 -04:00
|
|
|
# Package resources for UI
|
|
|
|
package_geode_resources_now(
|
|
|
|
${PROJECT_NAME}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/resources
|
|
|
|
${GEODE_BIN_PATH}/nightly/resources
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/internal/resources.hpp
|
|
|
|
)
|
2022-08-01 11:18:03 -04:00
|
|
|
|
2023-08-03 16:39:17 -04:00
|
|
|
if (APPLE)
|
|
|
|
# I don't care a single bit where to put this
|
2024-05-31 14:10:40 -04:00
|
|
|
file(COPY ${GEODE_LOADER_PATH}/include/link/macos/libfmod.dylib DESTINATION ${GEODE_BIN_PATH}/nightly)
|
2023-08-03 16:39:17 -04:00
|
|
|
endif()
|
|
|
|
|
2023-09-17 14:01:34 -04:00
|
|
|
if (ANDROID)
|
|
|
|
# needed to define some opengl functions
|
|
|
|
target_link_libraries(${PROJECT_NAME} EGL)
|
2024-02-02 04:40:07 -05:00
|
|
|
|
2024-02-03 06:40:44 -05:00
|
|
|
if (GEODE_USE_BREAKPAD)
|
2024-02-02 04:40:07 -05:00
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE -DGEODE_USE_BREAKPAD)
|
|
|
|
target_link_libraries(${PROJECT_NAME} Breakpad)
|
|
|
|
endif()
|
2023-09-17 14:01:34 -04:00
|
|
|
endif()
|
|
|
|
|
2022-07-30 12:24:03 -04:00
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
2022-12-10 11:30:14 -05:00
|
|
|
src/
|
|
|
|
src/loader/
|
2022-07-30 12:24:03 -04:00
|
|
|
src/internal/
|
|
|
|
src/platform/
|
|
|
|
src/gui/
|
2022-08-01 11:18:03 -04:00
|
|
|
hash/
|
2023-01-23 13:30:18 -05:00
|
|
|
./
|
2022-07-30 12:24:03 -04:00
|
|
|
)
|
|
|
|
|
2022-12-12 16:07:34 -05:00
|
|
|
if (APPLE)
|
|
|
|
# For profiling
|
|
|
|
target_compile_options(${PROJECT_NAME} PUBLIC "-ftime-trace")
|
2022-12-13 10:34:09 -05:00
|
|
|
# target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-e,_dynamicInit")
|
2022-12-12 16:07:34 -05:00
|
|
|
#set_property(TARGET ${PROJECT_NAME} PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
|
|
|
|
endif()
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2023-05-24 15:17:58 -04:00
|
|
|
target_compile_definitions(${PROJECT_NAME} PUBLIC GEODE_EXPORTING MAT_JSON_EXPORTING)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2023-08-09 13:30:53 -04:00
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|
|
|
GEODE_EXPOSE_SECRET_INTERNALS_IN_HEADERS_DO_NOT_DEFINE_PLEASE
|
|
|
|
_CRT_SECURE_NO_WARNINGS
|
|
|
|
)
|
2023-08-02 10:54:17 -04:00
|
|
|
|
2023-01-27 07:10:44 -05:00
|
|
|
# These are only needed for building source :-)
|
|
|
|
if (NOT GEODE_BUILDING_DOCS)
|
|
|
|
# Markdown support
|
2024-06-12 02:18:13 -04:00
|
|
|
CPMAddPackage("gh:mity/md4c#release-0.5.2")
|
2022-12-12 14:23:53 -05:00
|
|
|
|
2023-01-31 07:48:34 -05:00
|
|
|
# Zip support (needed for in-memory streams, which zlib's minizip doesn't support)
|
2023-01-31 14:56:50 -05:00
|
|
|
set(MZ_LZMA Off CACHE INTERNAL "Enables LZMA & XZ compression")
|
2023-02-04 15:31:37 -05:00
|
|
|
set(MZ_ZSTD Off CACHE INTERNAL "")
|
2024-01-09 14:59:57 -05:00
|
|
|
set(MZ_BZIP2 Off CACHE INTERNAL "")
|
2023-08-04 14:22:09 -04:00
|
|
|
set(MZ_OPENSSL Off CACHE INTERNAL "")
|
|
|
|
set(MZ_LIBBSD Off CACHE INTERNAL "")
|
2024-02-03 12:50:03 -05:00
|
|
|
set(SKIP_INSTALL_ALL On CACHE INTERNAL "")
|
2023-08-02 10:34:36 -04:00
|
|
|
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
|
|
|
|
CPMAddPackage(
|
|
|
|
GITHUB_REPOSITORY zlib-ng/minizip-ng
|
|
|
|
GIT_TAG cee6d8c
|
2024-01-22 14:11:42 -05:00
|
|
|
OPTIONS "CMAKE_POLICY_DEFAULT_CMP0048 OLD" "ZLIB_TAG v1.2.13"
|
2023-08-02 10:34:36 -04:00
|
|
|
)
|
|
|
|
set(CMAKE_WARN_DEPRECATED ON CACHE BOOL "" FORCE)
|
|
|
|
|
|
|
|
# Silence warnings from dependencies
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
check_cxx_compiler_flag(-Wno-everything SUPPORTS_W_NO_EVERYTHING)
|
|
|
|
if (SUPPORTS_W_NO_EVERYTHING)
|
2023-08-02 11:27:38 -04:00
|
|
|
if (TARGET md4c)
|
|
|
|
target_compile_options(md4c PRIVATE -Wno-everything)
|
|
|
|
endif()
|
|
|
|
if (TARGET zlib)
|
|
|
|
target_compile_options(zlib PRIVATE -Wno-everything)
|
|
|
|
endif()
|
|
|
|
if (TARGET zlibstatic)
|
|
|
|
target_compile_options(zlibstatic PRIVATE -Wno-everything)
|
|
|
|
endif()
|
2023-08-02 10:34:36 -04:00
|
|
|
endif()
|
2023-01-31 07:48:34 -05:00
|
|
|
|
2023-01-27 07:10:44 -05:00
|
|
|
# Regex support
|
2024-02-11 13:58:46 -05:00
|
|
|
CPMAddPackage("gh:google/re2#c9cba76")
|
2022-12-14 06:50:16 -05:00
|
|
|
|
2024-06-11 10:59:49 -04:00
|
|
|
# Cool date library
|
|
|
|
CPMAddPackage("gh:HowardHinnant/date#1ead671")
|
|
|
|
|
2023-01-27 07:10:44 -05:00
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE ${md4c_SOURCE_DIR}/src)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2024-06-11 10:59:49 -04:00
|
|
|
target_link_libraries(${PROJECT_NAME} md4c re2 minizip date)
|
2023-01-27 07:10:44 -05:00
|
|
|
endif()
|
|
|
|
|
2024-05-31 08:22:41 -04:00
|
|
|
target_link_libraries(${PROJECT_NAME} TulipHook geode-sdk mat-json-impl)
|
|
|
|
|
|
|
|
# Required by curl for macos
|
|
|
|
if (APPLE)
|
|
|
|
target_link_libraries(${PROJECT_NAME} z)
|
|
|
|
endif()
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2023-08-02 10:34:36 -04:00
|
|
|
if (MSVC)
|
|
|
|
# Disable outputting .exp file
|
|
|
|
include(CheckLinkerFlag)
|
|
|
|
check_linker_flag(CXX /NOEXP SUPPORTS_NOEXP)
|
|
|
|
if (SUPPORTS_NOEXP)
|
|
|
|
target_link_options(${PROJECT_NAME} PRIVATE /NOEXP)
|
|
|
|
endif()
|
2024-02-12 14:27:23 -05:00
|
|
|
endif()
|
2024-01-12 10:33:17 -05:00
|
|
|
|
2024-02-12 14:27:23 -05:00
|
|
|
if (WIN32)
|
|
|
|
# allows forward compat on windows
|
|
|
|
if (MSVC)
|
|
|
|
target_link_options(${PROJECT_NAME} PRIVATE /DELAYLOAD:libcocos2d.dll /DELAYLOAD:libExtensions.dll)
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,/delayload:libcocos2d.dll" "-Wl,/delayload:libExtensions.dll")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unable to set DELAYLOAD! This is essential for Geode forward compatibility to work.")
|
|
|
|
endif()
|
2023-08-02 10:34:36 -04:00
|
|
|
endif()
|
2023-01-13 01:12:50 -05:00
|
|
|
|
2024-02-12 08:22:17 -05:00
|
|
|
# Use precompiled headers for faster builds
|
|
|
|
if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS)
|
|
|
|
target_precompile_headers(${PROJECT_NAME} PRIVATE
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Geode.hpp"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Create launcher
|
2023-08-01 14:57:01 -04:00
|
|
|
if (APPLE)
|
2023-01-27 18:59:43 -05:00
|
|
|
set_target_properties(geode-loader PROPERTIES
|
|
|
|
SYSTEM_NAME MacOS
|
2024-02-11 13:58:46 -05:00
|
|
|
OSX_DEPLOYMENT_TARGET 10.15
|
2023-01-27 18:59:43 -05:00
|
|
|
APPLE_SILICON_PROCESSOR x86_64
|
|
|
|
)
|
|
|
|
|
2022-10-08 05:41:36 -04:00
|
|
|
add_subdirectory(launcher/mac)
|
|
|
|
|
2023-08-21 23:20:20 -04:00
|
|
|
if(GEODE_TARGET_PLATFORM STREQUAL "iOS")
|
2022-07-30 12:24:03 -04:00
|
|
|
add_custom_command(TARGET geode-loader
|
2023-08-01 14:57:01 -04:00
|
|
|
POST_BUILD COMMAND
|
|
|
|
${CMAKE_INSTALL_NAME_TOOL} -id \"/Library/MobileSubstrate/DynamicLibraries/Geode.dylib\"
|
|
|
|
$<TARGET_FILE:geode-loader>)
|
2022-07-30 12:24:03 -04:00
|
|
|
endif()
|
2024-02-03 12:50:03 -05:00
|
|
|
|
|
|
|
set(LAUNCHER_TARGET GeodeBootstrapper)
|
2022-07-30 12:24:03 -04:00
|
|
|
elseif (WIN32)
|
|
|
|
add_subdirectory(launcher/windows)
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} dbghelp)
|
2022-10-06 13:46:07 -04:00
|
|
|
|
|
|
|
if (MSVC)
|
2023-08-01 14:57:01 -04:00
|
|
|
# disable warnings about CCNode::setID
|
2022-10-06 13:46:07 -04:00
|
|
|
target_link_options(${PROJECT_NAME} PUBLIC /ignore:4217)
|
|
|
|
endif()
|
2024-02-03 12:50:03 -05:00
|
|
|
|
|
|
|
set(LAUNCHER_TARGET ProxyLoader Updater)
|
2022-07-30 12:24:03 -04:00
|
|
|
endif()
|
|
|
|
|
2023-12-21 23:43:52 -05:00
|
|
|
add_subdirectory(test)
|
2024-02-03 12:50:03 -05:00
|
|
|
|
2024-02-03 13:02:40 -05:00
|
|
|
# Add install target on CLI >= 2.10.0 (which adds `geode profile path`)
|
2024-02-19 08:09:46 -05:00
|
|
|
if (NOT GEODE_BUILDING_DOCS)
|
|
|
|
# nest this because when building docs GEODE_CLI_VERSION is not defined
|
|
|
|
if (${GEODE_CLI_VERSION} VERSION_GREATER_EQUAL "2.10.0")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${GEODE_CLI} profile path -d
|
|
|
|
OUTPUT_VARIABLE GEODE_PROFILE_GD_PATH
|
|
|
|
RESULT_VARIABLE GEODE_PROFILE_GD_PATH_RESULT
|
2024-02-07 04:57:12 -05:00
|
|
|
)
|
2024-02-19 08:09:46 -05:00
|
|
|
if (${GEODE_PROFILE_GD_PATH_RESULT} EQUAL 0)
|
|
|
|
string(STRIP ${GEODE_PROFILE_GD_PATH} GEODE_PROFILE_GD_PATH)
|
|
|
|
install(
|
|
|
|
TARGETS geode-loader ${LAUNCHER_TARGET}
|
|
|
|
RUNTIME
|
|
|
|
DESTINATION "${GEODE_PROFILE_GD_PATH}"
|
|
|
|
)
|
|
|
|
file(GLOB RESOURCE_FILES ${GEODE_BIN_PATH}/nightly/resources/*.*)
|
|
|
|
install(
|
|
|
|
FILES ${RESOURCE_FILES}
|
|
|
|
DESTINATION "${GEODE_PROFILE_GD_PATH}/geode/resources/geode.loader"
|
|
|
|
)
|
|
|
|
endif()
|
2024-02-07 04:57:12 -05:00
|
|
|
endif()
|
2024-02-09 22:02:06 -05:00
|
|
|
endif()
|