diff --git a/.gitattributes b/.gitattributes index 3b11aee0fe..6313b56c57 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1 @@ * text=auto eol=lf - -# TEMPORARY (Torch migration): checked-in archive. text=auto would almost certainly -# detect this as binary anyway, but an eol conversion on a 4.4 MB zip would corrupt it -# silently, so say so explicitly. Remove with prebuilt/ -- see prebuilt/README.md. -prebuilt/soh.o2r binary diff --git a/CMakeLists.txt b/CMakeLists.txt index b6ab7a1179..d700113ab4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,20 @@ find_package(ZLIB REQUIRED) include(FetchContent) +# Workaround: torch declares spdlog without OVERRIDE_FIND_PACKAGE and the first declaration +# wins, which leaves libultraship's find_package(spdlog REQUIRED) with no config to find. +# Declaring it here first keeps that working. See HarbourMasters/Torch#233. +find_package(spdlog QUIET) +if(NOT spdlog_FOUND) + FetchContent_Declare( + spdlog + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_TAG v1.16.0 + OVERRIDE_FIND_PACKAGE + ) + FetchContent_MakeAvailable(spdlog) +endif() + set(USE_STANDALONE OFF CACHE BOOL "" FORCE) # static lib, no CLI set(PORT_VERSION_ENDIANNESS ON CACHE BOOL "" FORCE) # 7-byte portVersion set(ROM_CRC_BSWAP OFF CACHE BOOL "" FORCE) @@ -218,14 +232,14 @@ FetchContent_MakeAvailable(torch) # Build-time ROM extraction. soh links torch as a static library, which compiles out torch's # own CLI, so this supplies an entry point around the same code the game runs. -add_executable(soh-torch +add_executable(soh-torch EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/soh/assets/tools/torch-cli/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/soh/soh/Extractor/TorchExtract.cpp ) target_include_directories(soh-torch PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/soh/soh/Extractor) target_link_libraries(soh-torch PRIVATE torch) -add_executable(soh-o2r-packer +add_executable(soh-o2r-packer EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/soh/assets/tools/soh-o2r-packer/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/soh/assets/tools/soh-o2r-packer/PngTexture.cpp ) diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 8d15b6f4ff..462ca6412e 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -226,6 +226,12 @@ set(ALL_FILES ################################################################################ add_executable(${PROJECT_NAME} ${ALL_FILES}) +if(MSVC) + # yaml-cpp, reached through torch's headers, trips the dll-interface warnings, and soh + # builds with /WX. + set_source_files_properties(soh/Extractor/TorchExtract.cpp PROPERTIES COMPILE_OPTIONS "/wd4251;/wd4275") +endif() + if (CMAKE_SYSTEM_NAME STREQUAL "Windows") use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") endif()