summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Dubé <159546+serprex@users.noreply.github.com>2026-08-16 16:38:36 +0000
committerGitHub <noreply@github.com>2026-08-16 16:38:36 +0000
commitbc12521718daf84dbea2a1472cfbef7dba34bf42 (patch)
tree085be602ecc598c486ee22461bb0fdd359edc2f5
parent940e3c5696e1d31bc39666ea341f0f01f80f1f63 (diff)
Silence warnings on Windows for dependencies, bump torch (#7082)
-rw-r--r--CMakeLists.txt46
-rw-r--r--soh/CMakeLists.txt14
m---------torch0
3 files changed, 50 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 752c9cd82..a0a23e16c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt
index 33b45c26e..3e1c432fe 100644
--- a/soh/CMakeLists.txt
+++ b/soh/CMakeLists.txt
@@ -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()
diff --git a/torch b/torch
-Subproject e92c2103e22281b892e65760b4b11d81d4795c8
+Subproject 2ab12fe9660aec04e02ee89fe81baed304a1a1d