diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c99bdd9a0..764046a240 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,9 +315,10 @@ endif() # For Visual Studio prior to 2022 (compiler < 19.30) /fp:strict # For Visual Studio 2022 (compiler >= 19.30) /fp:precise -# For Visual Studio 2022 ClangCL seems to have accidentally enabled contraction by default, -# so behaves differently to CL.exe. Use the -Xclang argument to workaround and allow access -# GNU-style switch to control contraction and force disable. +# For Visual Studio 2022 ClangCL has enabled contraction by default, +# which is the same as standard clang, so behaves differently to +# CL.exe. Use the -Xclang argument to access GNU-style switch to +# control contraction and force disable. # On CMake 3.25 or older CXX_COMPILER_FRONTEND_VARIANT is not always set if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "") @@ -338,6 +339,7 @@ set(is_gnu_fe1 "$") set(is_gnu_fe2 "$") # Compiler accepts GNU-style command line options set(is_gnu_fe "$") +#add_custom_target(debug_isgnufe1 COMMAND ${CMAKE_COMMAND} -E echo "is_gnufe1_exp = $") # Compiler is Visual Studio cl.exe set(is_msvccl "$>") @@ -346,24 +348,18 @@ set(is_clangcl "$>") # Compiler is upstream clang with the standard frontend set(is_clang "$>") -if(${is_msvccl} AND $,19.30>) - add_compile_options(/fp:strict) -endif() -if(${is_msvccl} AND $,19.30>) - add_compile_options(/fp:precise) -endif() -if(${is_clangcl}) - add_compile_options(/fp:precise) -endif() -if(${is_clangcl} AND $,14.0.0>) - add_compile_options(-Xclang -ffp-contract=off) -endif() -if(${is_clang} AND $,10.0.0>) - add_compile_options(-ffp-model=precise) -endif() -if(${is_gnu_fe}) - add_compile_options(-ffp-contract=off) -endif() +add_compile_options( + $<$,19.30>>:/fp:strict> + $<$,19.30>>:/fp:precise> + $<${is_clangcl}:/fp:precise> + $<$,14.0.0>>:-Xclang$-ffp-contract=off> + $<$,10.0.0>>:-ffp-model=precise> + $<${is_gnu_fe}:-ffp-contract=off> + # Hide noise from clang and clangcl 20 warning the 2nd fp option changes + # one of the settings made the first. + $<$,20.0.0>>:-Wno-overriding-option> +) +#add_custom_target(debug_gnufe_ffpcontract COMMAND ${CMAKE_COMMAND} -E echo "ffp_contract = $<${is_gnu_fe}:-ffp-contract=off>") set(KTX_BUILD_DIR "${CMAKE_BINARY_DIR}") diff --git a/external/astc-encoder/Source/cmake_core.cmake b/external/astc-encoder/Source/cmake_core.cmake index e78eb70bba..be43ee913b 100644 --- a/external/astc-encoder/Source/cmake_core.cmake +++ b/external/astc-encoder/Source/cmake_core.cmake @@ -176,6 +176,7 @@ macro(astcenc_set_properties ASTCENC_TARGET_NAME ASTCENC_IS_VENEER) $<${is_gnu_fe}:-Wno-float-equal> $<${is_gnu_fe}:-Wno-deprecated-declarations> $<${is_gnu_fe}:-Wno-atomic-implicit-seq-cst> + $<${is_clang}:-Wno-overriding-option> # Clang 10 also throws up warnings we need to investigate (ours) $<${is_gnu_fe}:-Wno-cast-align> diff --git a/scripts/build_wasm_docker.sh b/scripts/build_wasm_docker.sh index 0d15396dbf..9e80ed0540 100755 --- a/scripts/build_wasm_docker.sh +++ b/scripts/build_wasm_docker.sh @@ -74,12 +74,18 @@ mkdir -p $BUILD_DIR # emcmake uses the "Unix Makefiles" generator on Linux which does not # support multiple configurations. echo "Configure and Build KTX-Software (Web $CONFIGURATION)" + +# Uncomment and set to desired targets if you don't want to build everything. +#targets="--target debug_isgnufe1 --target debug_gnufe_ffpcontract" +# Uncomment to have make run in verbose mode. +#verbose_make="-- VERBOSE=1" + docker exec -it emscripten sh -c "emcmake cmake -B$BUILD_DIR . \ -D CMAKE_BUILD_TYPE=$CONFIGURATION \ -D KTX_FEATURE_DOC=OFF \ -D KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS \ -D KTX_WERROR=$WERROR \ - && cmake --build $BUILD_DIR" + && cmake --build $BUILD_DIR $targets $verbose_make" if [ "$PACKAGE" = "YES" ]; then echo "Pack KTX-Software (Web $CONFIGURATION)"