diff options
-rw-r--r-- | cmake/msvc.cmake | 52 | ||||
-rw-r--r-- | sdk-paths-sthalik@MSVC-windows.cmake | 7 |
2 files changed, 46 insertions, 13 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) diff --git a/sdk-paths-sthalik@MSVC-windows.cmake b/sdk-paths-sthalik@MSVC-windows.cmake index f8a53910..b64446b4 100644 --- a/sdk-paths-sthalik@MSVC-windows.cmake +++ b/sdk-paths-sthalik@MSVC-windows.cmake @@ -33,9 +33,10 @@ setq(SDK_REALSENSE "RSSDK-R2") setq(SDK_RIFT_140 "ovr_sdk_win_23.0.0/LibOVR") setq(SDK_VALVE_STEAMVR "steamvr") setq(SDK_VJOYSTICK "vjoystick") -setq(ONNXRuntime_INCLUDE_DIR "onnxruntime-1.10.0//include") -setq(ONNXRuntime_LIBRARY "onnxruntime-1.10.0/lib/onnxruntime.lib") -setq(ONNXRuntime_RUNTIME "onnxruntime-1.10.0/bin/onnxruntime.dll") +setq(ONNXRuntime_DIR "onnxruntime-1.12.1") +#setq(ONNXRuntime_INCLUDE_DIR "onnxruntime-1.12.1/include") +#setq(ONNXRuntime_LIBRARY "onnxruntime-1.12.1/lib/onnxruntime.lib") +#setq(ONNXRuntime_RUNTIME "onnxruntime-1.12.1/bin/onnxruntime.dll") setq(SDK_TRACKHAT_SENSOR "../trackhat/trackhat-c-library-driver/build/install") set(CMAKE_ASM_NASM_COMPILER nasm.exe CACHE FILEPATH "" FORCE) |