diff --git a/CMakeLists.txt b/CMakeLists.txt index cd4db55f5a48e86dfedaae9a82e0bd17ee415d98..238708027fa45e9550425768bfd917a1fbe4aa43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,8 +231,10 @@ if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBBROWSER_MODULE_PATH}/cmake") include(webbrowser_helpers) - set_cef_targets("${CEF_ROOT}" OpenSpaceTest) - run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}") + if (TARGET OpenSpaceTest) + set_cef_targets("${CEF_ROOT}" OpenSpaceTest) + run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}") + endif () elseif (OPENSPACE_MODULE_WEBBROWSER) message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.") endif () diff --git a/modules/sync/CMakeLists.txt b/modules/sync/CMakeLists.txt index e3a25f9699eac802bc536b9f6edbe428ec5d4e4f..ed9897fe9704f5a866355b06e826eb6aae181348 100644 --- a/modules/sync/CMakeLists.txt +++ b/modules/sync/CMakeLists.txt @@ -24,11 +24,11 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) +option(OPENSPACE_MODULE_SYNC_USE_LIBTORRENT "Use libtorrent" OFF) + set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/syncmodule.h - ${CMAKE_CURRENT_SOURCE_DIR}/torrentclient.h ${CMAKE_CURRENT_SOURCE_DIR}/syncs/httpsynchronization.h - ${CMAKE_CURRENT_SOURCE_DIR}/syncs/torrentsynchronization.h ${CMAKE_CURRENT_SOURCE_DIR}/syncs/urlsynchronization.h ${CMAKE_CURRENT_SOURCE_DIR}/tasks/syncassettask.h ) @@ -36,20 +36,31 @@ source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/syncmodule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/torrentclient.cpp ${CMAKE_CURRENT_SOURCE_DIR}/syncs/httpsynchronization.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/syncs/torrentsynchronization.cpp ${CMAKE_CURRENT_SOURCE_DIR}/syncs/urlsynchronization.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tasks/syncassettask.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) +if (OPENSPACE_MODULE_SYNC_USE_LIBTORRENT) + set(HEADER_FILES + ${HEADER_FILES} + ${CMAKE_CURRENT_SOURCE_DIR}/torrentclient.h + ${CMAKE_CURRENT_SOURCE_DIR}/syncs/torrentsynchronization.h + ) + set(SOURCE_FILES + ${SOURCE_FILES} + ${CMAKE_CURRENT_SOURCE_DIR}/torrentclient.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/syncs/torrentsynchronization.cpp + ) +endif () + + create_new_module("Sync" sync_module ${HEADER_FILES} ${SOURCE_FILES}) ##### # Libtorrent ##### -option(OPENSPACE_MODULE_SYNC_USE_LIBTORRENT "Use libtorrent" OFF) if (OPENSPACE_MODULE_SYNC_USE_LIBTORRENT) set(Boost_USE_STATIC_LIBS ON) diff --git a/modules/sync/syncmodule.h b/modules/sync/syncmodule.h index dee6df8178740eaf2641c19c89350b9b7c78e02c..a173201b035647186ed5f35b0a11753641c377d3 100644 --- a/modules/sync/syncmodule.h +++ b/modules/sync/syncmodule.h @@ -27,7 +27,9 @@ #include <openspace/util/openspacemodule.h> +#ifdef SYNC_USE_LIBTORRENT #include <modules/sync/torrentclient.h> +#endif // SYNC_USE_LIBTORRENT namespace openspace { @@ -42,7 +44,9 @@ public: void addHttpSynchronizationRepository(std::string repository); std::vector<std::string> httpSynchronizationRepositories() const; +#ifdef SYNC_USE_LIBTORRENT TorrentClient& torrentClient(); +#endif // SYNC_USE_LIBTORRENT std::vector<documentation::Documentation> documentations() const override; @@ -51,7 +55,9 @@ protected: void internalDeinitialize() override; private: +#ifdef SYNC_USE_LIBTORRENT TorrentClient _torrentClient; +#endif // SYNC_USE_LIBTORRENT std::vector<std::string> _synchronizationRepositories; std::string _synchronizationRoot; }; diff --git a/modules/sync/syncs/torrentsynchronization.h b/modules/sync/syncs/torrentsynchronization.h index 2b749626ba7b25e559d566ee48530dfdb10d45cb..551827bb9f7777ca00e68bedf2323998492a54c8 100644 --- a/modules/sync/syncs/torrentsynchronization.h +++ b/modules/sync/syncs/torrentsynchronization.h @@ -25,6 +25,8 @@ #ifndef __OPENSPACE_MODULE_SYNC___TORRENTSYNCHRONIZATION___H__ #define __OPENSPACE_MODULE_SYNC___TORRENTSYNCHRONIZATION___H__ +#ifdef SYNC_USE_LIBTORRENT + #include <openspace/util/resourcesynchronization.h> #include <modules/sync/torrentclient.h> @@ -70,4 +72,6 @@ private: } // namespace openspace +#endif // SYNC_USE_LIBTORRENT + #endif // __OPENSPACE_MODULE_SYNC___TORRENTSYNCHRONIZATION___H__ diff --git a/modules/sync/torrentclient.h b/modules/sync/torrentclient.h index 69ee76f6f1e786207dd9951249124aa357633238..e03eb01498ed1aa7547f874f21cbe98f395c5654 100644 --- a/modules/sync/torrentclient.h +++ b/modules/sync/torrentclient.h @@ -25,6 +25,8 @@ #ifndef __OPENSPACE_MODULE_SYNC___TORRENTCLIENT___H__ #define __OPENSPACE_MODULE_SYNC___TORRENTCLIENT___H__ +#ifdef SYNC_USE_LIBTORRENT + #include <ghoul/misc/exception.h> #include <atomic> #include <condition_variable> @@ -118,4 +120,6 @@ private: } // namespace openspace +#endif // SYNC_USE_LIBTORRENT + #endif // __OPENSPACE_MODULE_SYNC___TORRENTCLIENT___H__ diff --git a/modules/webbrowser/cmake/patch/cmake/cef_variables.cmake b/modules/webbrowser/cmake/patch/cmake/cef_variables.cmake index af566f09a65aa53fa6cd02a274a7afa6283f1eab..1ff09a7539c7515ef81e926f3594010a3fb352ea 100644 --- a/modules/webbrowser/cmake/patch/cmake/cef_variables.cmake +++ b/modules/webbrowser/cmake/patch/cmake/cef_variables.cmake @@ -7,7 +7,6 @@ if(NOT DEFINED _CEF_ROOT_EXPLICIT) message(FATAL_ERROR "Use find_package(CEF) to load this file.") endif() - # # Shared configuration. # @@ -340,7 +339,7 @@ if(OS_WINDOWS) list(APPEND CEF_COMPILER_FLAGS /MP # Multiprocess compilation /Gy # Enable function-level linking - /GR- # Disable run-time type information + # /GR- # Disable run-time type information /W4 # Warning level 4 #/WX # Treat warnings as errors /wd4100 # Ignore "unreferenced formal parameter" warning @@ -384,11 +383,11 @@ if(OS_WINDOWS) ) list(APPEND CEF_COMPILER_DEFINES WIN32 _WIN32 _WINDOWS # Windows platform - UNICODE _UNICODE # Unicode build - WINVER=0x0601 _WIN32_WINNT=0x601 # Targeting Windows 7 + # UNICODE _UNICODE # Unicode build + # WINVER=0x0601 _WIN32_WINNT=0x601 # Targeting Windows 7 NOMINMAX # Use the standard's templated min/max WIN32_LEAN_AND_MEAN # Exclude less common API declarations - _HAS_EXCEPTIONS=0 # Disable exceptions + # _HAS_EXCEPTIONS=0 # Disable exceptions ) if(USE_OFFICIAL_BUILD_SANDBOX) list(APPEND CEF_COMPILER_DEFINES_DEBUG diff --git a/modules/webbrowser/src/defaultbrowserlauncher.cpp b/modules/webbrowser/src/defaultbrowserlauncher.cpp index dddfaf69fc639b9b48206c3235137c5d95ebd385..23a2c41c9c3e9e5d74a179ce99f470b2d46bd060 100644 --- a/modules/webbrowser/src/defaultbrowserlauncher.cpp +++ b/modules/webbrowser/src/defaultbrowserlauncher.cpp @@ -35,7 +35,7 @@ namespace { void launchBrowser(const std::string& url) { LDEBUGC("DefaultBrowserLauncher", "Launching default browser: " + url); #ifdef WIN32 - ShellExecute(nullptr, nullptr, url.c_str(), nullptr, nullptr, SW_SHOW); + ShellExecuteA(nullptr, nullptr, url.c_str(), nullptr, nullptr, SW_SHOW); #endif }