From 5c054e008a8e44b3af4af94596dd31ed3de71e96 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sun, 11 Oct 2020 12:03:10 +0200 Subject: [PATCH] CMake fixes --- apps/OpenSpace/CMakeLists.txt | 19 ++--- apps/OpenSpace/ext/launcher/CMakeLists.txt | 77 ++++++++++++------- apps/OpenSpace/ext/launcher/include/camera.h | 2 + .../ext/launcher/include/keybindings.h | 2 + .../ext/launcher/include/osmodules.h | 2 + apps/OpenSpace/ext/launcher/include/ostime.h | 4 + .../ext/launcher/include/properties.h | 2 + .../ext/launcher/src/profileedit.cpp | 2 +- apps/Wormhole/CMakeLists.txt | 2 +- .../webbrowser/cmake/webbrowser_helpers.cmake | 2 +- tests/CMakeLists.txt | 2 +- 11 files changed, 75 insertions(+), 41 deletions(-) diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index 3d81bc3965..32a5eaf4b2 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -74,7 +74,7 @@ endif () ##### -# macos +# MacOS ##### if (APPLE) set(MACOSX_BUNDLE_ICON_FILE openspace.icns) @@ -101,7 +101,7 @@ target_include_directories( ${SPOUT_INCLUDE_DIRS} ) -target_link_libraries(OpenSpace openspace-core ${OPENVR_LIBRARY} ${SPOUT_LIBRARY}) +target_link_libraries(OpenSpace PUBLIC openspace-core ${OPENVR_LIBRARY} ${SPOUT_LIBRARY}) target_compile_definitions(OpenSpace PRIVATE ${SGCT_OPENVR_DEFINITIONS} @@ -116,7 +116,7 @@ set(SGCT_DEP_INCLUDE_FMT OFF CACHE BOOL "" FORCE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/sgct) target_include_directories(OpenSpace SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/sgct/include) -target_link_libraries(OpenSpace sgct) +target_link_libraries(OpenSpace PUBLIC sgct) set_folder_location(sgct "External") set_folder_location(glfw "External/SGCT") @@ -133,7 +133,12 @@ endif () end_header("Dependency: SGCT") -find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED) +begin_header("Dependency: Profile Editor") +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher) +# target_include_directories(OpenSpace SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher/include) +target_link_libraries(OpenSpace PUBLIC openspace-ui-launcher) +end_header("Dependency: Profile Editor") + # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the @@ -160,14 +165,10 @@ endif () if (MSVC) begin_header("Dependency: Dbghelp") # This library is used for being able to output the callstack if an exception escapes - target_link_libraries(OpenSpace Dbghelp.lib) + target_link_libraries(OpenSpace PUBLIC Dbghelp.lib) end_header() endif () if (OPENSPACE_NVTOOLS_ENABLED) target_link_libraries(OpenSpace "${OPENSPACE_NVTOOLS_PATH}/lib/x64/nvToolsExt64_1.lib") endif () - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher) -target_include_directories(OpenSpace SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher/include) -target_link_libraries(OpenSpace profileGUIw) diff --git a/apps/OpenSpace/ext/launcher/CMakeLists.txt b/apps/OpenSpace/ext/launcher/CMakeLists.txt index 2eaef39f81..826ad158be 100644 --- a/apps/OpenSpace/ext/launcher/CMakeLists.txt +++ b/apps/OpenSpace/ext/launcher/CMakeLists.txt @@ -1,24 +1,28 @@ -cmake_minimum_required(VERSION 3.10) +########################################################################################## +# # +# OpenSpace # +# # +# Copyright (c) 2014-2020 # +# # +# 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. # +########################################################################################## -project(profileGUIw LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -#set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -#set(CMAKE_AUTORCC ON) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -find_package(Qt5 COMPONENTS Widgets REQUIRED) -target_include_directories( - OpenSpace PRIVATE - ${Qt5_DIR}/../../../include - ${Qt5_DIR}/../../../include/QtWidgets - ${Qt5_DIR}/../../../include/QtCore - ${Qt5_DIR}/../../../include/QtGui -) +include(${OPENSPACE_CMAKE_EXT_DIR}/set_openspace_compile_settings.cmake) set(HEADER_FILES include/addedscripts.h @@ -71,12 +75,29 @@ set(SOURCE_FILES src/properties.cpp ) -add_library(profileGUIw STATIC ${HEADER_FILES} ${SOURCE_FILES}) -target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/include) -target_include_directories(profileGUIw PRIVATE include) -target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/ext/ghoul/include) -target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/ext/ghoul/ext/glm) -target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/ext/ghoul/ext/cppformat/include) -target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/ext/ghoul/ext/lua/src) -target_link_libraries(profileGUIw PUBLIC Qt5::Widgets) +find_package(Qt5 COMPONENTS Widgets REQUIRED) + +set(MOC_FILES "") +qt5_wrap_cpp( + MOC_FILES + include/addedscripts.h + include/assets.h + include/assettreemodel.h + include/camera.h + include/deltatimes.h + include/errordialog.h + include/keybindings.h + include/launcherwindow.h + include/marknodes.h + include/meta.h + include/osmodules.h + include/ostime.h + include/profileedit.h + include/properties.h +) + +add_library(openspace-ui-launcher STATIC ${HEADER_FILES} ${SOURCE_FILES} ${MOC_FILES}) +set_openspace_compile_settings(openspace-ui-launcher) +target_include_directories(openspace-ui-launcher PUBLIC include) +target_link_libraries(openspace-ui-launcher PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets openspace-core) diff --git a/apps/OpenSpace/ext/launcher/include/camera.h b/apps/OpenSpace/ext/launcher/include/camera.h index a799079ff0..ecef9a02d3 100644 --- a/apps/OpenSpace/ext/launcher/include/camera.h +++ b/apps/OpenSpace/ext/launcher/include/camera.h @@ -26,6 +26,8 @@ #define CAMERA_H #include + +#include #include #include #include diff --git a/apps/OpenSpace/ext/launcher/include/keybindings.h b/apps/OpenSpace/ext/launcher/include/keybindings.h index 7ecbc1d7b5..6100a42dbb 100644 --- a/apps/OpenSpace/ext/launcher/include/keybindings.h +++ b/apps/OpenSpace/ext/launcher/include/keybindings.h @@ -26,6 +26,8 @@ #define KEYBINDINGS_H #include + +#include #include #include diff --git a/apps/OpenSpace/ext/launcher/include/osmodules.h b/apps/OpenSpace/ext/launcher/include/osmodules.h index f4d7217a9f..ba05c249bb 100644 --- a/apps/OpenSpace/ext/launcher/include/osmodules.h +++ b/apps/OpenSpace/ext/launcher/include/osmodules.h @@ -26,6 +26,8 @@ #define OSMODULES_H #include + +#include #include #include diff --git a/apps/OpenSpace/ext/launcher/include/ostime.h b/apps/OpenSpace/ext/launcher/include/ostime.h index 9d70fc26e3..b79dd8f60b 100644 --- a/apps/OpenSpace/ext/launcher/include/ostime.h +++ b/apps/OpenSpace/ext/launcher/include/ostime.h @@ -26,9 +26,13 @@ #define OSTIME_H #include + +#include #include #include + + QT_BEGIN_NAMESPACE namespace Ui { class time; diff --git a/apps/OpenSpace/ext/launcher/include/properties.h b/apps/OpenSpace/ext/launcher/include/properties.h index d68cfa1304..d75c1f42b7 100644 --- a/apps/OpenSpace/ext/launcher/include/properties.h +++ b/apps/OpenSpace/ext/launcher/include/properties.h @@ -26,6 +26,8 @@ #define PROPERTIES_H #include + +#include #include #include diff --git a/apps/OpenSpace/ext/launcher/src/profileedit.cpp b/apps/OpenSpace/ext/launcher/src/profileedit.cpp index 0436a05108..8d53da19cb 100644 --- a/apps/OpenSpace/ext/launcher/src/profileedit.cpp +++ b/apps/OpenSpace/ext/launcher/src/profileedit.cpp @@ -341,7 +341,7 @@ QString ProfileEdit::summarizeText_addedScripts() { QString result; for (auto s : _pData->additionalScripts()) { result += QString(s.c_str()); - result += "\n"; + result += "\n"; } return result; } diff --git a/apps/Wormhole/CMakeLists.txt b/apps/Wormhole/CMakeLists.txt index fb8a75f2cd..a268c81d2c 100644 --- a/apps/Wormhole/CMakeLists.txt +++ b/apps/Wormhole/CMakeLists.txt @@ -38,7 +38,7 @@ create_new_application( ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -target_link_libraries(Wormhole openspace-core) +target_link_libraries(Wormhole PUBLIC openspace-core) # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the diff --git a/modules/webbrowser/cmake/webbrowser_helpers.cmake b/modules/webbrowser/cmake/webbrowser_helpers.cmake index fe8cf69023..6aaf6b3166 100644 --- a/modules/webbrowser/cmake/webbrowser_helpers.cmake +++ b/modules/webbrowser/cmake/webbrowser_helpers.cmake @@ -117,7 +117,7 @@ endfunction() function(run_cef_windows_config CEF_TARGET CEF_ROOT MODULE_PATH) # Executable target. add_dependencies(${CEF_TARGET} libcef_dll_wrapper) - target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) include_directories(${CEF_ROOT}) add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ddb279b890..658348b7ab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -51,7 +51,7 @@ target_include_directories(OpenSpaceTest PUBLIC "${GHOUL_BASE_DIR}/ext/catch2/single_include" ) target_compile_definitions(OpenSpaceTest PUBLIC "GHL_THROW_ON_ASSERT") -target_link_libraries(OpenSpaceTest openspace-core) +target_link_libraries(OpenSpaceTest PUBLIC openspace-core) if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT) # Add the CEF binary distribution's cmake/ directory to the module path and