psOff_public/CMakeLists.txt
2024-04-14 15:35:28 +02:00

106 lines
2.7 KiB
CMake

cmake_minimum_required(VERSION 3.24)
include(ExternalProject)
set(PSOFF_LIB_VERSION v.0.0)
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)
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Zi /GS- /GF /Gy /GR /Oi -Ofast -fno-strict-aliasing")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG /OPT:REF,ICF")
set(CMAKE_INSTALL_MESSAGE LAZY)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_WINDOWS_SYMBOL_VISIBILITY_IN_STATIC_LIBRARIES OFF)
if(NOT PRJ_SRC_DIR)
set(PRJ_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(NOT DEFINED IMAGE_BASE)
set(IMAGE_BASE 0x10000000)
endif()
# # Gather Infos
# Vulkan
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}")
# # - Gather Infos
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # Move all libs here post-build, except third_party
#
include_directories(BEFORE
${CMAKE_INSTALL_PREFIX}/development/include
${PRJ_SRC_DIR}/modules_include
${PRJ_SRC_DIR}/tools/logging
${PRJ_SRC_DIR}/tools/config_emu
${PRJ_SRC_DIR}/tools/gamereport
${PRJ_SRC_DIR}
${CMAKE_BINARY_DIR}/third_party/src/third_party/include
)
link_directories(BEFORE
${CMAKE_INSTALL_PREFIX}/development/lib
${CMAKE_BINARY_DIR}/third_party/src/third_party/lib
${CMAKE_BINARY_DIR}/core
${CMAKE_BINARY_DIR}/lib
${CMAKE_BINARY_DIR}/bin
)
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
)
set(TEST_BENCH OFF CACHE BOOL "Enable testing")
if(TEST_BENCH)
add_subdirectory(tests)
endif()
# include before link_libraries
add_subdirectory(tools/logging)
add_subdirectory(tools/config_emu)
add_subdirectory(tools/dll2Nids)
add_dependencies(dll2Nids third_party)
# -
link_libraries(
logging.lib
)
add_compile_definitions(IMAGE_BASE=${IMAGE_BASE})
# Internal Projects
add_subdirectory(modules)
add_subdirectory(core)
add_subdirectory(utility)
add_subdirectory(tools/gamereport)
# #- Projects
# # Install
install(DIRECTORY "${CMAKE_BINARY_DIR}/third_party/src/third_party/bin/" DESTINATION ${CMAKE_INSTALL_PREFIX}
FILES_MATCHING PATTERN "*.dll"
)
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"
)