Silence warnings on Windows for dependencies, bump torch (#7082)

This commit is contained in:
Philip Dubé
2026-08-16 16:38:36 +00:00
committed by GitHub
parent 940e3c5696
commit bc12521718
3 changed files with 51 additions and 11 deletions
+42 -4
View File
@@ -80,6 +80,7 @@ set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/Zc:preprocessor>)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/external:W0>)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(NOT CMAKE_VS_PLATFORM_NAME)
@@ -241,9 +242,46 @@ foreach(_torch_game SM64 MK64 SF64 PM64 FZERO BK64 MARIO_ARTIST)
set(BUILD_${_torch_game} OFF CACHE BOOL "" FORCE)
endforeach()
add_compile_definitions(YAML_CPP_STATIC_DEFINE)
# SYSTEM only covers headers we include; torch and the libraries it fetches still warn while
# compiling their own sources. None of that is ours to fix.
if(MSVC)
set(DEP_WARNING_OVERRIDE /w)
else()
set(DEP_WARNING_OVERRIDE -w)
endif()
add_subdirectory(torch)
# Drops the target's own warning level before adding ours: cl warns (D9025) about the
# conflict instead of just taking the last flag. /O3 goes too, MSVC does not know it
# (D9002) and the -O2 in CMAKE_CXX_FLAGS_RELEASE is what these actually get.
function(quiet_target target override)
if(NOT override)
return()
endif()
get_target_property(_opts ${target} COMPILE_OPTIONS)
if(_opts)
list(REMOVE_ITEM _opts /O3 /W0 /W1 /W2 /W3 /W4 /Wall -Wall)
set_target_properties(${target} PROPERTIES COMPILE_OPTIONS "${_opts}")
endif()
target_compile_options(${target} PRIVATE ${override})
endfunction()
function(quiet_dependency_tree dir)
get_property(_targets DIRECTORY "${dir}" PROPERTY BUILDSYSTEM_TARGETS)
foreach(_target IN LISTS _targets)
get_target_property(_type ${_target} TYPE)
if(_type STREQUAL "INTERFACE_LIBRARY" OR _type STREQUAL "UTILITY")
continue()
endif()
quiet_target(${_target} "${DEP_WARNING_OVERRIDE}")
endforeach()
get_property(_subdirs DIRECTORY "${dir}" PROPERTY SUBDIRECTORIES)
foreach(_subdir IN LISTS _subdirs)
quiet_dependency_tree("${_subdir}")
endforeach()
endfunction()
add_subdirectory(torch SYSTEM)
quiet_dependency_tree(${CMAKE_CURRENT_SOURCE_DIR}/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.
@@ -325,8 +363,8 @@ endif()
################################################################################
# Sub-projects
################################################################################
add_subdirectory(libultraship ${CMAKE_BINARY_DIR}/libultraship)
target_compile_options(libultraship PRIVATE "${WARNING_OVERRIDE}")
add_subdirectory(libultraship ${CMAKE_BINARY_DIR}/libultraship SYSTEM)
quiet_target(libultraship "${WARNING_OVERRIDE}")
target_compile_definitions(libultraship PUBLIC INCLUDE_MPQ_SUPPORT)
add_subdirectory(soh)
+8 -6
View File
@@ -102,7 +102,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Sub-projects
################################################################################
if (NOT TARGET libultraship)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship ${CMAKE_BINARY_DIR}/libultraship)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship ${CMAKE_BINARY_DIR}/libultraship SYSTEM)
endif()
set(PROJECT_NAME soh)
@@ -315,15 +315,17 @@ endif()
# Compile definitions
################################################################################
target_include_directories(${PROJECT_NAME} PRIVATE assets
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include/
${CMAKE_CURRENT_SOURCE_DIR}/src/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/include
${CMAKE_CURRENT_SOURCE_DIR}/assets/
.
)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
${SDL2-INCLUDE}
${SDL2-NET-INCLUDE}
${CMAKE_CURRENT_SOURCE_DIR}/assets/
${dr_libs_SOURCE_DIR}
.
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
@@ -678,7 +680,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
"$<$<CONFIG:Debug>:-Wl,--wrap=abort>"
)
target_include_directories(${PROJECT_NAME} PRIVATE
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
${DEVKITPRO}/portlibs/wiiu/include/
)
else()
+1 -1
Submodule torch updated: e92c2103e2...2ab12fe966