diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/msvc.cmake | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake index 301d1e68..12470eef 100644 --- a/cmake/msvc.cmake +++ b/cmake/msvc.cmake @@ -10,6 +10,10 @@ else() set(CMAKE_SYSTEM_PROCESSOR x86) endif() +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR CMAKE_INSTALL_PREFIX STREQUAL "") + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE) +endif() + if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake") include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE) endif() @@ -45,6 +49,22 @@ set(CMAKE_CXX_EXTENSIONS FALSE) set(CMAKE_CROSSCOMPILING 0) +function(sets type) + set(i 0) + list(LENGTH ARGN max) + math(EXPR foo "${max} % 2") + if(NOT foo EQUAL 0) + message(FATAL_ERROR "argument count not even") + endif() + while(i LESS max) + list(GET ARGN "${i}" name) + math(EXPR i "${i} + 1") + list(GET ARGN "${i}" value) + math(EXPR i "${i} + 1") + set(${name} "${value}" CACHE "${type}" "" FORCE) + endwhile() +endfunction() + if(CMAKE_PROJECT_NAME STREQUAL "opentrack") #include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE) @@ -91,24 +111,40 @@ 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) + sets(BOOL + onnxruntime_USE_AVX ON + onnxruntime_USE_AVX2 OFF + onnxruntime_USE_AVX512 OFF + ONNX_USE_MSVC_STATIC_RUNTIME ON + protobuf_MSVC_STATIC_RUNTIME ON + onnxruntime_BUILD_BENCHMARKS OFF + onnxruntime_BUILD_FOR_NATIVE_MACHINE OFF + onnxruntime_BUILD_SHARED_LIB ON + onnxruntime_BUILD_UNIT_TESTS OFF + protobuf_BUILD_EXAMPLES OFF + protobuf_BUILD_SHARED_LIBS OFF + ONNX_BUILD_BENCHMARKS OFF + ONNX_BUILD_TESTS OFF + ONNX_DISABLE_EXCEPTIONS OFF # important! + ONNX_GEN_PB_TYPE_STUBS OFF + onnxruntime_DISABLE_CONTRIB_OPS ON + BUILD_TESTING OFF + ) elseif(opentrack-64bit) - set(opentrack-simd "") + set(opentrack-simd "AVX") endif() set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") add_link_options(-cgthreads:1) -set(_CFLAGS "-diagnostics:caret -Zc:preprocessor -wd4117 -Zi -Zf -Zo -bigobj -cgthreads1 -vd0 -permissive-") +set(_CFLAGS "-diagnostics:caret -Zc:inline -Zc:preprocessor -wd4117 -Zi -Zf -Zo -bigobj -cgthreads1 -vd0 -permissive-") 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(_CXXFLAGS "${_CFLAGS} -Zc:throwingNew -Zc:lambda") set(_CFLAGS_RELEASE "-O2 -Oit -Oy- -Ob3 -fp:fast -GS- -GF -GL -Gw -Gy") if(NOT opentrack-simd STREQUAL "") set(_CFLAGS_RELEASE "${_CFLAGS_RELEASE} -arch:${opentrack-simd}") @@ -125,10 +161,6 @@ set(_LDFLAGS_STATIC "-WX") set(_LDFLAGS_STATIC_RELEASE "-LTCG") set(_LDFLAGS_STATIC_DEBUG "") -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "" FORCE) -endif() - set(CMAKE_BUILD_TYPE_INIT "RELEASE" CACHE INTERNAL "") string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE) |