summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/opentrack-boilerplate.cmake33
-rw-r--r--cmake/opentrack-hier.cmake21
-rw-r--r--cmake/opentrack-install.cmake2
-rw-r--r--cmake/opentrack-platform.cmake20
-rw-r--r--cmake/opentrack-qt.cmake9
5 files changed, 47 insertions, 38 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index ffa4ea02..7e9231ed 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}/opentrack.app/Contents/MacOS/
+ 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..c94c6d57 100644
--- a/cmake/opentrack-hier.cmake
+++ b/cmake/opentrack-hier.cmake
@@ -9,38 +9,41 @@
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 "${CMAKE_INSTALL_PREFIX}/opentrack.app/Contents/MacOS/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 "./")
+ set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx})
elseif(WIN32)
set(opentrack-hier-pfx "modules")
set(opentrack-hier-path "/${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH
set(opentrack-hier-doc "/doc/") # MUST HAVE A TRAILING BACKSLASH
set(opentrack-hier-bin ".")
+ set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx})
set(opentrack-doc-pfx "./doc")
set(opentrack-doc-src-pfx "./source-code")
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
set(opentrack-hier-doc "/share/doc/opentrack/") # MUST HAVE A TRAILING BACKSLASH
set(opentrack-hier-bin "bin")
+ set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx})
set(opentrack-doc-pfx "./share/doc/opentrack")
set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code")
set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
set(opentrack-i18n-pfx "./share/opentrack/i18n")
set(opentrack-i18n-path "../share/opentrack/i18n")
endif()
-set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx})
function(otr_escape_string var str)
string(REGEX REPLACE "([^_A-Za-z0-9./:-])" "\\\\\\1" str "${str}")
@@ -50,9 +53,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 0ebe53a7..35de63a4 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -43,10 +43,12 @@ set(CMAKE_CXX_STANDARD_DEFAULT 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)
-set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-set(CMAKE_SKIP_INSTALL_RPATH FALSE)
-set(CMAKE_SKIP_RPATH FALSE)
+IF (NOT APPLE)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+ set(CMAKE_SKIP_INSTALL_RPATH FALSE)
+ set(CMAKE_SKIP_RPATH FALSE)
+endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
@@ -155,16 +157,6 @@ if(MSVC)
endforeach()
endif()
-if(APPLE)
- # Removed because of Macro error
- # add_compile_definitions(-stdlib=libc++)
- add_link_options(-stdlib=libc++)
-
- # Build failure cannot link to frameworks
- #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 a13afc97..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 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui DBus QUIET)
find_package(Qt5 COMPONENTS SerialPort Multimedia QUIET)
-set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Multimedia_LIBRARIES})
-
+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 Qt5::Multimedia)
+ 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()