From 4d7e5245a3f1d7a6691f96bd6c6d15621861f427 Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 10 May 2021 00:17:11 +0200 Subject: [PATCH] Support benchmarks for windows Don't run the binary because gitlab can't execute it successfully due to unknown reason. --- .gitlab-ci.yml | 28 ++++++++++++++++++++++++++-- CI/before_script.msvc.sh | 10 ++++++++++ CMakeLists.txt | 4 ++++ apps/benchmarks/CMakeLists.txt | 7 ------- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7be8fc997..8d486ebf9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -170,6 +170,10 @@ variables: &cs-targets targets: "openmw-cs,bsatool,esmtool,niftest" package: "CS" +variables: &tests-targets + targets: "openmw_detournavigator_navmeshtilescache_benchmark" + package: "Tests" + .Windows_Ninja_Base: tags: - windows @@ -188,7 +192,7 @@ variables: &cs-targets - $time = (Get-Date -Format "HH:mm:ss") - echo ${time} - echo "started by ${GITLAB_USER_NAME}" - - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -N + - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -N -b - cd MSVC2019_64_Ninja - .\ActivateMSVC.ps1 - cmake --build . --config $config --target ($targets.Split(',')) @@ -200,6 +204,7 @@ variables: &cs-targets Get-ChildItem -Recurse *.pdb | Remove-Item } - 7z a -tzip ..\..\OpenMW_MSVC2019_64_${package}_${config}_${CI_COMMIT_REF_NAME}.zip '*' + - if ($executables) { foreach ($exe in $executables.Split(',')) { & .\$exe } } after_script: - Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log cache: @@ -263,6 +268,15 @@ Windows_Ninja_CS_RelWithDebInfo: <<: *cs-targets config: "RelWithDebInfo" +Windows_Ninja_Tests_RelWithDebInfo: + extends: .Windows_Ninja_Base + stage: build + variables: + <<: *tests-targets + config: "RelWithDebInfo" + # Gitlab can't successfully execute benchamark binary due to unknown reason + # executables: "openmw_detournavigator_navmeshtilescache_benchmark.exe" + .Windows_MSBuild_Base: tags: - windows @@ -280,7 +294,7 @@ Windows_Ninja_CS_RelWithDebInfo: - $time = (Get-Date -Format "HH:mm:ss") - echo ${time} - echo "started by ${GITLAB_USER_NAME}" - - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V + - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -b - cd MSVC2019_64 - cmake --build . --config $config --target ($targets.Split(',')) - cd $config @@ -291,6 +305,7 @@ Windows_Ninja_CS_RelWithDebInfo: Get-ChildItem -Recurse *.pdb | Remove-Item } - 7z a -tzip ..\..\OpenMW_MSVC2019_64_${package}_${config}_${CI_COMMIT_REF_NAME}.zip '*' + - if ($executables) { foreach ($exe in $executables.Split(',')) { & .\$exe } } after_script: - Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log cache: @@ -354,6 +369,15 @@ Windows_MSBuild_CS_RelWithDebInfo: <<: *cs-targets config: "RelWithDebInfo" +Windows_MSBuild_Tests_RelWithDebInfo: + extends: .Windows_MSBuild_Base + stage: build + variables: + <<: *tests-targets + config: "RelWithDebInfo" + # Gitlab can't successfully execute benchamark binary due to unknown reason + # executables: "openmw_detournavigator_navmeshtilescache_benchmark.exe" + Debian_AndroidNDK_arm64-v8a: tags: - linux diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index d98c28038..bb662c9de 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -73,6 +73,7 @@ CONFIGURATIONS=() TEST_FRAMEWORK="" GOOGLE_INSTALL_ROOT="" INSTALL_PREFIX="." +BUILD_BENCHMARKS="" ACTIVATE_MSVC="" SINGLE_CONFIG="" @@ -133,6 +134,9 @@ while [ $# -gt 0 ]; do INSTALL_PREFIX=$(echo "$1" | sed 's;\\;/;g' | sed -E 's;/+;/;g') shift ;; + b ) + BUILD_BENCHMARKS=true ;; + h ) cat </dev/null 2>&1 || { echo "Error: vswhere is not on the path."; wrappedExit 1; } diff --git a/CMakeLists.txt b/CMakeLists.txt index 104140107..a9f33c743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -669,6 +669,10 @@ if (WIN32) if (BUILD_WIZARD) set_target_properties(openmw-wizard PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") endif() + + if (BUILD_BENCHMARKS) + set_target_properties(openmw_detournavigator_navmeshtilescache_benchmark PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + endif() endif(MSVC) # TODO: At some point release builds should not use the console but rather write to a log file diff --git a/apps/benchmarks/CMakeLists.txt b/apps/benchmarks/CMakeLists.txt index b7170003e..f9aa9aad4 100644 --- a/apps/benchmarks/CMakeLists.txt +++ b/apps/benchmarks/CMakeLists.txt @@ -19,16 +19,9 @@ FetchContent_MakeAvailableExcludeFromAll(benchmark) set(CMAKE_CXX_FLAGS "${SAVED_CMAKE_CXX_FLAGS}") openmw_add_executable(openmw_detournavigator_navmeshtilescache_benchmark detournavigator/navmeshtilescache.cpp) -target_compile_options(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE -Wall) target_compile_features(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE cxx_std_17) target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark benchmark::benchmark components) if (UNIX AND NOT APPLE) target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark ${CMAKE_THREAD_LIBS_INIT}) endif() - -if (MSVC) - if (CMAKE_CL_64) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj") - endif (CMAKE_CL_64) -endif (MSVC)