diff --git a/docs/how/cmake_bgfx/cmake/CMakeTSLANGInformation.cmake b/docs/how/cmake_bgfx/cmake/CMakeTSLANGInformation.cmake index d672c2268..814189e19 100644 --- a/docs/how/cmake_bgfx/cmake/CMakeTSLANGInformation.cmake +++ b/docs/how/cmake_bgfx/cmake/CMakeTSLANGInformation.cmake @@ -1,15 +1,13 @@ # bx propagates -msse4.2 via PUBLIC compile options on GCC/Clang. tslang does -# not accept those flags, so filter them through a small wrapper on Unix. +# not accept those flags, so filter them through a small portable wrapper +# invoked via `cmake -P` (works the same under Ninja on Windows and Unix, +# unlike a #!/usr/bin/env bash script which Ninja cannot exec on Windows). get_filename_component(_TSLANG_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) set(_TSLANG_COMPILE_TEMPLATE " --default-lib-path=${CMAKE_TSLANG_DIR} --emit=obj --export=none -o= ") if(NOT CMAKE_TSLANG_COMPILE_OBJECT) - if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") - set(CMAKE_TSLANG_COMPILE_OBJECT - "${_TSLANG_CMAKE_DIR}/tslang_compile.sh ${_TSLANG_COMPILE_TEMPLATE}") - else() - set(CMAKE_TSLANG_COMPILE_OBJECT "${_TSLANG_COMPILE_TEMPLATE}") - endif() + set(CMAKE_TSLANG_COMPILE_OBJECT + "\"${CMAKE_COMMAND}\" -P \"${_TSLANG_CMAKE_DIR}/tslang_filter_flags.cmake\" -- ${_TSLANG_COMPILE_TEMPLATE}") endif() if(NOT CMAKE_TSLANG_LINK_EXECUTABLE) diff --git a/docs/how/cmake_bgfx/cmake/LocateTSLang.cmake b/docs/how/cmake_bgfx/cmake/LocateTSLang.cmake index 2984d8e5e..02e19f3ca 100644 --- a/docs/how/cmake_bgfx/cmake/LocateTSLang.cmake +++ b/docs/how/cmake_bgfx/cmake/LocateTSLang.cmake @@ -113,10 +113,16 @@ function(setup_tslang_link_paths) message(FATAL_ERROR "setup_tslang_link_paths: TSLANG_PREFIX is not set") endif() + if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(_defaultlib_config "release") + else() + set(_defaultlib_config "debug") + endif() + set(_link_dirs "${TSLANG_BIN_DIR}" "${TSLANG_PREFIX}/lib" - "${TSLANG_BIN_DIR}/defaultlib/lib") + "${TSLANG_BIN_DIR}/defaultlib/lib/${_defaultlib_config}") if(TSLANG_ROOT) if(EXISTS "${TSLANG_ROOT}/gc/release") diff --git a/docs/how/cmake_bgfx/cmake/tslang_compile.sh b/docs/how/cmake_bgfx/cmake/tslang_compile.sh deleted file mode 100755 index a5311ee48..000000000 --- a/docs/how/cmake_bgfx/cmake/tslang_compile.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -# Filter C++ CPU flags that linked targets (bx/bgfx) export via PUBLIC -# compile options. tslang does not accept those flags. -set -euo pipefail - -filtered=() -for arg in "$@"; do - case "${arg}" in - -msse4.2|-msse4.1|-mavx|-mavx2) ;; - *) filtered+=("${arg}") ;; - esac -done - -exec "${filtered[@]}" diff --git a/docs/how/cmake_bgfx/cmake/tslang_filter_flags.cmake b/docs/how/cmake_bgfx/cmake/tslang_filter_flags.cmake new file mode 100644 index 000000000..aca77c62c --- /dev/null +++ b/docs/how/cmake_bgfx/cmake/tslang_filter_flags.cmake @@ -0,0 +1,34 @@ +# Filter C++ CPU flags that linked targets (bx/bgfx) export via PUBLIC +# compile options. tslang does not accept those flags. +# +# Invoked as: +# cmake -P tslang_filter_flags.cmake -- +# +# Everything after the literal "--" argument is forwarded, with the +# blocked flags removed, to COMMAND. +# +# Note: CMAKE_ARGV is indexed access (CMAKE_ARGC gives the count); there +# is no plain CMAKE_ARGV list variable. + +set(_args) +set(_seen_dashdash FALSE) +math(EXPR _last "${CMAKE_ARGC} - 1") +foreach(_i RANGE 0 ${_last}) + set(_raw_arg "${CMAKE_ARGV${_i}}") + if(NOT _seen_dashdash) + if(_raw_arg STREQUAL "--") + set(_seen_dashdash TRUE) + endif() + continue() + endif() + + if(_raw_arg MATCHES "^-m(sse4\\.2|sse4\\.1|avx|avx2)$") + continue() + endif() + list(APPEND _args "${_raw_arg}") +endforeach() + +execute_process(COMMAND ${_args} RESULT_VARIABLE _result) +if(NOT _result EQUAL 0) + message(FATAL_ERROR "tslang compile failed (exit ${_result})") +endif() diff --git a/tag.bat b/tag.bat index 85f68390f..4f32103cd 100644 --- a/tag.bat +++ b/tag.bat @@ -1,2 +1,2 @@ -git tag -a v0.0-pre-alpha78 -m "pre alpha v0.0-78" +git tag -a v0.0-pre-alpha79 -m "pre alpha v0.0-79" git push origin --tags diff --git a/tag_del.bat b/tag_del.bat index 190fcbad4..ef9b0ec47 100644 --- a/tag_del.bat +++ b/tag_del.bat @@ -1,2 +1,2 @@ -git push --delete origin v0.0-pre-alpha78 -git tag -d v0.0-pre-alpha78 +git push --delete origin v0.0-pre-alpha79 +git tag -d v0.0-pre-alpha79