summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/opentrack-boilerplate.cmake6
-rw-r--r--cmake/opentrack-clean-build-directory.cmake21
-rw-r--r--cmake/opentrack-install.cmake18
-rw-r--r--cmake/opentrack-qt.cmake41
4 files changed, 61 insertions, 25 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index bd12601a..2e593138 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -23,12 +23,6 @@ if(NOT (orig-hier-path STREQUAL new-hier-path))
file(WRITE ${hier-path-filename} "${new-hier-path}")
endif()
-install(FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt" DESTINATION "${opentrack-doc-src-pfx}")
-install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake" DESTINATION "${opentrack-doc-src-pfx}")
-install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin" DESTINATION "${opentrack-doc-src-pfx}")
-install(FILES "${CMAKE_SOURCE_DIR}/README.md" DESTINATION "${opentrack-doc-src-pfx}")
-install(FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md" DESTINATION "${opentrack-doc-src-pfx}")
-
function(opentrack_glob_sources var)
set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB ${var}-c ${dir}/*.cpp ${dir}/*.c ${dir}/*.h ${dir}/*.hpp)
diff --git a/cmake/opentrack-clean-build-directory.cmake b/cmake/opentrack-clean-build-directory.cmake
index 13c3c282..a8141344 100644
--- a/cmake/opentrack-clean-build-directory.cmake
+++ b/cmake/opentrack-clean-build-directory.cmake
@@ -1,4 +1,4 @@
-function(cleanup_install_dir)
+function(cleanup_build_dir)
if(NOT $ENV{USERNAME} STREQUAL "sthalik")
message(WARNING "you can't run this potentially destructive function")
message(FATAL_ERROR "if you're sure, remove this line")
@@ -13,19 +13,7 @@ function(cleanup_install_dir)
set(got-cache FALSE)
foreach(i ${files})
- if (i STREQUAL "install")
- set(got-install TRUE)
- continue()
- endif()
-
- string(FIND "${i}" "install/" pos)
-
- if(pos GREATER -1)
- set(got-install-file TRUE)
- continue()
- endif()
-
- if(i STREQUAL "CMakeCache.txt")
+ if(i STREQUAL "CMakeCache.txt")
set(got-cache TRUE)
continue()
endif()
@@ -35,7 +23,7 @@ function(cleanup_install_dir)
unset(files)
- if(NOT got-cache OR NOT got-install OR NOT got-install-file)
+ if(NOT got-cache)
message(FATAL_ERROR "")
endif()
@@ -45,4 +33,5 @@ function(cleanup_install_dir)
execute_process(COMMAND cmake . WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" OUTPUT_QUIET)
endfunction()
-cleanup_install_dir()
+cleanup_build_dir()
+
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index e60b8a18..5def8355 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -2,9 +2,6 @@ set(opentrack-perms PERMISSIONS WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ
if(WIN32)
install(FILES "${CMAKE_SOURCE_DIR}/bin/qt.conf" DESTINATION . ${opentrack-perms})
-endif()
-
-if(WIN32)
install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION . ${opentrack-perms})
install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION ${opentrack-hier-pfx} ${opentrack-perms})
endif()
@@ -20,3 +17,18 @@ install(FILES
"${CMAKE_SOURCE_DIR}/bin/NPClient64.dll"
"${CMAKE_SOURCE_DIR}/bin/TrackIR.exe"
DESTINATION ${opentrack-hier-pfx} ${opentrack-perms})
+
+install(FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt" DESTINATION "${opentrack-doc-src-pfx}")
+install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake" DESTINATION "${opentrack-doc-src-pfx}")
+install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin" DESTINATION "${opentrack-doc-src-pfx}")
+install(FILES "${CMAKE_SOURCE_DIR}/README.md" DESTINATION "${opentrack-doc-src-pfx}")
+install(FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md" DESTINATION "${opentrack-doc-src-pfx}")
+
+function(opentrack_install_sources n)
+ opentrack_sources(${n} sources)
+ file(RELATIVE_PATH subdir "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
+ foreach (i ${sources})
+ install(FILES "${i}" DESTINATION "${opentrack-doc-src-pfx}/${subdir}")
+ endforeach()
+ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" DESTINATION "${opentrack-doc-src-pfx}/${subdir}")
+endfunction()
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake
index 65ec75fd..aa7f0e5d 100644
--- a/cmake/opentrack-qt.cmake
+++ b/cmake/opentrack-qt.cmake
@@ -3,3 +3,44 @@ 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})
set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES})
+
+install(CODE "
+
+ set(run-this FALSE)
+ if(\$ENV{USERNAME} STREQUAL \"sthalik\")
+ set(run-this TRUE)
+ endif()
+
+ if(WIN32 AND run-this)
+ if(NOT EXISTS \"${Qt5_DIR}/../../../bin/qmake.exe\")
+ message(FATAL_ERROR \"configure qt at least a:${Qt5_DIR} b:\${qt-dir}\")
+ endif()
+
+ if(EXISTS \"${CMAKE_INSTALL_PREFIX}/opentrack.exe\")
+ file(REMOVE_RECURSE \"${CMAKE_INSTALL_PREFIX}\")
+ endif()
+
+ file(MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\")
+
+ if(NOT EXISTS \"${CMAKE_INSTALL_PREFIX}\")
+ message(FATAL_ERROR \"make sure install dir exists at least\")
+ endif()
+
+ set(bin-path \"${Qt5_DIR}/../../../bin\")
+ set(platforms-path \"${Qt5_DIR}/../../../plugins/platforms\")
+
+ foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets)
+ configure_file(\"\${bin-path}/\${i}.dll\" \"${CMAKE_INSTALL_PREFIX}/\${i}.dll\" COPYONLY)
+ endforeach()
+
+ file(MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/platforms\")
+ configure_file(\"\${platforms-path}/qwindows.dll\" \"${CMAKE_INSTALL_PREFIX}/platforms/qwindows.dll\" COPYONLY)
+ endif()
+
+ if(MSVC)
+ foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets platforms/qwindows)
+ execute_process(COMMAND editbin -nologo -SUBSYSTEM:WINDOWS,5.01 -OSVERSION:5.1 \"\${i}.dll\" WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}\")
+ endforeach()
+ endif()
+
+")