diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d7fb54ebc990..9d886cfb581a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,28 @@ IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") ADD_DEFINITIONS(-DQT_NO_DEBUG -DNDEBUG) ENDIF() +FUNCTION(ADD_PRECOMPILED_HEADER _targetName _precompiledHeader _precompiledSource) + IF(MSVC) + GET_FILENAME_COMPONENT(_precompiledBaseName ${_precompiledHeader} NAME_WE) + SET(_pchOutput "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${_precompiledBaseName}.pch") + + GET_TARGET_PROPERTY(_sourceFiles ${_targetName} SOURCES) + FOREACH(_item ${_sourceFiles}) + GET_FILENAME_COMPONENT(_extName ${_item} EXT) + IF(_extName STREQUAL ".cpp") + IF(_item STREQUAL ${_precompiledSource}) + SET(_compileFlags "/Yc\"${_precompiledHeader}\"") + SET_SOURCE_FILES_PROPERTIES(${_item} PROPERTIES OBJECT_OUTPUTS "${_pchOutput}") + ELSE() + SET(_compileFlags "/Yu\"${_precompiledHeader}\"") + SET_SOURCE_FILES_PROPERTIES(${_item} PROPERTIES OBJECT_DEPENDS "${_pchOutput}") + ENDIF() + SET_SOURCE_FILES_PROPERTIES(${_item} PROPERTIES COMPILE_FLAGS "${_compileFlags} /Fp\"${_pchOutput}\" /FI\"${_precompiledHeader}\"") + ENDIF() + ENDFOREACH() + ENDIF() +ENDFUNCTION() + SET(OPENGL_DEBUG_LOGGING 0 CACHE BOOL "Enable to log OpenGL information using the GL_KHR_debug extension/QOpenGLLogger") IF(OPENGL_DEBUG_LOGGING) ADD_DEFINITIONS(-DOPENGL_DEBUG_LOGGING) diff --git a/plugins/AngleMeasure/src/CMakeLists.txt b/plugins/AngleMeasure/src/CMakeLists.txt index c93ce702a90b7..1e0217d6f320a 100644 --- a/plugins/AngleMeasure/src/CMakeLists.txt +++ b/plugins/AngleMeasure/src/CMakeLists.txt @@ -26,3 +26,5 @@ SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES COMPILE_FLAGS "-DQT_STATICP ADD_DEPENDENCIES(AllStaticPlugins AngleMeasure-static) SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES FOLDER "plugins/AngleMeasure") + +ADD_PRECOMPILED_HEADER(AngleMeasure-static "AngleMeasure.hpp" "AngleMeasure.cpp") diff --git a/plugins/ArchaeoLines/src/CMakeLists.txt b/plugins/ArchaeoLines/src/CMakeLists.txt index 4591a38203c06..9cc4a89dc7093 100644 --- a/plugins/ArchaeoLines/src/CMakeLists.txt +++ b/plugins/ArchaeoLines/src/CMakeLists.txt @@ -26,3 +26,5 @@ SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES COMPILE_FLAGS "-DQT_STATICP ADD_DEPENDENCIES(AllStaticPlugins ArchaeoLines-static) SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES FOLDER "plugins/ArchaeoLines") + +ADD_PRECOMPILED_HEADER(ArchaeoLines-static "ArchaeoLines.hpp" "ArchaeoLines.cpp") diff --git a/plugins/EquationOfTime/src/CMakeLists.txt b/plugins/EquationOfTime/src/CMakeLists.txt index 15d329d34b3e7..82635a05568c2 100644 --- a/plugins/EquationOfTime/src/CMakeLists.txt +++ b/plugins/EquationOfTime/src/CMakeLists.txt @@ -32,3 +32,5 @@ SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATI ADD_DEPENDENCIES(AllStaticPlugins EquationOfTime-static) SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES FOLDER "plugins/EquationOfTime") + +ADD_PRECOMPILED_HEADER(EquationOfTime-static "EquationOfTime.hpp" "EquationOfTime.cpp") diff --git a/plugins/Exoplanets/src/CMakeLists.txt b/plugins/Exoplanets/src/CMakeLists.txt index 3d7f5d1095a86..e51110de9b163 100644 --- a/plugins/Exoplanets/src/CMakeLists.txt +++ b/plugins/Exoplanets/src/CMakeLists.txt @@ -32,3 +32,4 @@ ADD_DEPENDENCIES(AllStaticPlugins Exoplanets-static) SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES FOLDER "plugins/Exoplanets") +ADD_PRECOMPILED_HEADER(Exoplanets-static "Exoplanets.hpp" "Exoplanets.cpp") diff --git a/plugins/FOV/src/CMakeLists.txt b/plugins/FOV/src/CMakeLists.txt index ac8008c331bb7..ba3c3961108a5 100644 --- a/plugins/FOV/src/CMakeLists.txt +++ b/plugins/FOV/src/CMakeLists.txt @@ -29,3 +29,5 @@ SET_TARGET_PROPERTIES(FOV-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") ADD_DEPENDENCIES(AllStaticPlugins FOV-static) SET_TARGET_PROPERTIES(FOV-static PROPERTIES FOLDER "plugins/FOV") + +ADD_PRECOMPILED_HEADER(FOV-static "FOV.hpp" "FOV.cpp") diff --git a/plugins/MeteorShowers/src/CMakeLists.txt b/plugins/MeteorShowers/src/CMakeLists.txt index 61d0a3479d26f..cffe903553c01 100644 --- a/plugins/MeteorShowers/src/CMakeLists.txt +++ b/plugins/MeteorShowers/src/CMakeLists.txt @@ -40,3 +40,5 @@ SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES COMPILE_FLAGS "-DQT_STATIC ADD_DEPENDENCIES(AllStaticPlugins MeteorShowers-static) SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES FOLDER "plugins/MeteorShowers") + +ADD_PRECOMPILED_HEADER(MeteorShowers-static "MeteorShowers.hpp" "MeteorShowers.cpp") diff --git a/plugins/NavStars/src/CMakeLists.txt b/plugins/NavStars/src/CMakeLists.txt index 099a52ee4a4d7..8678602815867 100644 --- a/plugins/NavStars/src/CMakeLists.txt +++ b/plugins/NavStars/src/CMakeLists.txt @@ -30,3 +30,5 @@ SET_TARGET_PROPERTIES(NavStars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGI ADD_DEPENDENCIES(AllStaticPlugins NavStars-static) SET_TARGET_PROPERTIES(NavStars-static PROPERTIES FOLDER "plugins/NavStars") + +ADD_PRECOMPILED_HEADER(NavStars-static "NavStars.hpp" "NavStars.cpp") diff --git a/plugins/Novae/src/CMakeLists.txt b/plugins/Novae/src/CMakeLists.txt index 6ba08d36875cd..cfce5c15f997d 100644 --- a/plugins/Novae/src/CMakeLists.txt +++ b/plugins/Novae/src/CMakeLists.txt @@ -32,3 +32,5 @@ SET_TARGET_PROPERTIES(Novae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") ADD_DEPENDENCIES(AllStaticPlugins Novae-static) SET_TARGET_PROPERTIES(Novae-static PROPERTIES FOLDER "plugins/Novae") + +ADD_PRECOMPILED_HEADER(Novae-static "Novae.hpp" "Novae.cpp") diff --git a/plugins/Observability/src/CMakeLists.txt b/plugins/Observability/src/CMakeLists.txt index 063ee41d9f7ab..7e0fa7b9fe442 100644 --- a/plugins/Observability/src/CMakeLists.txt +++ b/plugins/Observability/src/CMakeLists.txt @@ -32,3 +32,5 @@ SET_TARGET_PROPERTIES(Observability-static PROPERTIES COMPILE_FLAGS "-DQT_STATIC ADD_DEPENDENCIES(AllStaticPlugins Observability-static) SET_TARGET_PROPERTIES(Observability-static PROPERTIES FOLDER "plugins/Observability") + +ADD_PRECOMPILED_HEADER(Observability-static "Observability.hpp" "Observability.cpp") diff --git a/plugins/Oculars/src/CMakeLists.txt b/plugins/Oculars/src/CMakeLists.txt index 3bc87f648af10..0dc069618dbbf 100644 --- a/plugins/Oculars/src/CMakeLists.txt +++ b/plugins/Oculars/src/CMakeLists.txt @@ -41,3 +41,5 @@ SET_TARGET_PROPERTIES(Oculars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN ADD_DEPENDENCIES(AllStaticPlugins Oculars-static) SET_TARGET_PROPERTIES(Oculars-static PROPERTIES FOLDER "plugins/Oculars") + +ADD_PRECOMPILED_HEADER(Oculars-static "Oculars.hpp" "Oculars.cpp") diff --git a/plugins/PointerCoordinates/src/CMakeLists.txt b/plugins/PointerCoordinates/src/CMakeLists.txt index 9ad0af1d56ca9..fed5f88cc9b74 100644 --- a/plugins/PointerCoordinates/src/CMakeLists.txt +++ b/plugins/PointerCoordinates/src/CMakeLists.txt @@ -33,3 +33,4 @@ ADD_DEPENDENCIES(AllStaticPlugins PointerCoordinates-static) SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES FOLDER "plugins/PointerCoordinates") +ADD_PRECOMPILED_HEADER(PointerCoordinates-static "PointerCoordinates.hpp" "PointerCoordinates.cpp") diff --git a/plugins/Pulsars/src/CMakeLists.txt b/plugins/Pulsars/src/CMakeLists.txt index dbbe8c9287d90..df7eeebbb1b47 100644 --- a/plugins/Pulsars/src/CMakeLists.txt +++ b/plugins/Pulsars/src/CMakeLists.txt @@ -32,3 +32,5 @@ SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN ADD_DEPENDENCIES(AllStaticPlugins Pulsars-static) SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES FOLDER "plugins/Pulsars") + +ADD_PRECOMPILED_HEADER(Pulsars-static "Pulsars.hpp" "Pulsars.cpp") diff --git a/plugins/Quasars/src/CMakeLists.txt b/plugins/Quasars/src/CMakeLists.txt index 2b387340b1019..2ca795e167eb0 100644 --- a/plugins/Quasars/src/CMakeLists.txt +++ b/plugins/Quasars/src/CMakeLists.txt @@ -32,3 +32,5 @@ SET_TARGET_PROPERTIES(Quasars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN ADD_DEPENDENCIES(AllStaticPlugins Quasars-static) SET_TARGET_PROPERTIES(Quasars-static PROPERTIES FOLDER "plugins/Quasars") + +ADD_PRECOMPILED_HEADER(Quasars-static "Quasars.hpp" "Quasars.cpp") diff --git a/plugins/RemoteControl/src/CMakeLists.txt b/plugins/RemoteControl/src/CMakeLists.txt index 0a42b295fc38d..ec6d53257b9c9 100644 --- a/plugins/RemoteControl/src/CMakeLists.txt +++ b/plugins/RemoteControl/src/CMakeLists.txt @@ -77,3 +77,5 @@ SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATIC ADD_DEPENDENCIES(AllStaticPlugins RemoteControl-static) SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES FOLDER "plugins/RemoteControl") + +ADD_PRECOMPILED_HEADER(RemoteControl-static "RemoteControl.hpp" "RemoteControl.cpp") diff --git a/plugins/RemoteSync/src/CMakeLists.txt b/plugins/RemoteSync/src/CMakeLists.txt index 7b708ceb3f427..d0d847bf709ba 100644 --- a/plugins/RemoteSync/src/CMakeLists.txt +++ b/plugins/RemoteSync/src/CMakeLists.txt @@ -40,3 +40,5 @@ SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLU ADD_DEPENDENCIES(AllStaticPlugins RemoteSync-static) SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES FOLDER "plugins/RemoteSync") + +ADD_PRECOMPILED_HEADER(RemoteSync-static "RemoteSync.hpp" "RemoteSync.cpp") diff --git a/plugins/Satellites/src/CMakeLists.txt b/plugins/Satellites/src/CMakeLists.txt index d3cd5c1827768..1a92c4aacfe88 100644 --- a/plugins/Satellites/src/CMakeLists.txt +++ b/plugins/Satellites/src/CMakeLists.txt @@ -62,3 +62,5 @@ ENDIF() ADD_DEPENDENCIES(AllStaticPlugins Satellites-static) SET_TARGET_PROPERTIES(Satellites-static PROPERTIES FOLDER "plugins/Satellites") + +ADD_PRECOMPILED_HEADER(Satellites-static "Satellites.hpp" "Satellites.cpp") diff --git a/plugins/Scenery3d/src/CMakeLists.txt b/plugins/Scenery3d/src/CMakeLists.txt index 348942865dc9e..47eab56ef32f2 100644 --- a/plugins/Scenery3d/src/CMakeLists.txt +++ b/plugins/Scenery3d/src/CMakeLists.txt @@ -66,3 +66,5 @@ SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUG ADD_DEPENDENCIES(AllStaticPlugins Scenery3d-static) SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES FOLDER "plugins/Scenery3d") + +ADD_PRECOMPILED_HEADER(Scenery3d-static "Scenery3d.hpp" "Scenery3d.cpp") diff --git a/plugins/SolarSystemEditor/src/CMakeLists.txt b/plugins/SolarSystemEditor/src/CMakeLists.txt index 8c9a5100a29e8..21e59b244be96 100644 --- a/plugins/SolarSystemEditor/src/CMakeLists.txt +++ b/plugins/SolarSystemEditor/src/CMakeLists.txt @@ -35,3 +35,5 @@ SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES COMPILE_FLAGS "-DQT_ST ADD_DEPENDENCIES(AllStaticPlugins SolarSystemEditor-static) SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES FOLDER "plugins/SolarSystemEditor") + +ADD_PRECOMPILED_HEADER(SolarSystemEditor-static "SolarSystemEditor.hpp" "SolarSystemEditor.cpp") diff --git a/plugins/Supernovae/src/CMakeLists.txt b/plugins/Supernovae/src/CMakeLists.txt index 99d030b79eaff..6a002ab089286 100644 --- a/plugins/Supernovae/src/CMakeLists.txt +++ b/plugins/Supernovae/src/CMakeLists.txt @@ -33,3 +33,4 @@ ADD_DEPENDENCIES(AllStaticPlugins Supernovae-static) SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES FOLDER "plugins/Supernovae") +ADD_PRECOMPILED_HEADER(Supernovae-static "Supernovae.hpp" "Supernovae.cpp") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a99d956466f13..96e9d0dc12e8f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ IF(ENABLE_SPOUT) external/SpoutLibrary.h core/SpoutSender.hpp core/SpoutSender.cpp - ) + ) ENDIF() SET(stellarium_lib_SRCS @@ -65,6 +65,7 @@ SET(stellarium_lib_SRCS core/StelObjectType.hpp core/StelOpenGL.cpp core/StelOpenGL.hpp + core/StelPch.hpp core/StelPluginInterface.hpp core/StelRegionObject.hpp core/StelSkyCultureMgr.cpp @@ -473,6 +474,8 @@ ELSE() ENDIF() ENDIF() +ADD_PRECOMPILED_HEADER(stelMain "core/StelPch.hpp" "core/StelApp.cpp") + ADD_DEPENDENCIES(stellarium AllStaticPlugins) # Adding manifest diff --git a/src/core/StelPch.hpp b/src/core/StelPch.hpp new file mode 100644 index 0000000000000..55cbdf506f05a --- /dev/null +++ b/src/core/StelPch.hpp @@ -0,0 +1,30 @@ +/* + * Stellarium + * Copyright (C) 2018 Minmin Gong + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. + */ + +#ifndef _STELPCH_HPP_ +#define _STELPCH_HPP_ + +#include "StelApp.hpp" +#include "StelCore.hpp" + +#include +#include +#include + +#endif // _STELPCH_HPP_