Only set CEF settings to OpenSpaceTest if OpenSpace is compiled with tests (closes #778)

Do not disable RTTI on CEF targets
Do not for Unicode on CEF targets
More graceful handling of torrent classes in Sync module
This commit is contained in:
Alexander Bock
2018-12-03 14:00:08 -05:00
parent 9d4b26a6c3
commit 36d0f71913
7 changed files with 39 additions and 13 deletions

View File

@@ -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 ()

View File

@@ -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)

View File

@@ -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;
};

View File

@@ -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__

View File

@@ -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__

View File

@@ -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

View File

@@ -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
}