diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-04 19:27:52 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-10 10:31:57 +0200 |
commit | b4e92e4bd93cbe7e00b0c1742d40e1cef55a49aa (patch) | |
tree | 1e0618be2b3a3a4d2d1d8c88c6568f764012ed0d /cmake | |
parent | cf30a29a8208fee7aac7e4a725fde197c16b6ce7 (diff) |
cmake/msvc: update
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/msvc.cmake | 71 | ||||
-rw-r--r-- | cmake/opentrack-policy.cmake | 1 |
2 files changed, 54 insertions, 18 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake index c35f4239..91430d8c 100644 --- a/cmake/msvc.cmake +++ b/cmake/msvc.cmake @@ -4,7 +4,11 @@ SET(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_VERSION 5.01) -set(CMAKE_SYSTEM_PROCESSOR x86) +if(opentrack-64bit) + set(CMAKE_SYSTEM_PROCESSOR AMD64) +else() + set(CMAKE_SYSTEM_PROCESSOR x86) +endif() if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake") include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE) @@ -22,8 +26,16 @@ set(CMAKE_GENERATOR "Ninja") #add_compile_options(-Qvec-report:2) #add_compile_options(-d2cgsummary) add_definitions(-D_HAS_EXCEPTIONS=0) -add_definitions(-D_CRT_USE_BUILTIN_OFFSETOF) -set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE INTERNAL "" FORCE) +if(NOT CMAKE_PROJECT_NAME STREQUAL "OpenCV") + add_definitions(-D_CRT_USE_BUILTIN_OFFSETOF) +endif() + +include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE) +set(CMAKE_POLICY_DEFAULT_CMP0069 NEW CACHE INTERNAL "" FORCE) +#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) + +set(CMAKE_C_EXTENSIONS FALSE) +set(CMAKE_CXX_EXTENSIONS FALSE) if(CMAKE_PROJECT_NAME STREQUAL "opentrack") #include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE) @@ -40,36 +52,59 @@ if(CMAKE_PROJECT_NAME STREQUAL "opentrack") endif() if(CMAKE_PROJECT_NAME STREQUAL "QtBase") - unset(CMAKE_CROSSCOMPILING) - set(QT_BUILD_TOOLS_WHEN_CROSSCOMPILING TRUE CACHE BOOL "" FORCE) - set(QT_DEBUG_OPTIMIZATION_FLAGS TRUE CACHE BOOL "" FORCE) - set(QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS TRUE CACHE BOOL "" FORCE) - - set(FEATURE_debug OFF) - set(FEATURE_debug_and_release OFF) - set(FEATURE_force_debug_info ON) - set(FEATURE_ltcg ON) - set(FEATURE_shared ON) + unset(CMAKE_CROSSCOMPILING) + set(QT_BUILD_TOOLS_WHEN_CROSSCOMPILING TRUE CACHE BOOL "" FORCE) + set(QT_DEBUG_OPTIMIZATION_FLAGS TRUE CACHE BOOL "" FORCE) + set(QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS TRUE CACHE BOOL "" FORCE) + + set(FEATURE_debug OFF) + set(FEATURE_debug_and_release OFF) + set(FEATURE_force_debug_info ON) + set(FEATURE_ltcg ON) + set(FEATURE_shared ON) endif() if(CMAKE_PROJECT_NAME STREQUAL "OpenCV") - set(OPENCV_SKIP_MSVC_EXCEPTIONS_FLAG TRUE) set(PARALLEL_ENABLE_PLUGINS FALSE) set(HIGHGUI_ENABLE_PLUGINS FALSE) set(VIDEOIO_ENABLE_PLUGINS FALSE) + + set(OPENCV_SKIP_MSVC_EXCEPTIONS_FLAG TRUE) set(OPENCV_DISABLE_THREAD_SUPPORT TRUE) + + set(ENABLE_FAST_MATH ON) + set(BUILD_TESTS OFF) + set(BUILD_PERF_TESTS OFF) + set(BUILD_opencv_apps OFF) + set(BUILD_opencv_gapi OFF) +endif() + +set(opentrack-simd "SSE2") + +if(CMAKE_PROJECT_NAME STREQUAL "onnxruntime") + set(opentrack-simd "AVX") + + set(onnxruntime_USE_AVX ON) + set(onnxruntime_USE_AVX2 OFF) + set(onnxruntime_USE_AVX512 OFF) +elseif(opentrack-64bit) + set(opentrack-simd "") endif() set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") -set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) add_link_options(-cgthreads:1) -set(_CFLAGS "-diagnostics:classic -Zc:preprocessor -wd4117 -Zi -Zf -Zo -bigobj -cgthreads1 -vd0 -MT") +set(_CFLAGS "-diagnostics:classic -Zc:preprocessor -wd4117 -Zi -Zf -Zo -bigobj -cgthreads1 -vd0") +if(NOT opentrack-no-static-crt) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE INTERNAL "" FORCE) +else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL" CACHE INTERNAL "" FORCE) +endif() set(_CXXFLAGS "${_CFLAGS} -Zc:throwingNew -Zc:lambda -Zc:inline") set(_CFLAGS_RELEASE "-O2 -Oit -Oy- -Ob3 -fp:fast -GS- -GF -GL -Gw -Gy") -if(NOT opentrack-64bit) - set(_CFLAGS_RELEASE "${_CFLAGS_RELEASE} -arch:SSE2") +if(NOT opentrack-simd STREQUAL "") + set(_CFLAGS_RELEASE "${_CFLAGS_RELEASE} -arch:${opentrack-simd}") endif() set(_CFLAGS_DEBUG "-guard:cf -MTd -Gs0 -RTCs") set(_CXXFLAGS_RELEASE "${_CFLAGS_RELEASE}") diff --git a/cmake/opentrack-policy.cmake b/cmake/opentrack-policy.cmake index 209ef529..fece3ed3 100644 --- a/cmake/opentrack-policy.cmake +++ b/cmake/opentrack-policy.cmake @@ -13,6 +13,7 @@ set(_policies CMP0012 CMP0069 CMP0063 + CMP0074 ) foreach(k ${_policies}) if(POLICY ${k}) |