Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Adds precompiled headers for MSVC to speed up compiling. #200

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions plugins/AngleMeasure/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/ArchaeoLines/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/EquationOfTime/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
1 change: 1 addition & 0 deletions plugins/Exoplanets/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/FOV/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/MeteorShowers/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/NavStars/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/Novae/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/Observability/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/Oculars/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
1 change: 1 addition & 0 deletions plugins/PointerCoordinates/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/Pulsars/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/Quasars/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/RemoteControl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/RemoteSync/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/Satellites/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/Scenery3d/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 2 additions & 0 deletions plugins/SolarSystemEditor/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
1 change: 1 addition & 0 deletions plugins/Supernovae/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ IF(ENABLE_SPOUT)
external/SpoutLibrary.h
core/SpoutSender.hpp
core/SpoutSender.cpp
)
)
ENDIF()

SET(stellarium_lib_SRCS
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -473,6 +474,8 @@ ELSE()
ENDIF()
ENDIF()

ADD_PRECOMPILED_HEADER(stelMain "core/StelPch.hpp" "core/StelApp.cpp")

ADD_DEPENDENCIES(stellarium AllStaticPlugins)

# Adding manifest
Expand Down
30 changes: 30 additions & 0 deletions src/core/StelPch.hpp
Original file line number Diff line number Diff line change
@@ -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 <QDebug>
#include <QObject>
#include <QString>

#endif // _STELPCH_HPP_