85 lines
2.5 KiB
CMake
85 lines
2.5 KiB
CMake
# Build for 32-bit compatibility
|
|
add_compile_options(-m32)
|
|
add_link_options(-m32)
|
|
|
|
add_subdirectory(third_party/spdlog)
|
|
|
|
add_executable(game_re
|
|
r3/main.cpp
|
|
r3/binders/static_mem.cxx
|
|
gh_global.cxx
|
|
)
|
|
|
|
target_compile_features(game_re PUBLIC cxx_std_20)
|
|
|
|
target_include_directories(game_re PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink
|
|
)
|
|
|
|
if(WIN32)
|
|
target_link_directories(game_re PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink)
|
|
target_include_directories(game_re PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink)
|
|
target_link_libraries(game_re PRIVATE binkw32)
|
|
|
|
# Copy to output dir
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/binkw32.dll
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/third_party/bink/binkw32.dll ${CMAKE_CURRENT_BINARY_DIR}
|
|
)
|
|
add_custom_target(copy_binkw32 ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/binkw32.dll)
|
|
add_dependencies(game_re copy_binkw32)
|
|
endif()
|
|
|
|
target_compile_definitions(game_re PRIVATE
|
|
R3_GAME_DATA_DIR=\"${GAME_DATA_DIR}\"
|
|
)
|
|
|
|
get_filename_component(R3_DATA_SEGMENT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/gh_datasegment.bin" ABSOLUTE)
|
|
target_compile_definitions(game_re PRIVATE
|
|
R3_DATA_SEGMENT_FILE=\"${R3_DATA_SEGMENT_FILE}\"
|
|
)
|
|
|
|
if(WIN32)
|
|
target_link_directories(game_re PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/mssdk/lib)
|
|
target_include_directories(game_re SYSTEM AFTER PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/mssdk/include)
|
|
target_link_libraries(game_re PRIVATE
|
|
d3d8
|
|
dinput8
|
|
)
|
|
endif()
|
|
|
|
target_compile_definitions(game_re PRIVATE
|
|
_CRT_SECURE_NO_WARNINGS=1
|
|
_CRT_NONSTDC_NO_WARNINGS=1)
|
|
|
|
target_link_libraries(game_re PRIVATE spdlog)
|
|
|
|
file(GLOB GH_AUTO_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/gh_auto/*.cxx)
|
|
file(GLOB GH_FIX_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/gh_fix/*.cxx)
|
|
file(GLOB GH_STUB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/gh_stub/*.cxx)
|
|
|
|
target_sources(game_re PRIVATE
|
|
${GH_AUTO_SOURCES}
|
|
${GH_FIX_SOURCES}
|
|
${GH_STUB_SOURCES}
|
|
)
|
|
|
|
# Ignore -Wformat-security
|
|
target_compile_options(game_re PRIVATE -Wno-format-security)
|
|
|
|
# Ignore -Wmicrosoft-cast
|
|
target_compile_options(game_re PRIVATE -Wno-microsoft-cast)
|
|
|
|
# Automatically re-run CMake if any gh_*.cxx files change
|
|
# due to ghidra script runs
|
|
set_property(
|
|
DIRECTORY
|
|
APPEND
|
|
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gh_cmake_timestamp
|
|
)
|
|
|
|
target_precompile_headers(game_re PRIVATE
|
|
"$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/r3/binders/auto_pch.cxx>"
|
|
)
|