summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindEigen3.cmake24
-rw-r--r--cmake/opentrack-boilerplate.cmake33
-rw-r--r--cmake/opentrack-hier.cmake17
-rw-r--r--cmake/opentrack-install.cmake2
-rw-r--r--cmake/opentrack-platform.cmake13
-rw-r--r--cmake/opentrack-qt.cmake11
6 files changed, 63 insertions, 37 deletions
diff --git a/cmake/FindEigen3.cmake b/cmake/FindEigen3.cmake
index b43208f9..bbad2298 100644
--- a/cmake/FindEigen3.cmake
+++ b/cmake/FindEigen3.cmake
@@ -9,6 +9,12 @@
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version
+#
+# This module reads hints about search locations from
+# the following enviroment variables:
+#
+# EIGEN3_ROOT
+# EIGEN3_ROOT_DIR
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
@@ -61,19 +67,29 @@ if (EIGEN3_INCLUDE_DIR)
else (EIGEN3_INCLUDE_DIR)
- find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+ # search first if an Eigen3Config.cmake is available in the system,
+ # if successful this would set EIGEN3_INCLUDE_DIR and the rest of
+ # the script will work as usual
+ find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
+
+ if(NOT EIGEN3_INCLUDE_DIR)
+ find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+ HINTS
+ ENV EIGEN3_ROOT
+ ENV EIGEN3_ROOT_DIR
PATHS
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen
)
-
+ endif(NOT EIGEN3_INCLUDE_DIR)
+
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif(EIGEN3_INCLUDE_DIR)
- #include(FindPackageHandleStandardArgs)
- #find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index ffa4ea02..958403cc 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -61,8 +61,8 @@ function(otr_glob_sources var)
endfunction()
function(otr_fixup_subsystem n)
- otr_find_msvc_editbin(editbin-pathname)
if(MSVC)
+ otr_find_msvc_editbin(editbin-pathname)
set(subsystem WINDOWS)
get_property(type TARGET "${n}" PROPERTY TYPE)
if (NOT type STREQUAL "STATIC_LIBRARY")
@@ -143,15 +143,17 @@ function(otr_module n_)
set(arg_NO-I18N TRUE)
endif()
- if(NOT WIN32)
- set(subsys "")
- elseif(arg_WIN32-CONSOLE)
- set(subsys "")
- else()
- set(subsys "WIN32")
- endif()
-
if(arg_EXECUTABLE)
+ if (APPLE)
+ set(subsys "MACOSX_BUNDLE")
+ elseif(NOT WIN32)
+ set(subsys "")
+ elseif(arg_WIN32-CONSOLE)
+ set(subsys "")
+ else()
+ set(subsys "WIN32")
+ endif()
+
add_executable(${n} ${subsys} "${${n}-all}")
set_target_properties(${n} PROPERTIES
SUFFIX "${opentrack-binary-suffix}"
@@ -216,12 +218,23 @@ function(otr_module n_)
endif()
if(NOT arg_NO-INSTALL)
+ # Librarys/executable
if(arg_BIN)
- install(TARGETS "${n}"
+ if (APPLE)
+ install(TARGETS "${n}"
+ RUNTIME DESTINATION ${opentrack-hier-bin}
+ BUNDLE DESTINATION ${opentrack-hier-bin}
+ LIBRARY DESTINATION ${opentrack-hier-bin}/Library
+ RESOURCE DESTINATION ${opentrack-hier-bin}/opentrack.app/Resource
+ PERMISSIONS ${opentrack-perms-exec})
+ else()
+ install(TARGETS "${n}"
RUNTIME DESTINATION ${opentrack-hier-bin}
LIBRARY DESTINATION ${opentrack-hier-pfx}
PERMISSIONS ${opentrack-perms-exec})
+ endif()
else()
+ # Plugins
install(TARGETS "${n}" ${opentrack-hier-str}
PERMISSIONS ${opentrack-perms-exec})
endif()
diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake
index 7dcdb52d..13f876a5 100644
--- a/cmake/opentrack-hier.cmake
+++ b/cmake/opentrack-hier.cmake
@@ -9,16 +9,16 @@
include_guard(GLOBAL)
-set(opentrack-install-rpath "")
if(APPLE)
- set(opentrack-hier-pfx ".")
- set(opentrack-hier-path "/") # MUST HAVE A TRAILING BACKSLASH
+ set(opentrack-hier-pfx "Plugins")
+ set(opentrack-hier-path "/Plugins/") # MUST HAVE A TRAILING BACKSLASH, Used in APP
set(opentrack-hier-doc "/") # MUST HAVE A TRAILING BACKSLASH
- set(opentrack-hier-bin ".")
+ set(opentrack-hier-bin "${CMAKE_INSTALL_PREFIX}")
set(opentrack-doc-pfx "./doc")
set(opentrack-doc-src-pfx "./source-code")
- set(opentrack-i18n-pfx "./i18n")
- set(opentrack-i18n-path "./i18n")
+ set(opentrack-i18n-pfx "opentrack.app/Contents/Resources") # used during install
+ set(opentrack-i18n-path "../Resources/i18n") # used in application
+ set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/Library")
elseif(WIN32)
set(opentrack-hier-pfx "modules")
set(opentrack-hier-path "/${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH
@@ -29,6 +29,7 @@ elseif(WIN32)
set(opentrack-i18n-pfx "./i18n")
set(opentrack-i18n-path "./i18n")
set(opentrack-hier-debug "./debug")
+ set(opentrack-install-rpath "")
else()
set(opentrack-hier-pfx "libexec/opentrack")
set(opentrack-hier-path "/../${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH
@@ -50,9 +51,7 @@ endfunction()
set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
set(opentrack-binary-suffix "")
-if(APPLE)
- set(opentrack-binary-suffix ".bin")
-elseif(WIN32)
+if(WIN32)
set(opentrack-binary-suffix ".exe")
endif()
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index 2b745a82..784cf59a 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -71,9 +71,11 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
cleanup_visual_studio_debug()
endif()
+if (NOT APPLE)
otr_install_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll")
otr_install_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient64.dll")
otr_install_exec("${opentrack-hier-pfx}" FILES
"${CMAKE_SOURCE_DIR}/bin/NPClient.dll"
"${CMAKE_SOURCE_DIR}/bin/NPClient64.dll"
"${CMAKE_SOURCE_DIR}/bin/TrackIR.exe")
+endif() \ No newline at end of file
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index 02c1b2f8..23c18d52 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -51,10 +51,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC OFF)
+set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-set(CMAKE_MACOSX_RPATH OFF)
if(NOT WIN32 AND NOT APPLE)
include(opentrack-pkg-config)
@@ -155,14 +158,6 @@ if(MSVC)
endforeach()
endif()
-if(APPLE)
- add_compile_definitions(-stdlib=libc++)
- add_link_options(-stdlib=libc++)
-
- add_link_options(-framework Cocoa -framework CoreFoundation -framework Carbon)
- link_libraries(objc z)
-endif()
-
if(NOT MSVC)
include(FindPkgConfig)
endif()
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake
index 8c92483c..650db4fc 100644
--- a/cmake/opentrack-qt.cmake
+++ b/cmake/opentrack-qt.cmake
@@ -2,19 +2,20 @@ include_guard(GLOBAL)
if(WIN32)
find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin)
endif()
-find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui QUIET)
-find_package(Qt5 COMPONENTS SerialPort QUIET)
-
-set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES})
+find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui DBus QUIET)
+find_package(Qt5 COMPONENTS SerialPort Multimedia QUIET)
+set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Multimedia_LIBRARIES})
function(otr_install_qt_libs)
- foreach(i Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets)
+ foreach(i Qt5::Core Qt5::Gui Qt5::DBus Qt5::Network Qt5::SerialPort Qt5::Widgets Qt5::Multimedia)
if(NOT TARGET "${i}")
continue()
endif()
otr_install_lib(${i} ".")
endforeach()
+ if(WIN32)
otr_install_lib(Qt5::QWindowsIntegrationPlugin "./platforms")
+ endif()
endfunction()
otr_install_qt_libs()