mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 12:11:32 +00:00
Merge branch 'cmake_fixes' into 'master'
Formatting and coverage related CMake files fixes See merge request OpenMW/openmw!2811
This commit is contained in:
commit
efebb8efd8
18 changed files with 232 additions and 210 deletions
|
@ -132,6 +132,7 @@ Clang_Format:
|
||||||
before_script:
|
before_script:
|
||||||
- CI/install_debian_deps.sh openmw-clang-format
|
- CI/install_debian_deps.sh openmw-clang-format
|
||||||
script:
|
script:
|
||||||
|
- CI/check_cmake_format.sh
|
||||||
- CI/check_file_names.sh
|
- CI/check_file_names.sh
|
||||||
- CI/check_clang_format.sh
|
- CI/check_clang_format.sh
|
||||||
|
|
||||||
|
|
6
CI/check_cmake_format.sh
Executable file
6
CI/check_cmake_format.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
git ls-files -- ':(exclude)extern/' 'CMakeLists.txt' '*.cmake' |
|
||||||
|
xargs grep -P '^\s*\t' &&
|
||||||
|
( echo 'CMake files contain leading tab character. Use only spaces for indentation'; exit -1 )
|
||||||
|
exit 0
|
|
@ -13,3 +13,8 @@ endif()
|
||||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||||
target_precompile_headers(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE <algorithm>)
|
target_precompile_headers(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE <algorithm>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
|
target_compile_options(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE --coverage)
|
||||||
|
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark gcov)
|
||||||
|
endif()
|
||||||
|
|
|
@ -14,7 +14,7 @@ target_link_libraries(bsatool
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(bsatool PRIVATE --coverage)
|
||||||
target_link_libraries(bsatool gcov)
|
target_link_libraries(bsatool gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ target_link_libraries(openmw-bulletobjecttool
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions(--coverage)
|
target_compile_options(openmw-bulletobjecttool PRIVATE --coverage)
|
||||||
target_link_libraries(openmw-bulletobjecttool gcov)
|
target_link_libraries(openmw-bulletobjecttool gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ target_link_libraries(esmtool
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(esmtool PRIVATE --coverage)
|
||||||
target_link_libraries(esmtool gcov)
|
target_link_libraries(esmtool gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ target_link_libraries(openmw-essimporter
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(openmw-essimporter PRIVATE --coverage)
|
||||||
target_link_libraries(openmw-essimporter gcov)
|
target_link_libraries(openmw-essimporter gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ target_link_libraries(openmw-launcher
|
||||||
target_link_libraries(openmw-launcher Qt::Widgets Qt::Core)
|
target_link_libraries(openmw-launcher Qt::Widgets Qt::Core)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(openmw-launcher PRIVATE --coverage)
|
||||||
target_link_libraries(openmw-launcher gcov)
|
target_link_libraries(openmw-launcher gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ if (MINGW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(openmw-iniimporter PRIVATE --coverage)
|
||||||
target_link_libraries(openmw-iniimporter gcov)
|
target_link_libraries(openmw-iniimporter gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ target_link_libraries(openmw-navmeshtool
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions(--coverage)
|
target_compile_options(openmw-navmeshtool PRIVATE --coverage)
|
||||||
target_link_libraries(openmw-navmeshtool gcov)
|
target_link_libraries(openmw-navmeshtool gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ target_link_libraries(niftest
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(niftest PRIVATE --coverage)
|
||||||
target_link_libraries(niftest gcov)
|
target_link_libraries(niftest gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,11 @@ if(USE_QT)
|
||||||
set_property(TARGET openmw-cs PROPERTY AUTOMOC ON)
|
set_property(TARGET openmw-cs PROPERTY AUTOMOC ON)
|
||||||
endif(USE_QT)
|
endif(USE_QT)
|
||||||
|
|
||||||
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
|
target_compile_options(openmw-cs PRIVATE --coverage)
|
||||||
|
target_link_libraries(openmw-cs gcov)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||||
target_precompile_headers(openmw-cs PRIVATE
|
target_precompile_headers(openmw-cs PRIVATE
|
||||||
<boost/filesystem.hpp>
|
<boost/filesystem.hpp>
|
||||||
|
|
|
@ -192,12 +192,12 @@ if (USE_SYSTEM_TINYXML)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT UNIX)
|
if (NOT UNIX)
|
||||||
target_link_libraries(openmw ${SDL2MAIN_LIBRARY})
|
target_link_libraries(openmw ${SDL2MAIN_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Fix for not visible pthreads functions for linker with glibc 2.15
|
# Fix for not visible pthreads functions for linker with glibc 2.15
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
target_link_libraries(openmw ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(openmw ${CMAKE_THREAD_LIBS_INIT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
@ -230,7 +230,7 @@ if(APPLE)
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(openmw PRIVATE --coverage)
|
||||||
target_link_libraries(openmw gcov)
|
target_link_libraries(openmw gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ if (UNIX AND NOT APPLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions(--coverage)
|
target_compile_options(openmw_test_suite PRIVATE --coverage)
|
||||||
target_link_libraries(openmw_test_suite gcov)
|
target_link_libraries(openmw_test_suite gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -94,13 +94,13 @@ if(DPKG_PROGRAM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
target_compile_options(openmw-wizard PRIVATE --coverage)
|
||||||
target_link_libraries(openmw-wizard gcov)
|
target_link_libraries(openmw-wizard gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Workaround for binutil => 2.23 problem when linking, should be fixed eventually upstream
|
# Workaround for binutil => 2.23 problem when linking, should be fixed eventually upstream
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
target_link_libraries(openmw-wizard dl Xt)
|
target_link_libraries(openmw-wizard dl Xt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
|
@ -462,6 +462,11 @@ if (USE_QT)
|
||||||
add_library(components_qt STATIC ${COMPONENT_QT_FILES} ${ESM_UI_HDR})
|
add_library(components_qt STATIC ${COMPONENT_QT_FILES} ${ESM_UI_HDR})
|
||||||
target_link_libraries(components_qt components Qt::Widgets Qt::Core)
|
target_link_libraries(components_qt components Qt::Widgets Qt::Core)
|
||||||
target_compile_definitions(components_qt PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
|
target_compile_definitions(components_qt PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
|
||||||
|
|
||||||
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
|
target_compile_options(components_qt PRIVATE --coverage)
|
||||||
|
target_link_libraries(components_qt gcov)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GIT_CHECKOUT)
|
if (GIT_CHECKOUT)
|
||||||
|
@ -483,11 +488,11 @@ endif()
|
||||||
|
|
||||||
# Fix for not visible pthreads functions for linker with glibc 2.15
|
# Fix for not visible pthreads functions for linker with glibc 2.15
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
target_link_libraries(components ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(components ${CMAKE_THREAD_LIBS_INIT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions(--coverage)
|
target_compile_options(components PRIVATE --coverage)
|
||||||
target_link_libraries(components gcov)
|
target_link_libraries(components gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue