2024-02-27 18:51:39 +00:00
|
|
|
cmake_minimum_required(VERSION 3.24)
|
2024-04-14 13:20:25 +00:00
|
|
|
include(ExternalProject)
|
|
|
|
|
2024-05-04 20:03:48 +00:00
|
|
|
set(PSOFF_LIB_VERSION v.0.3)
|
2024-05-04 19:13:19 +00:00
|
|
|
set(PSOFF_RENDER_VERSION v.0.5-nightly_04.05.24)
|
2024-02-27 18:51:39 +00:00
|
|
|
|
|
|
|
set(ProjectName psOff_${CMAKE_BUILD_TYPE})
|
|
|
|
project(${ProjectName} VERSION 0.0.1)
|
|
|
|
|
|
|
|
unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
2024-04-29 13:11:26 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Zi /GS- /GF /Gy /GR /Oi -Ofast -fno-strict-aliasing")
|
2024-02-27 22:34:08 +00:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG /OPT:REF,ICF")
|
2024-04-08 08:55:19 +00:00
|
|
|
set(CMAKE_INSTALL_MESSAGE LAZY)
|
2024-02-27 18:51:39 +00:00
|
|
|
|
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
|
|
set(CMAKE_WINDOWS_SYMBOL_VISIBILITY_IN_STATIC_LIBRARIES OFF)
|
|
|
|
|
2024-03-01 13:09:57 +00:00
|
|
|
if(NOT PRJ_SRC_DIR)
|
|
|
|
set(PRJ_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
endif()
|
|
|
|
|
2024-04-28 13:40:28 +00:00
|
|
|
set(IMAGE_BASE 0x10000000)
|
2024-03-04 19:16:43 +00:00
|
|
|
|
2024-02-27 22:34:08 +00:00
|
|
|
# # Gather Infos
|
|
|
|
|
|
|
|
# Vulkan
|
2024-02-27 18:51:39 +00:00
|
|
|
find_package(Vulkan 1.3 REQUIRED)
|
|
|
|
message("Vulkan Libs: ${Vulkan_LIBRARIES}")
|
|
|
|
message("Vulkan Include: ${Vulkan_INCLUDE_DIRS}")
|
|
|
|
|
|
|
|
get_filename_component(VulkanPath ${Vulkan_LIBRARY} DIRECTORY)
|
|
|
|
message("Vulkan Path: ${VulkanPath}")
|
|
|
|
|
2024-02-27 22:34:08 +00:00
|
|
|
# # - Gather Infos
|
2024-03-02 14:41:36 +00:00
|
|
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # Move all libs here post-build, except third_party
|
2024-04-29 11:44:48 +00:00
|
|
|
add_definitions(-DPSOFF_RENDER_VERSION="${PSOFF_RENDER_VERSION}")
|
2024-03-02 14:41:36 +00:00
|
|
|
|
2024-02-27 22:34:08 +00:00
|
|
|
#
|
2024-02-27 18:51:39 +00:00
|
|
|
include_directories(BEFORE
|
2024-02-28 11:45:13 +00:00
|
|
|
${CMAKE_INSTALL_PREFIX}/development/include
|
2024-03-01 13:09:57 +00:00
|
|
|
${PRJ_SRC_DIR}/modules_include
|
2024-03-01 14:09:01 +00:00
|
|
|
${PRJ_SRC_DIR}/tools/logging
|
2024-03-18 19:44:19 +00:00
|
|
|
${PRJ_SRC_DIR}/tools/config_emu
|
2024-04-07 16:44:11 +00:00
|
|
|
${PRJ_SRC_DIR}/tools/gamereport
|
2024-03-01 13:09:57 +00:00
|
|
|
${PRJ_SRC_DIR}
|
2024-04-14 13:20:25 +00:00
|
|
|
${CMAKE_BINARY_DIR}/third_party/src/third_party/include
|
2024-04-28 19:04:17 +00:00
|
|
|
${CMAKE_BINARY_DIR}/psoff_render/src/psoff_render/include
|
2024-02-27 18:51:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
link_directories(BEFORE
|
2024-02-28 11:45:13 +00:00
|
|
|
${CMAKE_INSTALL_PREFIX}/development/lib
|
2024-04-14 13:20:25 +00:00
|
|
|
${CMAKE_BINARY_DIR}/third_party/src/third_party/lib
|
2024-02-29 16:54:15 +00:00
|
|
|
${CMAKE_BINARY_DIR}/core
|
2024-03-02 13:48:41 +00:00
|
|
|
${CMAKE_BINARY_DIR}/lib
|
2024-04-14 13:20:25 +00:00
|
|
|
${CMAKE_BINARY_DIR}/bin
|
2024-04-28 19:04:17 +00:00
|
|
|
${CMAKE_BINARY_DIR}/psoff_render/src/psoff_render/lib
|
2024-02-27 18:51:39 +00:00
|
|
|
)
|
|
|
|
|
2024-04-14 13:20:25 +00:00
|
|
|
ExternalProject_Add(third_party
|
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_COMMAND ""
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}/third_party
|
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
URL https://github.com/SysRay/psOff_thirdParty/releases/download/${PSOFF_LIB_VERSION}/psOff-3rd.zip
|
|
|
|
)
|
2024-03-01 14:09:01 +00:00
|
|
|
|
2024-04-17 19:39:03 +00:00
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2024-04-28 13:40:28 +00:00
|
|
|
ExternalProject_Add(psoff_render
|
2024-04-17 19:39:03 +00:00
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_COMMAND ""
|
|
|
|
INSTALL_COMMAND ""
|
2024-04-28 13:40:28 +00:00
|
|
|
PREFIX ${CMAKE_BINARY_DIR}/psoff_render
|
2024-04-17 19:39:03 +00:00
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
URL https://github.com/SysRay/psOff_Renderer/releases/download/${PSOFF_RENDER_VERSION}/psOff-renderer.zip
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-04-09 19:10:51 +00:00
|
|
|
set(TEST_BENCH OFF CACHE BOOL "Enable testing")
|
|
|
|
|
|
|
|
if(TEST_BENCH)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
|
|
|
|
2024-04-14 13:20:25 +00:00
|
|
|
# include before link_libraries
|
|
|
|
add_subdirectory(tools/logging)
|
|
|
|
add_subdirectory(tools/config_emu)
|
|
|
|
add_subdirectory(tools/dll2Nids)
|
2024-04-28 19:04:17 +00:00
|
|
|
add_subdirectory(asm)
|
|
|
|
|
2024-04-14 13:20:25 +00:00
|
|
|
add_dependencies(dll2Nids third_party)
|
|
|
|
|
|
|
|
# -
|
2024-02-27 18:51:39 +00:00
|
|
|
link_libraries(
|
2024-03-01 14:09:01 +00:00
|
|
|
logging.lib
|
2024-02-27 18:51:39 +00:00
|
|
|
)
|
2024-03-04 19:16:43 +00:00
|
|
|
add_compile_definitions(IMAGE_BASE=${IMAGE_BASE})
|
2024-02-27 18:51:39 +00:00
|
|
|
|
2024-02-27 22:34:08 +00:00
|
|
|
# Internal Projects
|
2024-02-27 18:51:39 +00:00
|
|
|
add_subdirectory(modules)
|
2024-02-29 16:00:13 +00:00
|
|
|
add_subdirectory(core)
|
2024-03-01 15:06:58 +00:00
|
|
|
add_subdirectory(utility)
|
2024-04-14 13:20:25 +00:00
|
|
|
add_subdirectory(tools/gamereport)
|
2024-03-01 14:09:01 +00:00
|
|
|
|
2024-02-27 22:34:08 +00:00
|
|
|
# #- Projects
|
|
|
|
|
2024-04-28 13:40:28 +00:00
|
|
|
# Executable
|
|
|
|
add_executable(psoff
|
|
|
|
main.cpp
|
|
|
|
)
|
|
|
|
|
2024-04-28 19:04:17 +00:00
|
|
|
add_dependencies(psoff logging core psOff_utility)
|
|
|
|
|
|
|
|
target_link_libraries(psoff PRIVATE
|
|
|
|
core.lib
|
|
|
|
psOff_utility
|
2024-05-05 11:36:49 +00:00
|
|
|
libboost_filesystem
|
2024-04-28 19:04:17 +00:00
|
|
|
$<TARGET_OBJECTS:asmHelper>
|
|
|
|
)
|
|
|
|
|
2024-04-28 13:40:28 +00:00
|
|
|
target_link_options(psoff PUBLIC /DEBUG /DYNAMICBASE:NO --image-base=${IMAGE_BASE})
|
|
|
|
|
2024-04-29 10:18:05 +00:00
|
|
|
set_property(TARGET psoff PROPERTY VS_DPI_AWARE "PerMonitor") # SDL2 High dpi window
|
|
|
|
|
2024-02-27 22:34:08 +00:00
|
|
|
# # Install
|
2024-04-14 13:20:25 +00:00
|
|
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/third_party/src/third_party/bin/" DESTINATION ${CMAKE_INSTALL_PREFIX}
|
2024-02-27 22:34:08 +00:00
|
|
|
FILES_MATCHING PATTERN "*.dll"
|
2024-04-14 13:35:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/bin/" DESTINATION ${CMAKE_INSTALL_PREFIX}
|
|
|
|
FILES_MATCHING PATTERN "*.dll"
|
|
|
|
)
|
|
|
|
|
|
|
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/" DESTINATION ${CMAKE_INSTALL_PREFIX}
|
|
|
|
FILES_MATCHING PATTERN "*.dll"
|
2024-04-23 17:26:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
install(DIRECTORY "${PRJ_SRC_DIR}/docs/json/" DESTINATION ${CMAKE_INSTALL_PREFIX}/config/.schemas
|
|
|
|
FILES_MATCHING PATTERN "*.json"
|
|
|
|
)
|
2024-04-28 19:04:17 +00:00
|
|
|
|
2024-04-29 10:49:41 +00:00
|
|
|
if(DEFINED ISACTION)
|
2024-04-29 09:48:32 +00:00
|
|
|
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/bin/vulkan-1.dll CONTENT "") # cmake needs to find the file in order to ignore it
|
|
|
|
endif()
|
|
|
|
|
2024-04-28 19:04:17 +00:00
|
|
|
install(TARGETS psoff
|
|
|
|
COMPONENT psoff
|
|
|
|
RUNTIME_DEPENDENCIES
|
2024-04-29 09:15:20 +00:00
|
|
|
PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-"
|
2024-04-29 09:48:32 +00:00
|
|
|
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" ".*vulkan-1\\.dll"
|
2024-04-29 12:32:47 +00:00
|
|
|
|
2024-04-28 19:04:17 +00:00
|
|
|
DIRECTORIES
|
|
|
|
$<TARGET_FILE_DIR:psoff>
|
|
|
|
${CMAKE_BINARY_DIR}/third_party/src/third_party/bin
|
|
|
|
${CMAKE_BINARY_DIR}/third_party/src/third_party/lib
|
|
|
|
${CMAKE_BINARY_DIR}/bin
|
|
|
|
${CMAKE_BINARY_DIR}/lib
|
2024-04-29 12:17:38 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/core
|
2024-04-28 19:04:17 +00:00
|
|
|
${CMAKE_BINARY_DIR}/psoff_render/src/psoff_render/lib
|
|
|
|
DESTINATION .
|
|
|
|
)
|
|
|
|
|
2024-04-29 11:44:48 +00:00
|
|
|
install(FILES $<TARGET_PDB_FILE:psoff> DESTINATION ${CMAKE_INSTALL_PREFIX}/debug OPTIONAL)
|