mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
cmake+conan: do not use debug runtime in debug mode
This improves debug experience on windows using Visual Studio
This commit is contained in:
parent
5e582fd393
commit
151de65f69
@ -23,7 +23,7 @@ if(USE_CONAN)
|
||||
message(STATUS "Using conan 'cmake' generator")
|
||||
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
|
||||
endif()
|
||||
conan_basic_setup(TARGETS)
|
||||
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
|
||||
|
||||
rwdep_wrap_conan_targets()
|
||||
else()
|
||||
|
@ -4,7 +4,6 @@ add_library(openrw::interface ALIAS rw_interface)
|
||||
add_library(rw_checks INTERFACE)
|
||||
add_library(openrw::checks ALIAS rw_checks)
|
||||
target_link_libraries(rw_interface INTERFACE rw_checks)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
target_compile_options(rw_interface
|
||||
INTERFACE
|
||||
@ -16,6 +15,20 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang
|
||||
"$<IF:$<COMPILE_LANGUAGE:CXX>,-Wold-style-cast,>"
|
||||
)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
if(MSVC_NO_DEBUG_RUNTIME)
|
||||
foreach(LANG C CXX)
|
||||
foreach(CONFIGURATION_TYPE ${CMAKE_CONFIGURATION_TYPES} "")
|
||||
string(TOUPPER "${CONFIGURATION_TYPE}" CONFIGURATION_TYPE)
|
||||
set(FLAGS_VAR "CMAKE_${LANG}_FLAGS")
|
||||
if(CONFIGURATION_TYPE)
|
||||
set(FLAGS_VAR "${FLAGS_VAR}_${CONFIGURATION_TYPE}")
|
||||
endif()
|
||||
string(REPLACE "/MDd" "/MD" "${FLAGS_VAR}" "${${FLAGS_VAR}}")
|
||||
string(REPLACE "/MTd" "/MT" "${FLAGS_VAR}" "${${FLAGS_VAR}}")
|
||||
set("${FLAGS_VAR}" "${${FLAGS_VAR}}" CACHE STRING "${LANG} flags for ${CONFIGURATION_TYPE} configuration type")
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
target_compile_definitions(rw_checks
|
||||
INTERFACE
|
||||
"_SCL_SECURE_NO_WARNINGS"
|
||||
|
@ -19,6 +19,9 @@ set(CMAKE_CONFIGURATION_TYPES "Release;Debug;RelWithDebInfo;MinSizeRel" CACHE IN
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}")
|
||||
endif()
|
||||
if(MSVC)
|
||||
option(MSVC_NO_DEBUG_RUNTIME "Don't use the debug runtime")
|
||||
endif()
|
||||
|
||||
option(CHECK_IWYU "Enable IncludeWhatYouUse (Analyze #includes in C and C++ source files)")
|
||||
option(CHECK_CLANGTIDY "Enable clang-tidy (A clang-based C++ linter tool)")
|
||||
|
23
conanfile.py
23
conanfile.py
@ -1,5 +1,4 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conans.errors import ConanException
|
||||
|
||||
|
||||
class OpenrwConan(ConanFile):
|
||||
@ -13,19 +12,22 @@ class OpenrwConan(ConanFile):
|
||||
'test_data': [True, False],
|
||||
'viewer': [True, False],
|
||||
'tools': [True, False],
|
||||
'profiling': [True, False],
|
||||
}
|
||||
|
||||
default_options = (
|
||||
'test_data=False',
|
||||
'viewer=True',
|
||||
'tools=True',
|
||||
'bullet3:shared=False',
|
||||
'sdl2:sdl2main=False',
|
||||
)
|
||||
default_options = {
|
||||
'test_data': False,
|
||||
'viewer': True,
|
||||
'tools': True,
|
||||
'profiling': True,
|
||||
'bullet3:shared': False,
|
||||
'sdl2:sdl2main': False,
|
||||
}
|
||||
|
||||
generators = 'cmake',
|
||||
exports_sources = 'CMakeLists.txt', 'cmake_configure.cmake', 'cmake_options.cmake', 'COPYING', \
|
||||
'cmake/modules/*', 'benchmarks', 'rwlib/*', 'rwengine/*', 'rwgame/*', 'rwviewer/*', 'tests/*'
|
||||
exports_sources = 'CMakeLists.txt', 'cmake_configure.cmake', 'cmake_options.cmake', 'CMakeCPack.cmake', 'COPYING', \
|
||||
'cmake/modules/*', 'benchmarks', 'rwcore/*', 'rwengine/*', 'rwgame/*', 'rwviewer/*', \
|
||||
'rwtools/*', 'tests/*', 'external/*'
|
||||
|
||||
_rw_dependencies = {
|
||||
'game': (
|
||||
@ -67,6 +69,7 @@ class OpenrwConan(ConanFile):
|
||||
'BUILD_VIEWER': self.options.viewer,
|
||||
'BUILD_TOOLS': self.options.tools,
|
||||
'TESTS_NODATA': not self.options.test_data,
|
||||
'ENABLE_PROFILING': self.options.profiling,
|
||||
'USE_CONAN': True,
|
||||
'BOOST_STATIC': not self.options['boost'].shared,
|
||||
}
|
||||
|
@ -32,14 +32,13 @@ def create_solution(path, vs_version, arch):
|
||||
conan, _, _ = conan_api.ConanAPIV1.factory()
|
||||
conan.remote_add('bincrafters', 'https://api.bintray.com/conan/bincrafters/public-conan', force=True)
|
||||
conan_arch = conan_arch_map[arch]
|
||||
conan.install(path=openrw_path, generators=('cmake_multi',), build=['missing', ],
|
||||
settings=('build_type=Debug', 'arch={}'.format(conan_arch), ), install_folder=path)
|
||||
conan.install(path=openrw_path, generators=('cmake_multi',), build=['missing', ],
|
||||
settings=('build_type=Release', 'arch={}'.format(conan_arch), ), install_folder=path)
|
||||
conan.install(path=openrw_path, generators=('cmake',), build=['missing', ],
|
||||
settings=('build_type=Release', 'arch={}'.format(conan_arch), 'compiler.runtime=MD', ),
|
||||
install_folder=path)
|
||||
cmake_generator = to_cmake_generator(vs_version=vs_version, arch=arch)
|
||||
subprocess.run([
|
||||
'cmake', '-DUSE_CONAN=TRUE', '-DBOOST_STATIC=TRUE',
|
||||
'-DBUILD_TESTS=TRUE', '-DBUILD_VIEWER=TRUE', '-DBUILD_TOOLS=TRUE',
|
||||
'cmake', '-DUSE_CONAN=ON', '-DBOOST_STATIC=ON', '-DMSVC_NO_DEBUG_RUNTIME=ON',
|
||||
'-DBUILD_TESTS=ON', '-DBUILD_VIEWER=ON', '-DBUILD_TOOLS=ON',
|
||||
'-G{}'.format(cmake_generator), str(openrw_path),
|
||||
], cwd=path, check=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user