Increase the compile times by including more precompiled headers (#2217)

* Define WIN32_LEAN_AND_MEAN and VC_EXTRALEAN globally
* Use forked version of TUIO, some more work on precompiled headers
* Improvements for the Kameleon module
This commit is contained in:
Alexander Bock
2022-08-26 16:32:21 +02:00
committed by GitHub
parent 01eabd1b02
commit 664eb60f4f
53 changed files with 261 additions and 113 deletions

View File

@@ -30,6 +30,7 @@
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/navigation/navigationhandler.h>
#include <ghoul/misc/profiling.h>
#include <openspace/properties/property.h>
#include <openspace/rendering/deferredcastermanager.h>
#include <math.h>

View File

@@ -165,3 +165,14 @@ create_new_module(
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
target_precompile_headers(${base_module} PRIVATE
<openspace/documentation/documentation.h>
<openspace/documentation/verifier.h>
<openspace/properties/numericalproperty.h>
<openspace/rendering/renderable.h>
<ghoul/opengl/programobject.h>
<ghoul/opengl/shaderobject.h>
<ghoul/opengl/uniformcache.h>
<future>
<map>
)

View File

@@ -48,4 +48,18 @@ create_new_module(
${OPENSPACE_HEADER_FILES} ${OPENSPACE_SOURCE_FILES}
)
target_precompile_headers(${cefwebgui_module} PRIVATE
[["include/capi/cef_base_capi.h"]]
[["include/cef_render_handler.h"]]
<string>
<sstream>
<istream>
<ostream>
)
if (WIN32)
target_precompile_headers(${cefwebgui_module} PRIVATE
<Windows.h>
)
endif ()
set_modules_dependency_on_cef_libraries(${cefwebgui_module})

View File

@@ -41,6 +41,7 @@
#include <ccmc/Kameleon.h>
#include <ccmc/KameleonInterpolator.h>
#include <ccmc/Tracer.h>
#include <modules/kameleon/include/kameleonhelper.h>
#ifdef _MSC_VER

View File

@@ -64,3 +64,8 @@ disable_external_warnings(CCfits)
target_include_directories(openspace-module-fitsfilereader SYSTEM PRIVATE ${INCLUDES_FOR_TARGET})
target_link_libraries(openspace-module-fitsfilereader PRIVATE cfitsio CCfits)
target_precompile_headers(CCfits PRIVATE
<istream>
<ostream>
)

View File

@@ -139,6 +139,12 @@ create_new_module(
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
target_precompile_headers(${globebrowsing_module} PRIVATE
<modules/globebrowsing/src/tileprovider/tileprovider.h>
<modules/globebrowsing/globebrowsingmodule.h>
<future>
<map>
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing)

View File

@@ -512,7 +512,7 @@ void ShadowComponent::saveDepthBuffer() {
<< std::endl;
ppmFile << "255" << std::endl;
std::cout << "\n\nSaving depth texture to file depthBufferShadowMapping.ppm\n\n";
LDEBUG("Saving depth texture to file depthBufferShadowMapping.ppm");
int k = 0;
for (int i = 0; i < _shadowDepthTextureWidth; i++) {
for (int j = 0; j < _shadowDepthTextureHeight; j++, k++) {
@@ -523,8 +523,7 @@ void ShadowComponent::saveDepthBuffer() {
}
ppmFile.close();
std::cout << "Texture saved to file depthBufferShadowMapping.ppm\n\n";
LDEBUG("Texture saved to file depthBufferShadowMapping.ppm");
}
buffer.clear();
@@ -552,7 +551,7 @@ void ShadowComponent::saveDepthBuffer() {
<< std::endl;
ppmFile << "255" << std::endl;
std::cout << "\n\nSaving texture position to positionBufferShadowMapping.ppm\n\n";
LDEBUG("Saving texture position to positionBufferShadowMapping.ppm");
float biggestValue = 0.f;
@@ -580,7 +579,7 @@ void ShadowComponent::saveDepthBuffer() {
ppmFile.close();
LINFO("Texture saved to file positionBufferShadowMapping.ppm");
LDEBUG("Texture saved to file positionBufferShadowMapping.ppm");
}
}

View File

@@ -80,3 +80,7 @@ create_new_module(
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
target_precompile_headers(${iswa_module} PRIVATE
<openspace/json.h>
<future>
)

View File

@@ -93,6 +93,7 @@ protected:
* \return \c true if update was successful
*/
virtual bool updateTexture() = 0;
/**
* Is called before updateTexture. For IswaCygnets getting data from a HTTP request,
* this function should get the dataFile from the future object.
@@ -100,6 +101,7 @@ protected:
* \return \c true if update was successful
*/
virtual bool updateTextureResource() = 0;
/**
* Should send a HTTP request to get the resource it needs to create a texture. For
* Texture cygnets, this should be an image. For DataCygnets, this should be the data

View File

@@ -64,27 +64,25 @@
#endif // OPENSPACE_MODULE_KAMELEON_ENABLED
constexpr std::string_view monthNumber(std::string_view month) {
if (month == "JAN") return "01";
else if (month == "FEB") return "02";
else if (month == "MAR") return "03";
else if (month == "APR") return "04";
else if (month == "MAY") return "05";
else if (month == "JUN") return "06";
else if (month == "JUL") return "07";
else if (month == "AUG") return "08";
else if (month == "SEP") return "09";
else if (month == "OCT") return "10";
else if (month == "NOV") return "11";
else if (month == "DEC") return "12";
else return "";
}
namespace {
using json = nlohmann::json;
constexpr std::string_view _loggerCat = "IswaManager";
constexpr std::string_view monthNumber(std::string_view month) {
if (month == "JAN") return "01";
else if (month == "FEB") return "02";
else if (month == "MAR") return "03";
else if (month == "APR") return "04";
else if (month == "MAY") return "05";
else if (month == "JUN") return "06";
else if (month == "JUL") return "07";
else if (month == "AUG") return "08";
else if (month == "SEP") return "09";
else if (month == "OCT") return "10";
else if (month == "NOV") return "11";
else if (month == "DEC") return "12";
else return "";
}
void createScreenSpace(int id) {
std::string idStr = std::to_string(id);
openspace::global::scriptEngine->queueScript(
@@ -92,7 +90,6 @@ namespace {
openspace::scripting::ScriptEngine::RemoteScripting::Yes
);
}
} // namespace
namespace openspace {
@@ -178,7 +175,7 @@ void IswaManager::addIswaCygnet(int id, const std::string& type, std::string gro
metaFuture.json = res;
//convert to json
json j = json::parse(res);
nlohmann::json j = nlohmann::json::parse(res);
// Check what kind of geometry here
if (j["Coordinate Type"].is_null()) {
@@ -357,7 +354,7 @@ std::string IswaManager::jsonPlaneToLuaTable(MetadataFuture& data) {
if (data.json.empty()) {
return "";
}
json j = json::parse(data.json);
nlohmann::json j = nlohmann::json::parse(data.json);
std::string parent = j["Central Body"];
std::string frame = j["Coordinates"];
@@ -473,7 +470,7 @@ std::string IswaManager::jsonSphereToLuaTable(MetadataFuture& data) {
return "";
}
json j = json::parse(data.json);
nlohmann::json j = nlohmann::json::parse(data.json);
j = j["metadata"];
std::string parent = j["central_body"];
parent[0] = static_cast<char>(toupper(static_cast<int>(parent[0])));
@@ -667,16 +664,16 @@ void IswaManager::createFieldline(std::string name, std::string cdfPath,
void IswaManager::fillCygnetInfo(std::string jsonString) {
if (jsonString != "") {
json j = json::parse(jsonString);
nlohmann::json j = nlohmann::json::parse(jsonString);
std::set<std::string> lists = {"listOfPriorityCygnets", "listOfOKCygnets"
// ,"listOfStaleCygnets", "listOfInactiveCygnets",
};
for (const std::string& list : lists) {
json jsonList = j[list];
nlohmann::json jsonList = j[list];
for (size_t i = 0; i < jsonList.size(); ++i) {
json jCygnet = jsonList.at(i);
nlohmann::json jCygnet = jsonList.at(i);
std::string name = jCygnet["cygnetDisplayTitle"];
std::replace(name.begin(), name.end(),'.', ',');
@@ -706,9 +703,9 @@ void IswaManager::addCdfFiles(std::string cdfpath) {
std::ifstream jsonFile(cdfFile);
if (jsonFile.is_open()) {
json cdfGroups = json::parse(jsonFile);
nlohmann::json cdfGroups = nlohmann::json::parse(jsonFile);
for(size_t i = 0; i < cdfGroups.size(); ++i) {
json cdfGroup = cdfGroups.at(i);
nlohmann::json cdfGroup = cdfGroups.at(i);
std::string groupName = cdfGroup["group"];
std::string fieldlineSeedsIndexFile = cdfGroup["fieldlinefile"];
@@ -720,9 +717,9 @@ void IswaManager::addCdfFiles(std::string cdfpath) {
_cdfInformation[groupName] = std::vector<CdfInfo>();
json cdfs = cdfGroup["cdfs"];
nlohmann::json cdfs = cdfGroup["cdfs"];
for (size_t j = 0; j < cdfs.size(); j++) {
json cdf = cdfs.at(j);
nlohmann::json cdf = cdfs.at(j);
std::string name = cdf["name"];
std::string path = cdf["path"];

View File

@@ -71,6 +71,20 @@ if (TARGET cdf)
set_folder_location(cdf "External")
endif ()
target_precompile_headers(cdf PRIVATE
[["stdio.h"]]
[["stdlib.h"]]
[["string.h"]]
)
target_precompile_headers(ccmc PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:iostream>"
"$<$<COMPILE_LANGUAGE:CXX>:map>"
"$<$<COMPILE_LANGUAGE:CXX>:unordered_map>"
"$<$<COMPILE_LANGUAGE:CXX>:vector>"
"$<$<COMPILE_LANGUAGE:CXX>:boost/unordered_map.hpp>"
)
if (WIN32)
target_compile_options(ccmc PRIVATE /MP)
if (TARGET cdf)

View File

@@ -35,6 +35,7 @@
#endif // _MSC_VER
#include <ccmc/Kameleon.h>
#include <ccmc/FileReader.h>
#ifdef _MSC_VER
#pragma warning (pop)

View File

@@ -39,6 +39,8 @@
#endif // WIN32
#include <ccmc/Kameleon.h>
#include <ccmc/Constants.h>
#include <ccmc/FileReader.h>
#include <ccmc/Model.h>
#include <ccmc/Interpolator.h>
#include <ccmc/BATSRUS.h>

View File

@@ -42,6 +42,7 @@
#include <ccmc/Kameleon.h>
#include <ccmc/Model.h>
#include <ccmc/FileReader.h>
#include <ccmc/BATSRUS.h>
#include <ccmc/ENLIL.h>
#include <ccmc/CCMCTime.h>

View File

@@ -27,7 +27,6 @@
#include <openspace/util/histogram.h>
#include <filesystem>
#include <string>
namespace openspace {

View File

@@ -82,3 +82,10 @@ create_new_module(
server_module
${HEADER_FILES} ${SOURCE_FILES}
)
target_precompile_headers(${server_module} PRIVATE
<modules/server/include/connection.h>
<modules/server/include/topics/topic.h>
<openspace/json.h>
<ghoul/misc/templatefactory.h>
)

View File

@@ -63,3 +63,7 @@ create_new_module(
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
target_precompile_headers(${skybrowser_module} PRIVATE
[["include/cef_accessibility_handler.h"]]
[["include/cef_render_handler.h"]]
)

View File

@@ -88,3 +88,12 @@ create_new_module(
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
target_precompile_headers(${space_module} PRIVATE
<openspace/documentation/documentation.h>
<openspace/documentation/verifier.h>
<openspace/properties/numericalproperty.h>
<openspace/rendering/renderable.h>
<ghoul/opengl/programobject.h>
<ghoul/opengl/shaderobject.h>
<ghoul/opengl/uniformcache.h>
)

View File

@@ -91,3 +91,6 @@ create_new_module(
STATIC
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
target_precompile_headers(${spacecraftinstruments_module} PRIVATE
)

View File

@@ -25,23 +25,30 @@
include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/state.h
${CMAKE_CURRENT_SOURCE_DIR}/include/transition.h
${CMAKE_CURRENT_SOURCE_DIR}/include/statemachine.h
${CMAKE_CURRENT_SOURCE_DIR}/include/state.h
${CMAKE_CURRENT_SOURCE_DIR}/include/transition.h
${CMAKE_CURRENT_SOURCE_DIR}/include/statemachine.h
)
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/statemachinemodule_lua.inl
${CMAKE_CURRENT_SOURCE_DIR}/src/state.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/transition.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/statemachine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/statemachinemodule_lua.inl
${CMAKE_CURRENT_SOURCE_DIR}/src/state.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/transition.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/statemachine.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
create_new_module(
"StateMachine"
statemachine_module
STATIC
${HEADER_FILES} ${SOURCE_FILES}
"StateMachine"
statemachine_module
STATIC
${HEADER_FILES} ${SOURCE_FILES}
)
target_precompile_headers(${statemachine_module} PRIVATE
<ghoul/glm.h>
<ghoul/lua/ghoul_lua.h>
<chrono>
<filesystem>
<string>
)

View File

@@ -25,6 +25,7 @@
#include <modules/statemachine/include/statemachine.h>
#include <openspace/documentation/documentation.h>
#include <ghoul/fmt.h>
#include <ghoul/logging/logmanager.h>
#include <fstream>
#include <optional>

View File

@@ -76,6 +76,23 @@ target_include_directories(libTUIO11 SYSTEM
"${PROJECT_SOURCE_DIR}/libTUIO11/"
"${PROJECT_SOURCE_DIR}/libTUIO11/oscpack"
)
target_precompile_headers(libTUIO11 PRIVATE
<iostream>
<istream>
<ostream>
<stdexcept>
)
# # [["tuiopoint.h"]]
# # [["tuiocontainer.h"]]
# # [["tuiotime.h"]]
# # [["tuioobject.h"]]
# # [["tuiodispatcher.h"]]
# # [["tuiolistener.h"]]
# # [["tuioclient.h"]]
# # [["oscreceiver.h"]]
# <stdexcept>
# <math.h>
# )
if (WIN32)
# Tuio dependencies

View File

@@ -28,16 +28,9 @@
#include <modules/touch/include/win32_touch.h>
#include <openspace/engine/globals.h>
#include <openspace/engine/globalscallbacks.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/engine/windowdelegate.h>
#include <openspace/interaction/interactionmonitor.h>
#include <openspace/navigation/navigationhandler.h>
#include <openspace/navigation/orbitalnavigator.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/rendering/screenspacerenderable.h>
#include <ghoul/logging/logmanager.h>
#include <sstream>
#include <string>
using namespace TUIO;

View File

@@ -99,6 +99,25 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
target_compile_options(libcef_dll_wrapper PRIVATE "-w")
endif ()
target_precompile_headers(libcef_dll_wrapper PRIVATE
[["include/cef_client.h"]]
[["include/capi/cef_browser_capi.h"]]
[["include/capi/cef_client_capi.h"]]
[["include/cef_client.h"]]
[["include/capi/cef_base_capi.h"]]
[["include/cef_render_handler.h"]]
<string>
<sstream>
<istream>
<ostream>
)
if (WIN32)
target_precompile_headers(libcef_dll_wrapper PRIVATE
<Windows.h>
)
endif ()
##########################################################################################
# Add CEF client files
@@ -241,10 +260,15 @@ create_new_module(
${HEADER_FILES} ${SOURCE_FILES}
)
target_precompile_headers(${webbrowser_module} PRIVATE
<include/cef_browser.h>
<include/cef_client.h>
<include/wrapper/cef_helpers.h>
)
set_folder_location(libcef_dll_wrapper "Helper")
set_folder_location(openspace_web_helper "Helper")
# Display CEF configuration settings.
# PRINT_CEF_CONFIG()