diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/msvc.cmake | 4 | ||||
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 39 | ||||
-rw-r--r-- | cmake/opentrack-qt.cmake | 2 | ||||
-rw-r--r-- | cmake/opentrack-variant.cmake | 50 |
4 files changed, 77 insertions, 18 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake index 45791d4e..8d125ffa 100644 --- a/cmake/msvc.cmake +++ b/cmake/msvc.cmake @@ -65,8 +65,8 @@ set(_CXXFLAGS_DEBUG "${_CFLAGS_DEBUG}") set(_LDFLAGS "-machine:X86 -DEBUG") -set(_ltcg "-LTCG") -#set(_ltcg "-LTCG:INCREMENTAL") +#set(_ltcg "-LTCG") +set(_ltcg "-LTCG:INCREMENTAL") set(_LDFLAGS_RELEASE "-OPT:REF,ICF -cgthreads:1 ${_ltcg}") set(_LDFLAGS_DEBUG "") diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index a4d197be..019efb05 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -27,19 +27,22 @@ if(NOT (orig-hier-path STREQUAL new-hier-path)) endif() function(otr_glob_sources var) - set(dir "${CMAKE_CURRENT_SOURCE_DIR}") - file(GLOB ${var}-cxx ${dir}/*.cpp) - file(GLOB ${var}-cc ${dir}/*.c) - file(GLOB ${var}-hh ${dir}/*.h ${dir}/*.hpp) - file(GLOB ${var}-res ${dir}/*.rc) - foreach(f ${var}-res) - set_source_files_properties(${f} PROPERTIES LANGUAGE RC) - endforeach() - file(GLOB ${var}-ui ${dir}/*.ui) - file(GLOB ${var}-rc ${dir}/*.qrc) - set(${var}-all ${${var}-cc} ${${var}-cxx} ${${var}-hh} ${${var}-rc} ${${var}-res}) - foreach(i ui rc res cc cxx hh all) - set(${var}-${i} "${${var}-${i}}" PARENT_SCOPE) + set(basedir "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(dir . ${ARGN}) + set(dir "${basedir}/${dir}") + file(GLOB ${var}-cxx ${dir}/*.cpp) + file(GLOB ${var}-cc ${dir}/*.c) + file(GLOB ${var}-hh ${dir}/*.h ${dir}/*.hpp) + file(GLOB ${var}-res ${dir}/*.rc) + foreach(f ${var}-res) + set_source_files_properties(${f} PROPERTIES LANGUAGE RC) + endforeach() + file(GLOB ${var}-ui ${dir}/*.ui) + file(GLOB ${var}-rc ${dir}/*.qrc) + set(${var}-all ${${var}-cc} ${${var}-cxx} ${${var}-hh} ${${var}-rc} ${${var}-res}) + foreach(i ui rc res cc cxx hh all) + set(${var}-${i} "${${var}-${i}}" PARENT_SCOPE) + endforeach() endforeach() endfunction() @@ -124,7 +127,7 @@ function(otr_module n_) cmake_parse_arguments(arg "STATIC;NO-COMPAT;BIN;EXECUTABLE;NO-QT;WIN32-CONSOLE;NO-INSTALL;RELINK" "LINK;COMPILE" - "SOURCES" + "SOURCES;SUBDIRS" ${ARGN} ) @@ -134,7 +137,7 @@ function(otr_module n_) set(n "opentrack-${n_}") - otr_glob_sources(${n}) + otr_glob_sources(${n} ${arg_SUBDIRS}) list(APPEND ${n}-all ${arg_SOURCES}) if(NOT arg_NO-QT) @@ -183,6 +186,12 @@ function(otr_module n_) string(TOUPPER "${build-n}" build-n) set_property(TARGET ${n} PROPERTY DEFINE_SYMBOL "BUILD_${build-n}") + get_property(ident GLOBAL PROPERTY opentrack-ident) + if (".${ident}" STREQUAL ".") + message(FATAL_ERROR "must set global property `opentrack-ident' in `opentrack-variant.cmake'") + endif() + set_property(TARGET ${n} APPEND PROPERTY COMPILE_DEFINITIONS "OPENTRACK_ORG=\"${ident}\"") + if(arg_STATIC) set(arg_NO-INSTALL TRUE) endif() diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 665ed053..911eec5b 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -2,7 +2,7 @@ find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui QUIE if(WIN32) find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) endif() -find_package(Qt5 COMPONENTS SerialPort Gamepad QUIET) +find_package(Qt5 COMPONENTS SerialPort QUIET) include_directories(SYSTEM ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) diff --git a/cmake/opentrack-variant.cmake b/cmake/opentrack-variant.cmake new file mode 100644 index 00000000..7418f882 --- /dev/null +++ b/cmake/opentrack-variant.cmake @@ -0,0 +1,50 @@ +# set these as cache variables manually + +set(opentrack_variant "default" CACHE STRING "") +set_property(CACHE opentrack_variant PROPERTY STRINGS "default;trackmouse") + +function(otr_dist_select_variant) + if(opentrack_variant STREQUAL "trackmouse") + set_property(GLOBAL PROPERTY opentrack-variant "trackmouse") + set_property(GLOBAL PROPERTY opentrack-ident "trackmouse-prototype") + set(subprojects + "tracker-pt" + "proto-mouse" + "filter-accela" + "options" + "api" + "compat" + "logic" + "dinput" + "gui" + "spline" + "cv" + "migration") + set_property(GLOBAL PROPERTY opentrack-subprojects "${subprojects}") + else() + set_property(GLOBAL PROPERTY opentrack-variant "default") + set_property(GLOBAL PROPERTY opentrack-ident "opentrack-2.3") + set(subprojects + "tracker-*" + "proto-*" + "filter-*" + "ext-*" + "options" + "api" + "compat" + "logic" + "dinput" + "gui" + "main" + "x-plane-plugin" + "csv" + "pose-widget" + "spline" + "qxt-mini" + "macosx" + "cv" + "migration") + set_property(GLOBAL PROPERTY opentrack-subprojects "${subprojects}") + endif() +endfunction() + |