2022-07-30 12:24:03 -04:00
|
|
|
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
|
|
|
|
2022-10-05 08:41:05 -04:00
|
|
|
project(geode-loader VERSION ${GEODE_VERSION} LANGUAGES C CXX)
|
2023-01-24 06:17:27 -05:00
|
|
|
set(PROJECT_VERSION_TYPE geode::VersionTag::Beta)
|
|
|
|
set(PROJECT_VERSION_SUFFIX -beta)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Package info file for internal representation
|
2022-10-03 06:51:48 -04:00
|
|
|
configure_file(resources/mod.json.in ${CMAKE_CURRENT_SOURCE_DIR}/resources/mod.json)
|
|
|
|
file(READ resources/mod.json LOADER_MOD_JSON)
|
2022-07-30 12:24:03 -04:00
|
|
|
file(READ resources/about.md LOADER_ABOUT_MD)
|
|
|
|
configure_file(src/internal/about.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/internal/about.hpp)
|
|
|
|
|
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
|
2022-11-28 12:45:23 -05:00
|
|
|
src/platform/mac/*.cpp
|
|
|
|
src/platform/ios/*.cpp
|
2022-11-29 17:48:06 -05:00
|
|
|
src/loader/*.cpp
|
2022-07-30 12:24:03 -04:00
|
|
|
src/main.cpp
|
|
|
|
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
|
2022-10-05 08:41:05 -04:00
|
|
|
src/ui/internal/*.cpp
|
2022-08-01 11:18:03 -04:00
|
|
|
src/ui/internal/credits/*.cpp
|
|
|
|
src/ui/internal/dev/*.cpp
|
|
|
|
src/ui/internal/info/*.cpp
|
|
|
|
src/ui/internal/list/*.cpp
|
|
|
|
src/ui/internal/settings/*.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
|
2022-11-28 13:49:21 -05:00
|
|
|
src/platform/ios/*.mm
|
|
|
|
src/platform/mac/*.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)
|
|
|
|
|
|
|
|
# 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})
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
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)
|
|
|
|
|
2022-07-30 12:24:03 -04:00
|
|
|
make_directory("${GEODE_BIN_PATH}/nightly")
|
|
|
|
|
|
|
|
# Prevent SDK from activating a loader build
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
|
|
PREFIX ""
|
|
|
|
OUTPUT_NAME "Geode"
|
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()
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2022-09-28 10:38:02 -04:00
|
|
|
target_compile_definitions(${PROJECT_NAME} PUBLIC GEODE_EXPORTING)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2023-01-27 07:10:44 -05:00
|
|
|
# These are only needed for building source :-)
|
|
|
|
if (NOT GEODE_BUILDING_DOCS)
|
|
|
|
# Markdown support
|
|
|
|
CPMAddPackage("gh:mity/md4c#e9ff661")
|
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)
|
|
|
|
CPMAddPackage("gh:zlib-ng/minizip-ng#cee6d8c")
|
|
|
|
|
2023-01-27 07:10:44 -05:00
|
|
|
# Regex support
|
|
|
|
CPMAddPackage("gh:google/re2#954656f")
|
2022-12-14 06:50:16 -05:00
|
|
|
|
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
|
|
|
|
2023-01-31 07:48:34 -05:00
|
|
|
target_link_libraries(${PROJECT_NAME} md4c re2 minizip)
|
2023-01-27 07:10:44 -05:00
|
|
|
endif()
|
|
|
|
|
2023-01-27 18:25:19 -05:00
|
|
|
target_link_libraries(${PROJECT_NAME} z TulipHook geode-sdk mat-json)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2023-01-13 01:12:50 -05:00
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Use precompiled headers for faster builds
|
2022-12-30 17:50:12 -05:00
|
|
|
if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS)
|
|
|
|
target_precompile_headers(${PROJECT_NAME} PRIVATE
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/DefaultInclude.hpp"
|
|
|
|
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Utils.hpp"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Loader.hpp"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/UI.hpp"
|
|
|
|
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Bindings.hpp"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/include/cocos2d.h"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/extensions/cocos-ext.h"
|
|
|
|
)
|
|
|
|
endif()
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Create launcher
|
2022-07-30 12:24:03 -04:00
|
|
|
if (APPLE)
|
2023-01-27 18:59:43 -05:00
|
|
|
set_target_properties(geode-loader PROPERTIES
|
|
|
|
SYSTEM_NAME MacOS
|
|
|
|
OSX_DEPLOYMENT_TARGET 10.9
|
|
|
|
APPLE_SILICON_PROCESSOR x86_64
|
|
|
|
)
|
|
|
|
|
2022-10-08 05:41:36 -04:00
|
|
|
add_subdirectory(launcher/mac)
|
|
|
|
|
2022-07-30 12:24:03 -04:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR GEODE_TARGET_PLATFORM STREQUAL "iOS")
|
|
|
|
add_custom_command(TARGET geode-loader
|
|
|
|
POST_BUILD COMMAND
|
|
|
|
${CMAKE_INSTALL_NAME_TOOL} -id \"/Library/MobileSubstrate/DynamicLibraries/Geode.dylib\"
|
|
|
|
$<TARGET_FILE:geode-loader>)
|
|
|
|
endif()
|
|
|
|
elseif (WIN32)
|
|
|
|
add_subdirectory(launcher/windows)
|
|
|
|
|
2022-12-12 14:23:53 -05:00
|
|
|
CPMAddPackage("gh:TsudaKageyu/minhook#49d03ad")
|
2022-09-01 04:02:14 -04:00
|
|
|
target_link_libraries(${PROJECT_NAME} minhook)
|
|
|
|
|
|
|
|
# target_include_directories(${PROJECT_NAME} PRIVATE dobby/include)
|
|
|
|
# target_link_directories(${PROJECT_NAME} PRIVATE dobby)
|
|
|
|
# target_link_libraries(${PROJECT_NAME} dobby)
|
|
|
|
|
|
|
|
# set(DOBBY_GENERATE_SHARED OFF CACHE BOOL "Build dobby shared library" FORCE)
|
|
|
|
# # set(DOBBY_DEBUG ON CACHE BOOL "Build dobby shared library" FORCE)
|
|
|
|
# add_subdirectory(dobby)
|
2022-07-30 12:24:03 -04:00
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} dbghelp)
|
2022-10-06 13:46:07 -04:00
|
|
|
|
|
|
|
# disable warnings about CCNode::setID
|
|
|
|
if (MSVC)
|
|
|
|
target_link_options(${PROJECT_NAME} PUBLIC /ignore:4217)
|
|
|
|
endif()
|
2022-07-30 12:24:03 -04:00
|
|
|
endif()
|
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
# Build test mods if needed
|
2022-07-30 12:24:03 -04:00
|
|
|
if(NOT GEODE_DONT_BUILD_TEST_MODS)
|
2022-09-12 17:37:25 -04:00
|
|
|
add_subdirectory(test)
|
2022-07-30 12:24:03 -04:00
|
|
|
endif()
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
# Build index hashing algorithm test program
|
|
|
|
add_subdirectory(hash)
|