diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e2a936d1a584ede296afe3e2fc85a84ce3140c5..2ba0722bc3ae15be907756a9346c598e2dece7a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,8 @@ if(DEFINED ENV{QT_VERSION}) endif() if(NOT QT_VERSION) - # try Qt 5.11.0 if none specified - set(QT_VERSION "5.11.1") + # try Qt 5.11.2 if none specified + set(QT_VERSION "5.11.2") endif() if(DEFINED ENV{QT_MKSPEC}) @@ -206,6 +206,10 @@ endif() target_link_libraries(QGroundControl PRIVATE qgc) +if(BUILD_TESTING) + target_link_libraries(QGroundControl PRIVATE Qt5::Test) +endif() + if(NOT QT_MKSPEC MATCHES "winrt") target_link_libraries(QGroundControl PUBLIC @@ -215,14 +219,23 @@ endif() if(LINUX) -elseif(APPLE) - set_target_properties(${PROJECT_NAME} PROPERTIES - MACOSX_BUNDLE YES +elseif(APPLE) + + get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) + get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) + find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") + + add_custom_command(TARGET QGroundControl + POST_BUILD + COMMAND + ${MACDEPLOYQT_EXECUTABLE} $/../.. -appstore-compliant -qmldir=${CMAKE_SOURCE_DIR}/src + COMMAND + rsync -a ${CMAKE_SOURCE_DIR}/libs/lib/Frameworks $/../../Contents/ + COMMAND + ${CMAKE_INSTALL_NAME_TOOL} -change "@rpath/SDL2.framework/Versions/A/SDL2" "@executable_path/../Frameworks/SDL2.framework/Versions/A/SDL2" $ ) - # deploy - include(Macdeployqt) - macdeployqt(QGroundControl) + set_target_properties(QGroundControl PROPERTIES MACOSX_BUNDLE YES) elseif(WIN32) diff --git a/cmake/Macdeployqt.cmake b/cmake/Macdeployqt.cmake deleted file mode 100644 index 70d7079424f4d7f5467275593016f86540561197..0000000000000000000000000000000000000000 --- a/cmake/Macdeployqt.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2017 Nathan Osman -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -find_package(Qt5Core REQUIRED) - -# Retrieve the absolute path to qmake and then use that path to find -# the macdeployqt binary -get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) -get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) -find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") - -# Add commands that copy the required Qt files to the application bundle -# represented by the target -function(macdeployqt target) - add_custom_command(TARGET ${target} POST_BUILD - COMMAND "${MACDEPLOYQT_EXECUTABLE}" - \"$/../..\" - -always-overwrite - COMMENT "Deploying Qt..." - ) -endfunction() - -mark_as_advanced(MACDEPLOYQT_EXECUTABLE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb96651278a09f74f188bb81f46e9e16fceed97a..44d1bc33d5f5a088aba079c1751b59b292605fc4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,8 +65,6 @@ endif() add_library(qgc - ${QGC_RESOURCES} - ${EXTRA_SRC} CmdLineOptParser.cc @@ -95,11 +93,13 @@ add_library(qgc # UI QGCQmlWidgetHolder.ui - + QGCQmlWidgetHolder.h ) set_source_files_properties(QGCApplication.cc PROPERTIES COMPILE_DEFINITIONS GIT_VERSION="${git_tag}") +add_subdirectory(ui) + add_subdirectory(Airmap) add_subdirectory(AnalyzeView) add_subdirectory(api) @@ -121,7 +121,6 @@ add_subdirectory(QtLocationPlugin) add_subdirectory(Settings) add_subdirectory(Terrain) add_subdirectory(uas) -add_subdirectory(ui) add_subdirectory(Vehicle) add_subdirectory(VehicleSetup) add_subdirectory(VideoStreaming) @@ -166,4 +165,11 @@ if(BUILD_TESTING) target_link_libraries(qgc PUBLIC qgcunittest) endif() -target_include_directories(qgc INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(qgc + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/ui/ui_autogen/include # HACK: AUTOUIC paths not inheriting? + ${CMAKE_CURRENT_BINARY_DIR}/ui/ui_autogen/include_Debug + ${CMAKE_CURRENT_BINARY_DIR}/qgc_autogen/include # HACK: AUTOUIC paths not inheriting? + ${CMAKE_CURRENT_BINARY_DIR}/qgc_autogen/include_Debug + ) diff --git a/src/Joystick/CMakeLists.txt b/src/Joystick/CMakeLists.txt index 760926640d59e84bebf56cbc3872c621576c85fd..56e06fb4f5fbd3828a823fb9ee5c732a753d6ae1 100644 --- a/src/Joystick/CMakeLists.txt +++ b/src/Joystick/CMakeLists.txt @@ -15,24 +15,26 @@ add_library(Joystick ) target_link_libraries(Joystick + PRIVATE + ui PUBLIC qgc + ui ) target_include_directories(Joystick PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) if(LINUX) - find_package(SDL2 REQUIRED) + find_package(SDL2 REQUIRED) include_directories(${SDL2_INCLUDE_DIRS}) string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES) # work around for cmake warning target_link_libraries(Joystick PRIVATE ${SDL2_LIBRARIES}) elseif(APPLE) - include_directories(libs/lib/Frameworks/SDL2.framework/Headers) - target_link_libraries(Joystick PRIVATE -F${CMAKE_SOURCE_DIR}/libs/lib/Frameworks "-framework SDL2") - - set_target_properties(${PROJECT_NAME} PROPERTIES - MACOSX_BUNDLE YES - ) + include_directories(${CMAKE_SOURCE_DIR}/libs/lib/Frameworks/SDL2.framework/Headers) + target_link_libraries(Joystick PRIVATE -F${CMAKE_SOURCE_DIR}/libs/lib/Frameworks "-framework SDL2") + set_target_properties(Joystick PROPERTIES + MACOSX_BUNDLE YES + ) elseif(WIN32) include_directories(libs/lib/sdl2/msvc/include) # Support both 32 and 64 bit builds diff --git a/src/MissionManager/CMakeLists.txt b/src/MissionManager/CMakeLists.txt index 23831d0ac617e67aa7fa674329f76facc01c9ec1..67a62a48027420d996c41909a8b3ab7ce774067f 100644 --- a/src/MissionManager/CMakeLists.txt +++ b/src/MissionManager/CMakeLists.txt @@ -67,10 +67,9 @@ add_library(MissionManager target_link_libraries(MissionManager PUBLIC Qt5::Xml - + qgc PRIVATE qgc - ui ) target_include_directories(MissionManager INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/QmlControls/CMakeLists.txt b/src/QmlControls/CMakeLists.txt index ba393670b7569835ff7f63981cd5f50be7ad650b..7c5b170d3b19fac3f68f927ab9892083a9430454 100644 --- a/src/QmlControls/CMakeLists.txt +++ b/src/QmlControls/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(QmlControls ) target_link_libraries(QmlControls - PRIVATE + PUBLIC qgc FactSystem diff --git a/src/Vehicle/CMakeLists.txt b/src/Vehicle/CMakeLists.txt index da275c1c39d44e92f07f03a45ed30492bbdefc04..97ff306278e102675950bce2c8f6b8c29da975c2 100644 --- a/src/Vehicle/CMakeLists.txt +++ b/src/Vehicle/CMakeLists.txt @@ -16,6 +16,8 @@ add_library(Vehicle ) target_link_libraries(Vehicle + PRIVATE + ui PUBLIC qgc ) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 17216dc3b93df55fea8b474e468969f1c2293aa4..0a1660e979182e5010e3c18c32c45f6d60607010 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -50,15 +50,16 @@ add_library(ui ) target_link_libraries(ui - PRIVATE + PUBLIC qgc + PRIVATE qwt ) target_include_directories(ui INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} PRIVATE linechart )