summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-boilerplate.cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-01-13 07:42:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-01-13 07:42:29 +0100
commit53e8b2d41988be69deb800e1ef3cbcfc699a3076 (patch)
treedc5a3a9098bf4172a52f0410a04274b997505ff0 /cmake/opentrack-boilerplate.cmake
parentb0657c7ca495ac9d1d3938b3fdfddd9a8ed2d5f2 (diff)
cmake, main: work toward introducing alternative UI
We're going to base opentrack derivatives on the same branch. Previously merges were a living hell. Modularizing the UI code and having continuously-built executables will do a lot. First opentrack variant in progress is a TrackHat device for mouse and scrolling control for people with spine and hand/arm disabilities.
Diffstat (limited to 'cmake/opentrack-boilerplate.cmake')
-rw-r--r--cmake/opentrack-boilerplate.cmake39
1 files changed, 24 insertions, 15 deletions
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()