Feature/CMake (#1443)

General CMake cleanup/overhaul
* Enable precompiled headers for all projects
* Move specifications itto separate CMakeLists files
  * Add openspace-core as a subdirectory
  * Move handle_modules functionality into modules/CMakeLists.txt
  * Move handleapplications logic into apps/CMakeLists.txt
* Introduce openspace-module-collection interface library to simplify inclusion of modules in applications
* Turn module initialization into a two-step process to adapt to the new minimal dependency scenario
* Compile time speedup
  * Remove circular dependencies between modules and core preventing multithreaded compilation on MSVC
  * Build Spice multithreaded and as static library
  * Remove dependency from core to module-webbrowser
  * Remove unused dependency from kameleon
  * Remove additional unnecessary dependencies
  * Cleanup volume/kameleon/kameleonvolume modules
  * Fix visibility issues. Restrict include paths
  * Compile kameleon in parallel
* Other cleanup
  * Only copy CEF files from one target (hard-coded to OpenSpace right now)
  * Remove unused instrumentation code
  * Remove the ability to render AABB for globes as it caused a circular dependency between GlobeBrowsing and Debugging
  * Removing compiler and cppcheck warnings
  * Turn almost all includes into non-system includes
  * Don't warn on deprecrated copy
* Updated submodules
This commit is contained in:
Alexander Bock
2020-12-28 18:26:57 +01:00
committed by GitHub
parent feb3078641
commit ad8af3ffeb
181 changed files with 2250 additions and 2540 deletions
+75 -91
View File
@@ -25,86 +25,85 @@
include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule.h
${CMAKE_CURRENT_SOURCE_DIR}/src/asynctiledataprovider.h
${CMAKE_CURRENT_SOURCE_DIR}/src/basictypes.h
${CMAKE_CURRENT_SOURCE_DIR}/src/dashboarditemglobelocation.h
${CMAKE_CURRENT_SOURCE_DIR}/src/ellipsoid.h
${CMAKE_CURRENT_SOURCE_DIR}/src/gdalwrapper.h
${CMAKE_CURRENT_SOURCE_DIR}/src/geodeticpatch.h
${CMAKE_CURRENT_SOURCE_DIR}/src/globelabelscomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/globetranslation.h
${CMAKE_CURRENT_SOURCE_DIR}/src/gpulayergroup.h
${CMAKE_CURRENT_SOURCE_DIR}/src/layer.h
${CMAKE_CURRENT_SOURCE_DIR}/src/layeradjustment.h
${CMAKE_CURRENT_SOURCE_DIR}/src/layergroup.h
${CMAKE_CURRENT_SOURCE_DIR}/src/layergroupid.h
${CMAKE_CURRENT_SOURCE_DIR}/src/layermanager.h
${CMAKE_CURRENT_SOURCE_DIR}/src/layerrendersettings.h
${CMAKE_CURRENT_SOURCE_DIR}/src/lrucache.h
${CMAKE_CURRENT_SOURCE_DIR}/src/lrucache.inl
${CMAKE_CURRENT_SOURCE_DIR}/src/lruthreadpool.h
${CMAKE_CURRENT_SOURCE_DIR}/src/lruthreadpool.inl
${CMAKE_CURRENT_SOURCE_DIR}/src/memoryawaretilecache.h
${CMAKE_CURRENT_SOURCE_DIR}/src/prioritizingconcurrentjobmanager.h
${CMAKE_CURRENT_SOURCE_DIR}/src/prioritizingconcurrentjobmanager.inl
${CMAKE_CURRENT_SOURCE_DIR}/src/rawtile.h
${CMAKE_CURRENT_SOURCE_DIR}/src/rawtiledatareader.h
${CMAKE_CURRENT_SOURCE_DIR}/src/renderableglobe.h
${CMAKE_CURRENT_SOURCE_DIR}/src/ringscomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/shadowcomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/skirtedgrid.h
${CMAKE_CURRENT_SOURCE_DIR}/src/tileindex.h
${CMAKE_CURRENT_SOURCE_DIR}/src/tileloadjob.h
${CMAKE_CURRENT_SOURCE_DIR}/src/tileprovider.h
${CMAKE_CURRENT_SOURCE_DIR}/src/tiletextureinitdata.h
${CMAKE_CURRENT_SOURCE_DIR}/src/timequantizer.h
globebrowsingmodule.h
src/asynctiledataprovider.h
src/basictypes.h
src/dashboarditemglobelocation.h
src/ellipsoid.h
src/gdalwrapper.h
src/geodeticpatch.h
src/globelabelscomponent.h
src/globetranslation.h
src/gpulayergroup.h
src/layer.h
src/layeradjustment.h
src/layergroup.h
src/layergroupid.h
src/layermanager.h
src/layerrendersettings.h
src/lrucache.h
src/lrucache.inl
src/lruthreadpool.h
src/lruthreadpool.inl
src/memoryawaretilecache.h
src/prioritizingconcurrentjobmanager.h
src/prioritizingconcurrentjobmanager.inl
src/rawtile.h
src/rawtiledatareader.h
src/renderableglobe.h
src/ringscomponent.h
src/shadowcomponent.h
src/skirtedgrid.h
src/tileindex.h
src/tileloadjob.h
src/tileprovider.h
src/tiletextureinitdata.h
src/timequantizer.h
)
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule_lua.inl
${CMAKE_CURRENT_SOURCE_DIR}/src/asynctiledataprovider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dashboarditemglobelocation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ellipsoid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/gdalwrapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/geodeticpatch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/globelabelscomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/globetranslation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/gpulayergroup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/layeradjustment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/layergroup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/layermanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/layerrendersettings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/memoryawaretilecache.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/rawtile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/rawtiledatareader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/renderableglobe.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ringscomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/shadowcomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/skirtedgrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/tileindex.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/tileloadjob.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/tileprovider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/tiletextureinitdata.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/timequantizer.cpp
globebrowsingmodule.cpp
globebrowsingmodule_lua.inl
src/asynctiledataprovider.cpp
src/dashboarditemglobelocation.cpp
src/ellipsoid.cpp
src/gdalwrapper.cpp
src/geodeticpatch.cpp
src/globelabelscomponent.cpp
src/globetranslation.cpp
src/gpulayergroup.cpp
src/layer.cpp
src/layeradjustment.cpp
src/layergroup.cpp
src/layermanager.cpp
src/layerrendersettings.cpp
src/memoryawaretilecache.cpp
src/rawtiledatareader.cpp
src/renderableglobe.cpp
src/ringscomponent.cpp
src/shadowcomponent.cpp
src/skirtedgrid.cpp
src/tileindex.cpp
src/tileloadjob.cpp
src/tileprovider.cpp
src/tiletextureinitdata.cpp
src/timequantizer.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/blending.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/globalrenderer_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/localrenderer_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderer_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_geom_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_geom_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/texturetilemapping.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tile.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tileheight.hglsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/tilevertexskirt.hglsl
shaders/blending.hglsl
shaders/globalrenderer_vs.glsl
shaders/localrenderer_vs.glsl
shaders/renderer_fs.glsl
shaders/rings_vs.glsl
shaders/rings_fs.glsl
shaders/rings_geom_vs.glsl
shaders/rings_geom_fs.glsl
shaders/texturetilemapping.hglsl
shaders/tile.hglsl
shaders/tileheight.hglsl
shaders/tilevertexskirt.hglsl
)
source_group("Shader Files" FILES ${SHADER_FILES})
@@ -119,28 +118,13 @@ create_new_module(
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing)
if (WIN32)
target_include_directories(
openspace-module-globebrowsing
SYSTEM PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include
)
target_link_libraries(
openspace-module-globebrowsing
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib
)
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")
else (WIN32)
find_package(GDAL REQUIRED)
target_include_directories(
openspace-module-globebrowsing
SYSTEM PUBLIC
${GDAL_INCLUDE_DIR}
)
target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${GDAL_INCLUDE_DIR})
target_link_libraries(openspace-module-globebrowsing PRIVATE ${GDAL_LIBRARY})
mark_as_advanced(GDAL_CONFIG GDAL_INCLUDE_DIR GDAL_LIBRARY)
endif () # WIN32
@@ -121,12 +121,13 @@ namespace {
Layer currentLayer;
for (int i = 0; i < nSubdatasets; ++i) {
int iDataset = -1;
static char IdentifierBuffer[64];
std::array<char, 256> IdentifierBuffer;
std::fill(IdentifierBuffer.begin(), IdentifierBuffer.end(), '\0');
sscanf(
subDatasets[i],
"SUBDATASET_%i_%[^=]",
"SUBDATASET_%i_%256[^=]",
&iDataset,
IdentifierBuffer
IdentifierBuffer.data()
);
@@ -137,7 +138,7 @@ namespace {
currentLayerNumber = iDataset;
}
const std::string identifier = std::string(IdentifierBuffer);
const std::string identifier = std::string(IdentifierBuffer.data());
const std::string ds(subDatasets[i]);
const std::string value = ds.substr(ds.find_first_of('=') + 1);
+3 -4
View File
@@ -1,6 +1,5 @@
set (DEFAULT_MODULE ON)
set (OPENSPACE_DEPENDENCIES
debugging
space
)
)
set (DEFAULT_MODULE ON)
@@ -24,7 +24,6 @@
#include <modules/globebrowsing/src/asynctiledataprovider.h>
#include <modules/globebrowsing/globebrowsingmodule.h>
#include <modules/globebrowsing/src/memoryawaretilecache.h>
#include <modules/globebrowsing/src/rawtiledatareader.h>
#include <modules/globebrowsing/src/tileloadjob.h>
@@ -48,7 +47,6 @@ AsyncTileDataProvider::AsyncTileDataProvider(std::string name,
{
ZoneScoped
_globeBrowsingModule = global::moduleEngine->module<GlobeBrowsingModule>();
performReset(ResetRawTileDataReader::No);
}
@@ -33,8 +33,6 @@
#include <optional>
#include <set>
namespace openspace { class GlobeBrowsingModule; }
namespace openspace::globebrowsing {
struct RawTile;
@@ -103,7 +101,6 @@ protected:
private:
const std::string _name;
GlobeBrowsingModule* _globeBrowsingModule;
/// The reader used for asynchronous reading
std::unique_ptr<RawTileDataReader> _rawTileDataReader;
@@ -199,7 +199,7 @@ void DashboardItemGlobeLocation::render(glm::vec2& penPosition) {
std::pair<double, std::string> dist = simplifyDistance(altitude);
std::fill(_buffer.begin(), _buffer.end(), 0);
std::fill(_buffer.begin(), _buffer.end(), char(0));
char* end = fmt::format_to(
_buffer.data(),
_formatString.c_str(),
@@ -84,14 +84,6 @@ GdalWrapper& GdalWrapper::ref() {
return *_singleton;
}
int64_t GDALCacheUsed() {
return GDALGetCacheUsed64();
}
int64_t GDALMaximumCacheSize() {
return GDALGetCacheMax64();
}
bool GdalWrapper::logGdalErrors() const {
return _logGdalErrors;
}
-12
View File
@@ -51,18 +51,6 @@ public:
static GdalWrapper& ref();
/**
* Get the current size of the GDAL in memory cache.
* \returns the number of bytes currently in the GDAL memory cache.
*/
static int64_t GDALCacheUsed();
/**
* Get the maximum GDAL in memory cache size.
* \returns the maximum number of bytes allowed for the GDAL cache.
*/
static int64_t GDALMaximumCacheSize();
bool logGdalErrors() const;
private:
@@ -524,9 +524,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) {
strncpy(lEntry.feature, token.c_str(), 256);
int tokenChar = 0;
while (tokenChar < 256) {
if ((lEntry.feature[tokenChar] < 0 || lEntry.feature[tokenChar] > 127) &&
lEntry.feature[tokenChar] != '\0')
{
if (lEntry.feature[tokenChar] < 0 && lEntry.feature[tokenChar] != '\0') {
lEntry.feature[tokenChar] = '*';
}
else if (lEntry.feature[tokenChar] == '\"') {
-38
View File
@@ -1,38 +0,0 @@
/*****************************************************************************************
* *
* 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. *
****************************************************************************************/
#include <modules/globebrowsing/src/rawtile.h>
namespace openspace::globebrowsing {
RawTile createDefaultTile(TileTextureInitData initData) {
RawTile defaultRes;
std::byte* data = new std::byte[initData.totalNumBytes];
defaultRes.imageData = std::unique_ptr<std::byte[]>(data);
std::fill_n(defaultRes.imageData.get(), initData.totalNumBytes, std::byte(0));
defaultRes.textureInitData = std::move(initData);
return defaultRes;
}
} // namespace openspace::globebrowsing
-2
View File
@@ -55,8 +55,6 @@ struct RawTile {
GLuint pbo = 0;
};
RawTile createDefaultTile(TileTextureInitData initData);
} // namespace openspace::globebrowsing
#endif // __OPENSPACE_MODULE_GLOBEBROWSING___RAWTILE___H__
@@ -946,7 +946,6 @@ TileMetaData RawTileDataReader::tileMetaData(RawTile& rawTile,
std::fill(ppData.maxValues.begin(), ppData.maxValues.end(), -FLT_MAX);
std::fill(ppData.minValues.begin(), ppData.minValues.end(), FLT_MAX);
std::fill(ppData.hasMissingData.begin(), ppData.hasMissingData.end(), false);
std::vector<float> noDataValues(_initData.nRasters, noDataValueAsFloat());
bool allIsMissing = true;
for (int y = 0; y < region.numPixels.y; ++y) {
+5 -20
View File
@@ -123,12 +123,6 @@ namespace {
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo ShowChunkAABBInfo = {
"ShowChunkAABB",
"Show chunk AABB",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo HeightResolutionInfo = {
"ShowHeightResolution",
"Show height resolution",
@@ -524,7 +518,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
, _debugProperties({
BoolProperty(ShowChunkEdgeInfo, false),
BoolProperty(ShowChunkBoundsInfo, false),
BoolProperty(ShowChunkAABBInfo, false),
BoolProperty(HeightResolutionInfo, false),
BoolProperty(HeightIntensityInfo, false),
BoolProperty(LevelProjectedAreaInfo, true),
@@ -1283,13 +1276,12 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
}
_localRenderer.program->deactivate();
if (_debugProperties.showChunkBounds || _debugProperties.showChunkAABB) {
if (_debugProperties.showChunkBounds) {
for (int i = 0; i < globalCount; ++i) {
debugRenderChunk(
*_globalChunkBuffer[i],
mvp,
_debugProperties.showChunkBounds,
_debugProperties.showChunkAABB
_debugProperties.showChunkBounds
);
}
@@ -1297,8 +1289,7 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
debugRenderChunk(
*_localChunkBuffer[i],
mvp,
_debugProperties.showChunkBounds,
_debugProperties.showChunkAABB
_debugProperties.showChunkBounds
);
}
}
@@ -1560,7 +1551,7 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d
}
void RenderableGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp,
bool renderBounds, bool renderAABB) const
bool renderBounds) const
{
ZoneScoped
@@ -1589,12 +1580,6 @@ void RenderableGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp
if (renderBounds) {
DebugRenderer::ref().renderNiceBox(clippingSpaceCorners, color);
}
if (renderAABB) {
const std::vector<glm::vec4>& screenSpacePoints =
DebugRenderer::ref().verticesFor(screenSpaceBounds);
DebugRenderer::ref().renderNiceBox(screenSpacePoints, color);
}
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -1825,7 +1810,7 @@ void RenderableGlobe::recompileShaders() {
shaderDictionary.setValue("nShadowSamples", _generalProperties.nShadowSamples - 1);
// Exclise Shadow Samples
int nEclipseShadows = _ellipsoid.shadowConfigurationArray().size();
int nEclipseShadows = static_cast<int>(_ellipsoid.shadowConfigurationArray().size());
shaderDictionary.setValue("nEclipseShadows", nEclipseShadows - 1);
//
// Create local shader
+1 -2
View File
@@ -124,7 +124,6 @@ private:
struct {
properties::BoolProperty showChunkEdges;
properties::BoolProperty showChunkBounds;
properties::BoolProperty showChunkAABB;
properties::BoolProperty showHeightResolution;
properties::BoolProperty showHeightIntensities;
properties::BoolProperty levelByProjectedAreaElseDistance;
@@ -220,7 +219,7 @@ private:
);
void debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp,
bool renderBounds, bool renderAABB) const;
bool renderBounds) const;
bool isCullableByFrustum(const Chunk& chunk, const RenderData& renderData,
const glm::dmat4& mvp) const;
+4 -2
View File
@@ -460,10 +460,12 @@ std::string consumeTemporalMetaData(TemporalTileProvider& t, const std::string&
else {
gdalNode = CPLSearchXMLNode(node, "FilePath");
if (gdalNode) {
std::string gdalDescription = std::string(gdalNode->psChild->pszValue);
return gdalDescription;
}
else {
return "";
}
std::string gdalDescription = std::string(gdalNode->psChild->pszValue);
return gdalDescription;
}
}
+3 -3
View File
@@ -477,11 +477,11 @@ bool TimeQuantizer::quantize(Time& t, bool clamp) {
// resolutionFraction helps to improve iteration performance
constexpr const double ResolutionFraction = 0.7;
constexpr const int IterationLimit = 50;
int iterations = 0;
int lastIncr = 0;
int lastDecr = 0;
if (_timerange.includes(t)) {
int iterations = 0;
int lastIncr = 0;
int lastDecr = 0;
DateTime quantized = DateTime(_timerange.start());
doFirstApproximation(quantized, unquantized, _resolutionValue, _resolutionUnit);
double error = unquantized.J2000() - quantized.J2000();