summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2025-04-25 08:01:32 +0200
committerStanislaw Halik <sthalik@misaki.pl>2025-05-16 08:54:13 +0200
commit78f8c6c81c2e900aa1cb433940667a054cc0b6ed (patch)
treeb03c5c96e1d45645a5528d2007f343f21bd46f48 /cmake
parent1f737463587fec21337631bc0320718b49fde26c (diff)
buffer flush
Diffstat (limited to 'cmake')
-rw-r--r--cmake/msvc.cmake19
-rw-r--r--cmake/opentrack-boilerplate.cmake6
-rw-r--r--cmake/opentrack-i18n.cmake8
-rw-r--r--cmake/opentrack-install.cmake5
-rw-r--r--cmake/opentrack-platform.cmake2
-rw-r--r--cmake/opentrack-qt.cmake38
6 files changed, 49 insertions, 29 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index b390c120..b9505896 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -64,6 +64,8 @@ function(sets type)
endwhile()
endfunction()
+set(OpenCV_STATIC 1)
+
if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
#include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE)
@@ -103,6 +105,9 @@ if(CMAKE_PROJECT_NAME STREQUAL "OpenCV")
set(BUILD_PERF_TESTS OFF)
set(BUILD_opencv_apps OFF)
set(BUILD_opencv_gapi OFF)
+
+ set(OPENCV_SKIP_MSVC_PARALLEL 1)
+ set(OPENCV_DISABLE_THREAD_SUPPORT 1)
endif()
if(CMAKE_PROJECT_NAME STREQUAL "TestOscpack")
@@ -113,9 +118,10 @@ set(opentrack-simd "SSE2")
if(CMAKE_PROJECT_NAME STREQUAL "onnxruntime")
sets(BOOL
- ONNX_USE_MSVC_STATIC_RUNTIME OFF
- protobuf_MSVC_STATIC_RUNTIME OFF
- onnxruntime_USE_AVX OFF
+ ONNX_USE_MSVC_STATIC_RUNTIME ON
+ protobuf_MSVC_STATIC_RUNTIME ON
+ ABSL_MSVC_STATIC_RUNTIME ON
+ onnxruntime_USE_AVX ON
onnxruntime_USE_AVX2 OFF
onnxruntime_USE_AVX512 OFF
onnxruntime_BUILD_BENCHMARKS OFF
@@ -130,6 +136,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "onnxruntime")
ONNX_GEN_PB_TYPE_STUBS OFF
onnxruntime_DISABLE_CONTRIB_OPS ON
BUILD_TESTING OFF
+ BUILD_SHARED_LIBS OFF
)
if(opentrack-64bit)
sets(BOOL
@@ -143,7 +150,7 @@ if(opentrack-64bit)
endif()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
-add_compile_options(-MD)
+add_compile_options(-MT)
add_link_options(-cgthreads:1)
@@ -162,11 +169,11 @@ set(_CFLAGS_DEBUG "-guard:cf -MTd -Gs0 -RTCs")
set(_CXXFLAGS_RELEASE "${_CFLAGS_RELEASE}")
set(_CXXFLAGS_DEBUG "${_CFLAGS_DEBUG}")
-set(_LDFLAGS "-WX")
+set(_LDFLAGS "")
set(_LDFLAGS_RELEASE "-OPT:REF,ICF=10 -LTCG -DEBUG:FULL")
set(_LDFLAGS_DEBUG "-DEBUG:FULL")
-set(_LDFLAGS_STATIC "-WX")
+set(_LDFLAGS_STATIC "")
set(_LDFLAGS_STATIC_RELEASE "-LTCG")
set(_LDFLAGS_STATIC_DEBUG "")
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index e325cd6a..3c66cc61 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -1,5 +1,9 @@
include_guard(GLOBAL)
+if(POLICY CMP0177)
+ cmake_policy(SET CMP0177 NEW)
+endif()
+
set(opentrack-perms-file WORLD_READ OWNER_WRITE OWNER_READ GROUP_READ)
set(opentrack-perms-dir WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
set(opentrack-perms-exec "${opentrack-perms-dir}")
@@ -145,7 +149,7 @@ function(otr_module n_)
if(arg_EXECUTABLE)
if (APPLE)
- set(subsys "MACOSX_BUNDLE")
+ set(subsys "MACOSX_BUNDLE")
elseif(NOT WIN32)
set(subsys "")
elseif(arg_WIN32-CONSOLE)
diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake
index 1f0c67d9..fca83248 100644
--- a/cmake/opentrack-i18n.cmake
+++ b/cmake/opentrack-i18n.cmake
@@ -1,5 +1,9 @@
include_guard(GLOBAL)
+if(POLICY CMP0177)
+ cmake_policy(SET CMP0177 NEW)
+endif()
+
add_custom_target(i18n-lupdate)
add_custom_target(i18n-lrelease DEPENDS i18n-lupdate)
add_custom_target(i18n ALL DEPENDS i18n-lrelease)
@@ -7,7 +11,7 @@ add_custom_target(i18n ALL DEPENDS i18n-lrelease)
function(otr_i18n_for_target_directory n)
set(k "opentrack-${n}")
- get_property(lupdate-binary TARGET "${Qt5_LUPDATE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
+ get_property(lupdate-binary TARGET Qt6::lupdate PROPERTY IMPORTED_LOCATION)
#make_directory("${CMAKE_CURRENT_BINARY_DIR}/lang")
@@ -63,7 +67,7 @@ function(otr_merge_translations)
foreach(i ${opentrack_all-translations})
get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}")
- get_property(lrelease-binary TARGET "${Qt5_LRELEASE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
+ get_property(lrelease-binary TARGET Qt6::lrelease PROPERTY IMPORTED_LOCATION)
set(qm-output "${CMAKE_BINARY_DIR}/${i}.qm")
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index 5aac983b..8ecb1470 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -1,4 +1,9 @@
include_guard(GLOBAL)
+
+if(POLICY CMP0177)
+ cmake_policy(SET CMP0177 NEW)
+endif()
+
macro(otr_install_misc path)
install(${ARGN} DESTINATION "${path}" PERMISSIONS ${opentrack-perms-file})
endmacro()
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index 638260f1..43d9c7a0 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -133,7 +133,7 @@ if(MSVC)
endif()
add_link_options(-DYNAMICBASE -NXCOMPAT)
- add_link_options(-WX)
+ #add_link_options(-WX)
add_link_options(-ignore:4020)
add_link_options(-ignore:4217) # debug build
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake
index 1735e836..8f6dc70e 100644
--- a/cmake/opentrack-qt.cmake
+++ b/cmake/opentrack-qt.cmake
@@ -1,33 +1,33 @@
include_guard(GLOBAL)
-if(WIN32)
- find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin)
-endif()
-set(qt-required-components Core Network Widgets LinguistTools Gui)
+set(qt-required-components Core Network Widgets LinguistTools Gui Core5Compat)
set(qt-optional-components SerialPort)
-set(qt-imported-targets Qt5::Core Qt5::Gui Qt5::Network Qt5::Widgets)
+set(qt-imported-targets Qt6::Core Qt6::Gui Qt6::Network Qt6::Widgets Qt6::Core5Compat)
if(APPLE)
list(APPEND qt-required-components "DBus")
list(APPEND qt-optional-components "Multimedia")
- list(APPEND qt-imported-targets Qt5::DBus Qt5::Multimedia)
+ list(APPEND qt-imported-targets Qt6::DBus Qt6::Multimedia)
endif()
-find_package(Qt5 REQUIRED COMPONENTS ${qt-required-components} QUIET)
-find_package(Qt5 COMPONENTS ${qt-optional-components} QUIET)
+find_package(Qt6 REQUIRED COMPONENTS ${qt-required-components} QUIET)
+find_package(Qt6 COMPONENTS ${qt-optional-components} QUIET)
+if(WIN32)
+ find_package(Qt6Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin)
+endif()
-set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES})
+set(MY_QT_LIBS ${Qt6Core_LIBRARIES} ${Qt6Gui_LIBRARIES} ${Qt6Widgets_LIBRARIES} ${Qt6Network_LIBRARIES} ${Qt6Core5Compat_LIBRARIES})
if(APPLE)
- list(APPEND MY_QT_LIBS ${Qt5Multimedia_LIBRARIES} ${Qt5DBus_LIBRARIES})
+ list(APPEND MY_QT_LIBS ${Qt6Multimedia_LIBRARIES} ${Qt6DBus_LIBRARIES})
endif()
function(otr_install_qt_libs)
foreach(i ${qt-imported-targets})
- if(NOT TARGET "${i}")
- continue()
- endif()
+ #if(NOT TARGET "${i}")
+ # continue()
+ #endif()
otr_install_lib(${i} ".")
endforeach()
if(WIN32)
- otr_install_lib(Qt5::QWindowsIntegrationPlugin "./platforms")
+ otr_install_lib(Qt6::QWindowsIntegrationPlugin "./platforms")
endif()
endfunction()
@@ -39,9 +39,9 @@ function(otr_qt n)
if(".${${n}-cc}${${n}-cxx}${${n}-hh}" STREQUAL ".")
message(FATAL_ERROR "project ${n} not globbed")
endif()
- qt5_wrap_cpp(${n}-moc ${${n}-hh} OPTIONS --no-notes -I "${CMAKE_CURRENT_BINARY_DIR}" -I "${CMAKE_SOURCE_DIR}")
- qt5_wrap_ui(${n}-uih ${${n}-ui})
- qt5_add_resources(${n}-rcc ${${n}-rc})
+ qt6_wrap_cpp(${n}-moc ${${n}-hh} OPTIONS --no-notes -I "${CMAKE_CURRENT_BINARY_DIR}" -I "${CMAKE_SOURCE_DIR}")
+ qt6_wrap_ui(${n}-uih ${${n}-ui})
+ qt6_add_resources(${n}-rcc ${${n}-rc})
foreach(i moc uih rcc)
set(${n}-${i} "${${n}-${i}}" PARENT_SCOPE)
@@ -52,10 +52,10 @@ endfunction()
function(otr_qt2 n)
target_include_directories("${n}" SYSTEM PRIVATE
- ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}
+ ${Qt6Core_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}
)
target_compile_definitions("${n}" PRIVATE
- ${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}
+ ${Qt6Core_DEFINITIONS} ${Qt6Gui_DEFINITIONS} ${Qt6Widgets_DEFINITIONS} ${Qt6Network_DEFINITIONS}
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_MESSAGELOGCONTEXT
)