diff --git a/CMakeLists.txt b/CMakeLists.txt index eabc169d1f..1694b170b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ set(OPENSPACE_CMAKE_EXT_DIR "${OPENSPACE_BASE_DIR}/support/cmake") set(GHOUL_BASE_DIR "${OPENSPACE_BASE_DIR}/ext/ghoul") include(${OPENSPACE_CMAKE_EXT_DIR}/module_common.cmake) -include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake) include(${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) include(${GHOUL_BASE_DIR}/support/cmake/message_macros.cmake) @@ -164,7 +163,6 @@ if (UNIX) endif () add_subdirectory(ext) - add_subdirectory(src) add_subdirectory(support/coding/codegen) diff --git a/apps/OpenSpace-MinVR/CMakeLists.txt b/apps/OpenSpace-MinVR/CMakeLists.txt index 8f799b8b37..ae592d8d42 100644 --- a/apps/OpenSpace-MinVR/CMakeLists.txt +++ b/apps/OpenSpace-MinVR/CMakeLists.txt @@ -50,7 +50,7 @@ target_include_directories(OpenSpace-MinVR PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ex target_include_directories(OpenSpace-MinVR PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/minvr/external/GLFW/src/include) -target_link_libraries(OpenSpace-MinVR openspace-core MinVR) +target_link_libraries(OpenSpace-MinVR PUBLIC openspace-core MinVR) # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the @@ -71,16 +71,7 @@ elseif (OPENSPACE_MODULE_WEBBROWSER) message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.") endif () -if (OPENSPACE_MODULE_WEBGUI AND WEBGUI_MODULE_PATH) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBGUI_MODULE_PATH}/cmake") - include(webgui_helpers) - build_webgui_source(OpenSpace-MinVR) -elseif (OPENSPACE_MODULE_WEBGUI) - message(WARNING "WebGui is configured to be included, but the web source could not be found. Try configuring CMake again.") -endif () -# End Web Browser and Web gui - if (MSVC) # This library is used for being able to output the callstack if an exception escapes - target_link_libraries(OpenSpace-MinVR Dbghelp.lib) + target_link_libraries(OpenSpace-MinVR PUBLIC Dbghelp.lib) endif () diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index ba01953e86..b8677938df 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -25,7 +25,6 @@ include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake) include(${GHOUL_BASE_DIR}/support/cmake/message_macros.cmake) include(${OPENSPACE_CMAKE_EXT_DIR}/application_definition.cmake) -include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) # We are getting all_enabled_modules from the handle_applications.cmake file which gets # it from the main CMakeLists file @@ -141,6 +140,18 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher) target_link_libraries(OpenSpace PRIVATE openspace-ui-launcher) end_header("Dependency: Profile Editor") +if (WIN32) + # Find the windeployqt application + get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) + get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) + find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") + add_custom_command( + TARGET OpenSpace POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}" --verbose 0 --no-compiler-runtime \"$\" + COMMENT "Deploying Qt libraries" + ) +endif () + # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the @@ -161,7 +172,7 @@ if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT) set_cef_targets("${CEF_ROOT}" OpenSpace) run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}") elseif () - message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.") + message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again") endif () if (MSVC) @@ -174,3 +185,10 @@ endif () if (OPENSPACE_NVTOOLS_ENABLED) target_link_libraries(OpenSpace PRIVATE "${OPENSPACE_NVTOOLS_PATH}/lib/x64/nvToolsExt64_1.lib") endif () + +if (WIN32) + add_custom_command(TARGET OpenSpace POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND_EXPAND_LISTS + ) +endif () diff --git a/data/tasks/sessRecConvertVersion.task b/data/tasks/sessRecConvertVersion.task new file mode 100644 index 0000000000..b854e5feac --- /dev/null +++ b/data/tasks/sessRecConvertVersion.task @@ -0,0 +1,6 @@ +return { + { + Type = "ConvertRecFileVersionTask", + InputFilePath = "../../user/recordings/input.osrec" + } +} diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 079c95117b..3e17fac68d 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -62,13 +62,19 @@ end_dependency() # Curl begin_dependency("CURL") -add_library(external-curl INTERFACE) if (WIN32) - target_include_directories(external-curl INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/curl/include") - target_link_libraries(external-curl INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/curl/lib/libcurl.lib") + add_library(external-curl SHARED IMPORTED GLOBAL) + target_include_directories(external-curl INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/curl/include) + set_property(TARGET external-curl PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/curl/lib/libcurl.lib) + set_property(TARGET external-curl PROPERTY IMPORTED_LOCATION + ${CMAKE_CURRENT_SOURCE_DIR}/curl/lib/libcurl.dll + ${CMAKE_CURRENT_SOURCE_DIR}/curl/lib/libeay32.dll + ${CMAKE_CURRENT_SOURCE_DIR}/curl/lib/ssleay32.dll + ) else () find_package(CURL) if (CURL_FOUND) + add_library(external-curl INTERFACE) target_include_directories(external-curl INTERFACE ${CURL_INCLUDE_DIRS}) target_link_libraries(external-curl INTERFACE ${CURL_LIBRARIES}) endif () diff --git a/ext/ghoul b/ext/ghoul index 1f420ed0f0..b676d66bc0 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 1f420ed0f03347ed3c8bb7550d58798f9a02cbc0 +Subproject commit b676d66bc028e26dbf2fa0a39c67e35667df13f9 diff --git a/ext/spice b/ext/spice index bb7eded3a4..5dba0f3269 160000 --- a/ext/spice +++ b/ext/spice @@ -1 +1 @@ -Subproject commit bb7eded3a4c45eff33cee41f4d24fffe5248d01a +Subproject commit 5dba0f32690dd49f29adbbf618a69e5709cdc405 diff --git a/include/openspace/interaction/sessionrecording.h b/include/openspace/interaction/sessionrecording.h index b1981a8e3a..b7bf00fb52 100644 --- a/include/openspace/interaction/sessionrecording.h +++ b/include/openspace/interaction/sessionrecording.h @@ -550,6 +550,16 @@ public: */ std::string convertFile(std::string filename, int depth = 0); + /** + * Converts file format of a session recording file to the current format version + * (will determine the file format conversion to convert from based on the file's + * header version number). Accepts a relative path (currently from task runner dir) + * rather than a path assumed to be relative to ${RECORDINGS}. + * + * \param filename name of the file to convert + */ + void convertFileRelativePath(std::string filenameRelative); + /** * Goes to legacy session recording inherited class, and calls its convertFile() * method, and then returns the resulting conversion filename. @@ -617,7 +627,6 @@ protected: bool handleRecordingFile(std::string filenameIn); static bool isPath(std::string& filename); void removeTrailingPathSlashes(std::string& filename); - void extractFilenameFromPath(std::string& filename); bool playbackCamera(); bool playbackTimeChange(); bool playbackScript(); diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index aa26ff6b6c..72598ce00b 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -149,9 +149,11 @@ target_precompile_headers(${globebrowsing_module} PRIVATE install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing) if (WIN32) - target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include) - target_link_libraries(openspace-module-globebrowsing PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib) - register_external_libraries("${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal241.dll") + add_library(gdal SHARED IMPORTED) + target_include_directories(gdal SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include) + set_target_properties(gdal PROPERTIES IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib) + set_target_properties(gdal PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal241.dll) + target_link_libraries(openspace-module-globebrowsing PRIVATE gdal) else (WIN32) find_package(GDAL REQUIRED) diff --git a/modules/space/rendering/renderableorbitalkepler.cpp b/modules/space/rendering/renderableorbitalkepler.cpp index 0baecf37dd..95e7dc70e4 100644 --- a/modules/space/rendering/renderableorbitalkepler.cpp +++ b/modules/space/rendering/renderableorbitalkepler.cpp @@ -160,7 +160,7 @@ RenderableOrbitalKepler::RenderableOrbitalKepler(const ghoul::Dictionary& dict) addProperty(_opacity); _segmentQuality = static_cast(p.segmentQuality); - _segmentQuality.onChange([this]() { initializeGL(); }); + _segmentQuality.onChange([this]() { updateBuffers(); }); addProperty(_segmentQuality); _appearance.lineColor = p.color; @@ -169,7 +169,7 @@ RenderableOrbitalKepler::RenderableOrbitalKepler(const ghoul::Dictionary& dict) addPropertySubOwner(_appearance); _path = p.path.string(); - _path.onChange([this]() { initializeGL(); }); + _path.onChange([this]() { updateBuffers(); }); addProperty(_path); _format = codegen::map(p.format); diff --git a/modules/spout/CMakeLists.txt b/modules/spout/CMakeLists.txt index ae1cdfc329..e603a0fc57 100644 --- a/modules/spout/CMakeLists.txt +++ b/modules/spout/CMakeLists.txt @@ -50,8 +50,13 @@ create_new_module( ${HEADER_FILES} ${SOURCE_FILES} ) -target_include_directories(openspace-module-spout SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout) -target_link_libraries(openspace-module-spout PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.lib) -register_external_libraries("${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.dll") +add_library(spout SHARED IMPORTED) +target_include_directories(spout SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout) +set_target_properties( + spout PROPERTIES + IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.lib + IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.dll +) +target_link_libraries(openspace-module-spout PRIVATE spout) target_compile_definitions(openspace-module-spout PUBLIC "OPENSPACE_HAS_SPOUT") diff --git a/modules/webbrowser/CMakeLists.txt b/modules/webbrowser/CMakeLists.txt index bd01c449f9..dfd808aed5 100644 --- a/modules/webbrowser/CMakeLists.txt +++ b/modules/webbrowser/CMakeLists.txt @@ -202,8 +202,8 @@ if (OS_MACOSX) endif () endforeach() - set_property(TARGET ${CEF_HELPER_TARGET_GPU} PROPERTY FOLDER "Helper") - set_property(TARGET ${CEF_HELPER_TARGET_RENDERER} PROPERTY FOLDER "Helper") + set_target_properties(${CEF_HELPER_TARGET_GPU} PROPERTIES FOLDER "Helper") + set_target_properties(${CEF_HELPER_TARGET_RENDERER} PROPERTIES FOLDER "Helper") else() message(STATUS "Setting up WebBrowser CEF helper executable: ${CEF_HELPER_TARGET}") set_openspace_cef_target_out_dir() @@ -219,7 +219,7 @@ else() endif (OS_WINDOWS) endif () -set_property(TARGET ${CEF_HELPER_TARGET} PROPERTY FOLDER "Helper") +set_target_properties(${CEF_HELPER_TARGET} PROPERTIES FOLDER "Helper") ########################################################################################## # Create OpenSpace module. @@ -292,13 +292,4 @@ if (UNIX AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) DESTINATION ${CEF_ROOT}/${CMAKE_BUILD_TYPE}/ FILES_MATCHING PATTERN * ) - endif () - -# Rename to "OpenSpace Helper" after build & link as spaces in targets are not allowed -# add_custom_command( -# TARGET ${CEF_HELPER_TARGET} POST_BUILD -# COMMAND ${CMAKE_COMMAND} -E rename -# "$/${CEF_HELPER_TARGET}" -# "$/OpenSpace Helper" -# COMMENT "Renaming ${CEF_HELPER_TARGET} to 'OpenSpace Helper'" -# ) +endif () diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 0eadd4499e..365fd801f4 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -143,15 +143,6 @@ void SessionRecording::removeTrailingPathSlashes(std::string& filename) { } } -void SessionRecording::extractFilenameFromPath(std::string& filename) { - size_t unixDelimiter = filename.find_last_of("/"); - if (unixDelimiter != std::string::npos) - filename = filename.substr(unixDelimiter + 1); - size_t windowsDelimiter = filename.find_last_of("\\"); - if (windowsDelimiter != std::string::npos) - filename = filename.substr(windowsDelimiter + 1); -} - bool SessionRecording::handleRecordingFile(std::string filenameIn) { if (isPath(filenameIn)) { LERROR("Recording filename must not contain path (/) elements"); @@ -1624,7 +1615,7 @@ std::string SessionRecording::isolateTermFromQuotes(std::string s) { } //If no quotes found, remove other possible characters from end std::string unwantedChars = " );"; - while (unwantedChars.find(s.back()) != std::string::npos) { + while (!s.empty() && (unwantedChars.find(s.back()) != std::string::npos)) { s.pop_back(); } return s; @@ -2303,6 +2294,10 @@ void SessionRecording::readFileIntoStringStream(std::string filename, inputFstream.close(); } +void SessionRecording::convertFileRelativePath(std::string filenameRelative) { + convertFile(absPath(filenameRelative).string()); +} + std::string SessionRecording::convertFile(std::string filename, int depth) { std::string conversionOutFilename = filename; std::ifstream conversionInFile; @@ -2331,9 +2326,6 @@ std::string SessionRecording::convertFile(std::string filename, int depth) { //conversionInStream.seekg(conversionInStream.beg); newFilename = getLegacyConversionResult(filename, depth + 1); removeTrailingPathSlashes(newFilename); - if (isPath(newFilename)) { - extractFilenameFromPath(newFilename); - } if (filename == newFilename) { return filename; } @@ -2572,7 +2564,7 @@ std::string SessionRecording::determineConversionOutFilename(const std::string f filenameSansExtension = filename.substr(0, filename.find_last_of(".")); } filenameSansExtension += "_" + fileFormatVersion() + "-" + targetFileFormatVersion(); - return absPath("${RECORDINGS}/" + filenameSansExtension + fileExtension).string(); + return filenameSansExtension + fileExtension; } bool SessionRecording_legacy_0085::convertScript(std::stringstream& inStream, diff --git a/src/interaction/tasks/convertrecfileversiontask.cpp b/src/interaction/tasks/convertrecfileversiontask.cpp index 1255d3ee0a..61f3e31c61 100644 --- a/src/interaction/tasks/convertrecfileversiontask.cpp +++ b/src/interaction/tasks/convertrecfileversiontask.cpp @@ -52,11 +52,6 @@ ConvertRecFileVersionTask::ConvertRecFileVersionTask(const ghoul::Dictionary& di _inFilename = dictionary.value(KeyInFilePath); _inFilePath = absPath(_inFilename); - std::string::size_type idx = _inFilename.find_last_of('/'); - if (idx != std::string::npos) { - _inFilename = _inFilename.substr(idx + 1); - } - ghoul_assert(std::filesystem::is_regular_file(_inFilePath), "The file must exist"); if (!std::filesystem::is_regular_file(_inFilePath)) { LERROR(fmt::format("Failed to load session recording file: {}", _inFilePath)); @@ -100,7 +95,7 @@ void ConvertRecFileVersionTask::convert() { )); return; } - sessRec->convertFile(_inFilename); + sessRec->convertFileRelativePath(_inFilename); } documentation::Documentation ConvertRecFileVersionTask::documentation() { diff --git a/support/cmake/application_definition.cmake b/support/cmake/application_definition.cmake index 100f51f740..6705639450 100644 --- a/support/cmake/application_definition.cmake +++ b/support/cmake/application_definition.cmake @@ -27,39 +27,9 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) function (create_new_application application_name) add_executable(${application_name} MACOSX_BUNDLE ${ARGN}) set_openspace_compile_settings(${application_name}) - - # We currently can't reuse the precompiled header because that one has the Kameleon - # definition stuck into it - #target_precompile_headers(${library_name} REUSE_FROM openspace-core) - #target_precompile_headers(${application_name} PRIVATE - # [["ghoul/fmt.h"]] - # [["ghoul/glm.h"]] - # [["ghoul/misc/assert.h"]] - # [["ghoul/misc/boolean.h"]] - # [["ghoul/misc/exception.h"]] - # [["ghoul/misc/invariants.h"]] - # [["ghoul/misc/profiling.h"]] - # - # - # - # - # - # - # - # - # - #) - if (WIN32) get_external_library_dependencies(ext_lib) - ghl_copy_files( - ${application_name} - "${OPENSPACE_BASE_DIR}/ext/curl/lib/libcurl.dll" - "${OPENSPACE_BASE_DIR}/ext/curl/lib/libeay32.dll" - "${OPENSPACE_BASE_DIR}/ext/curl/lib/ssleay32.dll" - ${ext_lib} - ) - ghl_copy_shared_libraries(${application_name} ${OPENSPACE_BASE_DIR}/ext/ghoul) + ghl_copy_files(${application_name} ${ext_lib}) endif () target_link_libraries(${application_name} PUBLIC openspace-module-base) diff --git a/support/cmake/module_definition.cmake b/support/cmake/module_definition.cmake index 34dbd45be8..96cbeb1934 100644 --- a/support/cmake/module_definition.cmake +++ b/support/cmake/module_definition.cmake @@ -74,20 +74,6 @@ endfunction () -function (register_external_libraries libraries) - # This is an ugly hack as we can't inject a variable into a scope two parents above - # would love to: set(${module_external_librarys} "${libraries}" PARENT_PARENT_SCOPE) - # instead - set(libs "") - foreach (library ${libraries}) - get_filename_component(lib ${library} ABSOLUTE) - list(APPEND libs ${lib}) - endforeach() - - set_property(GLOBAL PROPERTY CurrentModuleExternalLibraries ${libs}) -endfunction () - - # Gets and returns the module.h and module.cpp files and provides them with a # source group function (get_module_files module_name module_files)