1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-21 09:52:43 +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
platform:
# - Win32
- x64
configuration:
# - Debug
- Release
- RelWithDebInfo
matrix:
fast_finish: false

View File

@ -6,7 +6,7 @@
set(_ARGS_BOOL
USE_CONAN
DEBUG
BUILD_TYPE
CHECK_IWYU
BUILD_TOOLS
BUILD_VIEWER
@ -67,6 +67,12 @@ endif()
message(STATUS "Starting test...")
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)
find_program(CONAN_BIN
NAMES conan
@ -109,7 +115,7 @@ if(USE_CONAN)
endif()
endif()
if(DEBUG)
if(BUILD_TYPE STREQUAL "Debug")
set(CONAN_CONFIGURATION "Debug")
else()
set(CONAN_CONFIGURATION "Release")
@ -149,15 +155,9 @@ if(USE_CONAN)
endif()
# CTEST_CONFIGURATION_TYPE is needed on Windows (no leading underscore)
if(DEBUG)
set(_CMAKE_BUILD_TYPE "Debug")
set(_CTEST_BUILD_CONFIGURATION "Debug")
set(CTEST_CONFIGURATION_TYPE "Debug")
else()
set(_CMAKE_BUILD_TYPE "Release")
set(_CTEST_BUILD_CONFIGURATION "Release")
set(CTEST_CONFIGURATION_TYPE "Release")
endif()
set(_CMAKE_BUILD_TYPE "${BUILD_TYPE}")
set(_CTEST_BUILD_CONFIGURATION "${BUILD_TYPE}")
set(CTEST_CONFIGURATION_TYPE "${BUILD_TYPE}")
set(_CONFIGURE_OPTIONS
"-DBUILD_TOOLS=${BUILD_TOOLS}"

View File

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

View File

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

View File

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

View File

@ -181,13 +181,11 @@ foreach(SAN ${ENABLE_SANITIZERS})
endif()
endforeach()
include(CMakeParseArguments)
function(openrw_target_apply_options)
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)
iwyu_check(TARGET "${OPENRW_APPLY_TARGET}"
iwyu_check(TARGET "${ORW_TARGET}"
EXTRA_OPTS
"--mapping_file=${IWYU_MAPPING}"
)
@ -195,7 +193,7 @@ function(openrw_target_apply_options)
if(CHECK_CLANGTIDY)
clang_tidy_check_target(
TARGET "${OPENRW_APPLY_TARGET}"
TARGET "${ORW_TARGET}"
FORMAT_STYLE "file"
FIX "${CHECK_CLANGTIDY_FIX}"
CHECK_ALL
@ -204,15 +202,32 @@ function(openrw_target_apply_options)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set_property(
TARGET "${OPENRW_APPLY_TARGET}"
TARGET "${ORW_TARGET}"
APPEND
PROPERTY STATIC_LIBRARY_FLAGS "-no_warning_for_no_symbols"
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set_property(
TARGET "${OPENRW_APPLY_TARGET}"
TARGET "${ORW_TARGET}"
APPEND
PROPERTY LINK_FLAGS "/ignore:4099"
)
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()

View File

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

View File

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

View File

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

View File

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