diff --git a/CMakeLists.txt b/CMakeLists.txt index 752c9cd824..a0a23e16ca 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($<$:/MP>) add_compile_options($<$:/utf-8>) add_compile_options($<$:/Zc:preprocessor>) +add_compile_options($<$:/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 33b45c26e4..3e1c432fef 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") "$<$:-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 index e92c2103e2..2ab12fe966 160000 --- a/torch +++ b/torch @@ -1 +1 @@ -Subproject commit e92c2103e22281b892e65760b4b11d81d4795c86 +Subproject commit 2ab12fe9660aec04e02ee89fe81baed304a1a1d6