1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 02:12:45 +01:00

cmake+ci: install pdb's + enable on ci

This commit is contained in:
Anonymous Maarten 2018-09-01 18:23:10 +02:00
parent fdaaef3923
commit c73e5d514d
10 changed files with 53 additions and 48 deletions

View File

@ -17,12 +17,10 @@ environment:
USE_CONAN: 1 USE_CONAN: 1
platform: platform:
# - Win32
- x64 - x64
configuration: configuration:
# - Debug - RelWithDebInfo
- Release
matrix: matrix:
fast_finish: false fast_finish: false

View File

@ -6,7 +6,7 @@
set(_ARGS_BOOL set(_ARGS_BOOL
USE_CONAN USE_CONAN
DEBUG BUILD_TYPE
CHECK_IWYU CHECK_IWYU
BUILD_TOOLS BUILD_TOOLS
BUILD_VIEWER BUILD_VIEWER
@ -67,6 +67,12 @@ endif()
message(STATUS "Starting test...") message(STATUS "Starting test...")
ctest_start("${MODEL_NAME}" ${_CTEST_START_EXTRA_ARGS}) ctest_start("${MODEL_NAME}" ${_CTEST_START_EXTRA_ARGS})
set(ALL_BUILD_TYPES Release Debug MinSizeRel RelWithDebInfo)
list(FIND ALL_BUILD_TYPES "${BUILD_TYPE}" BUILD_TYPE_INDEX)
if(BUILD_TYPE_INDEX EQUAL -1)
message(FATAL_ERROR "Unknown build type '${BUILD_TYPE}'")
endif()
if(USE_CONAN) if(USE_CONAN)
find_program(CONAN_BIN find_program(CONAN_BIN
NAMES conan NAMES conan
@ -109,7 +115,7 @@ if(USE_CONAN)
endif() endif()
endif() endif()
if(DEBUG) if(BUILD_TYPE STREQUAL "Debug")
set(CONAN_CONFIGURATION "Debug") set(CONAN_CONFIGURATION "Debug")
else() else()
set(CONAN_CONFIGURATION "Release") set(CONAN_CONFIGURATION "Release")
@ -149,15 +155,9 @@ if(USE_CONAN)
endif() endif()
# CTEST_CONFIGURATION_TYPE is needed on Windows (no leading underscore) # CTEST_CONFIGURATION_TYPE is needed on Windows (no leading underscore)
if(DEBUG) set(_CMAKE_BUILD_TYPE "${BUILD_TYPE}")
set(_CMAKE_BUILD_TYPE "Debug") set(_CTEST_BUILD_CONFIGURATION "${BUILD_TYPE}")
set(_CTEST_BUILD_CONFIGURATION "Debug") set(CTEST_CONFIGURATION_TYPE "${BUILD_TYPE}")
set(CTEST_CONFIGURATION_TYPE "Debug")
else()
set(_CMAKE_BUILD_TYPE "Release")
set(_CTEST_BUILD_CONFIGURATION "Release")
set(CTEST_CONFIGURATION_TYPE "Release")
endif()
set(_CONFIGURE_OPTIONS set(_CONFIGURE_OPTIONS
"-DBUILD_TOOLS=${BUILD_TOOLS}" "-DBUILD_TOOLS=${BUILD_TOOLS}"

View File

@ -1,8 +1,8 @@
set(CMAKE_GENERATOR "Xcode") set(CMAKE_GENERATOR "Xcode")
if(ENV{DEBUG}) if($ENV{DEBUG})
set(DEBUG "$ENV{DEBUG}") set(BUILD_TYPE "Debug")
else() else()
set(DEBUG FALSE) set(BUILD_TYPE "Release")
endif() endif()
set(CONFIGURE_EXTRA_OPTIONS ";") set(CONFIGURE_EXTRA_OPTIONS ";")
set(BUILD_EXTRA_FLAGS "") set(BUILD_EXTRA_FLAGS "")

View File

@ -1,8 +1,8 @@
set(CMAKE_GENERATOR "Unix Makefiles") set(CMAKE_GENERATOR "Unix Makefiles")
if($ENV{DEBUG}) if($ENV{DEBUG})
set(DEBUG "$ENV{DEBUG}") set(BUILD_TYPE "Debug")
else() else()
set(DEBUG FALSE) set(BUILD_TYPE "Release")
endif() endif()
set(CONFIGURE_EXTRA_OPTIONS ";") set(CONFIGURE_EXTRA_OPTIONS ";")
include(ProcessorCount) include(ProcessorCount)

View File

@ -25,13 +25,7 @@ endif()
set(CONFIGURE_EXTRA_OPTIONS ";") set(CONFIGURE_EXTRA_OPTIONS ";")
set(BUILD_EXTRA_FLAGS "") set(BUILD_EXTRA_FLAGS "")
if(CONFIGURATION STREQUAL "Debug") set(BUILD_TYPE "${CONFIGURATION}")
set(DEBUG TRUE)
elseif(CONFIGURATION STREQUAL "Release")
set(DEBUG FALSE)
else()
message(FATAL_ERROR "Unknown configuration '${CONFIGURATION}'")
endif()
set(CONAN_ARCH "x86_64") set(CONAN_ARCH "x86_64")

View File

@ -181,13 +181,11 @@ foreach(SAN ${ENABLE_SANITIZERS})
endif() endif()
endforeach() endforeach()
include(CMakeParseArguments)
function(openrw_target_apply_options) function(openrw_target_apply_options)
set(IWYU_MAPPING "${PROJECT_SOURCE_DIR}/openrw_iwyu.imp") set(IWYU_MAPPING "${PROJECT_SOURCE_DIR}/openrw_iwyu.imp")
cmake_parse_arguments("OPENRW_APPLY" "" "TARGET" "" ${ARGN}) cmake_parse_arguments("ORW" "INSTALL;INSTALL_PDB" "TARGET" "" ${ARGN})
if(CHECK_IWYU) if(CHECK_IWYU)
iwyu_check(TARGET "${OPENRW_APPLY_TARGET}" iwyu_check(TARGET "${ORW_TARGET}"
EXTRA_OPTS EXTRA_OPTS
"--mapping_file=${IWYU_MAPPING}" "--mapping_file=${IWYU_MAPPING}"
) )
@ -195,7 +193,7 @@ function(openrw_target_apply_options)
if(CHECK_CLANGTIDY) if(CHECK_CLANGTIDY)
clang_tidy_check_target( clang_tidy_check_target(
TARGET "${OPENRW_APPLY_TARGET}" TARGET "${ORW_TARGET}"
FORMAT_STYLE "file" FORMAT_STYLE "file"
FIX "${CHECK_CLANGTIDY_FIX}" FIX "${CHECK_CLANGTIDY_FIX}"
CHECK_ALL CHECK_ALL
@ -204,15 +202,32 @@ function(openrw_target_apply_options)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set_property( set_property(
TARGET "${OPENRW_APPLY_TARGET}" TARGET "${ORW_TARGET}"
APPEND APPEND
PROPERTY STATIC_LIBRARY_FLAGS "-no_warning_for_no_symbols" PROPERTY STATIC_LIBRARY_FLAGS "-no_warning_for_no_symbols"
) )
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set_property( set_property(
TARGET "${OPENRW_APPLY_TARGET}" TARGET "${ORW_TARGET}"
APPEND APPEND
PROPERTY LINK_FLAGS "/ignore:4099" PROPERTY LINK_FLAGS "/ignore:4099"
) )
endif() endif()
if(ORW_INSTALL)
install(
TARGETS "${ORW_TARGET}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()
if(ORW_INSTALL_PDB)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
install(FILES "$<$<OR:$<CONFIG:DEBUG>,$<CONFIG:RELWITHDEBINFO>>:$<TARGET_PDB_FILE:${ORW_TARGET}>>"
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()
endif()
endfunction() endfunction()

View File

@ -61,8 +61,7 @@ target_link_libraries(rwgame
SDL2::SDL2 SDL2::SDL2
) )
openrw_target_apply_options(TARGET rwgame) openrw_target_apply_options(
TARGET rwgame
install(TARGETS rwgame INSTALL INSTALL_PDB
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
) )

View File

@ -11,6 +11,7 @@ target_link_libraries(rwfontmap
Qt5::Gui Qt5::Gui
) )
install(TARGETS rwfontmap openrw_target_apply_options(
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" TARGET rwfontmap
INSTALL INSTALL_PDB
) )

View File

@ -54,10 +54,9 @@ target_link_libraries(rwviewer
Qt5::Widgets Qt5::Widgets
) )
openrw_target_apply_options(TARGET rwviewer) openrw_target_apply_options(
TARGET rwviewer
install(TARGETS rwviewer INSTALL INSTALL_PDB
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
) )
if(USE_CONAN) if(USE_CONAN)

View File

@ -76,7 +76,10 @@ target_link_libraries(rwtests
Boost::filesystem Boost::filesystem
) )
openrw_target_apply_options(TARGET rwtests) openrw_target_apply_options(
TARGET rwtests
INSTALL INSTALL_PDB
)
if(SEPARATE_TEST_SUITES) if(SEPARATE_TEST_SUITES)
foreach(TEST ${TESTS}) foreach(TEST ${TESTS})
@ -98,7 +101,3 @@ else()
TIMEOUT 300 TIMEOUT 300
) )
endif() endif()
install(TARGETS rwtests
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)