From 399f117eab9f8d10670f1f93fc7b233b0cfcaca8 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 12 Mar 2022 11:50:21 -0600 Subject: [PATCH] [buildcore] Add support for MSVC --- deps/buildcore/base.cmake | 4 +++- deps/buildcore/base.mk | 5 +++++ deps/buildcore/scripts/setup-build.py | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/deps/buildcore/base.cmake b/deps/buildcore/base.cmake index 62380715..0a988652 100644 --- a/deps/buildcore/base.cmake +++ b/deps/buildcore/base.cmake @@ -31,7 +31,9 @@ else() endif() endif() -if(NOT MSVC) +if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor") +else() # forces colored output when using ninja set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color") # enable warnings diff --git a/deps/buildcore/base.mk b/deps/buildcore/base.mk index b9cb26f3..b5748f09 100644 --- a/deps/buildcore/base.mk +++ b/deps/buildcore/base.mk @@ -135,6 +135,11 @@ conan-config: ${ENV_RUN} conan profile new ${PROJECT_NAME} --detect --force ifeq ($(OS),linux) ${ENV_RUN} conan profile update settings.compiler.libcxx=libstdc++11 ${PROJECT_NAME} +else + ${ENV_RUN} conan profile update settings.compiler.cppstd=20 ${PROJECT_NAME} +ifeq ($(OS),windows) + ${ENV_RUN} conan profile update settings.compiler.runtime=static ${PROJECT_NAME} +endif endif .PHONY: conan conan: diff --git a/deps/buildcore/scripts/setup-build.py b/deps/buildcore/scripts/setup-build.py index 614fc009..e4e60546 100755 --- a/deps/buildcore/scripts/setup-build.py +++ b/deps/buildcore/scripts/setup-build.py @@ -62,6 +62,10 @@ def main(): print('Error: Invalid build tool') sys.exit(1) + win_target = '' + if platform.system() != 'Windows': + win_target = '-A x64' + project_dir = os.getcwd() build_dir = '{:s}/build/{:s}'.format(project_dir, build_config) rm(build_dir) @@ -73,6 +77,7 @@ def main(): '-DUSE_ASAN={:s}'.format(sanitizer_status), '-DBUILDCORE_BUILD_CONFIG={:s}'.format(build_config), '-DBUILDCORE_TARGET={:s}'.format(args.target), + win_target, ] if qt_path != '': cmake_cmd.append(qt_path)