summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-05-24 21:54:15 -0400
committerAdam <Adam@anope.org>2012-05-24 21:54:15 -0400
commit38d5f20deba313355943883b7b539a82f7a701ee (patch)
treeacf8a422c82d760d666a5aa35abec90a17cc7905
parent70fb5900a2cc8eb00d1d25b39bd137488e845338 (diff)
Added a ./Config option for using precompiled headers
-rw-r--r--CMakeLists.txt1
-rwxr-xr-xConfig31
-rw-r--r--include/CMakeLists.txt4
3 files changed, 32 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 737754006..a1a5c9b6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -218,6 +218,7 @@ find_package(Gettext)
# Add an optional variable for using run-cc.pl for building, Perl will be checked later regardless of this setting
option(USE_RUN_CC_PL "Use run-cc.pl for building" OFF)
+option(USE_PCH "Use precompiled headers" OFF)
# Use the following directories as includes
# Note that it is important the binary include directory comes before the
diff --git a/Config b/Config
index 664aaba17..495cbe388 100755
--- a/Config
+++ b/Config
@@ -67,6 +67,12 @@ Run_Build_System () {
RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=OFF"
fi
+ if [ "$USE_PCH" = "yes" ] ; then
+ PCH="-DUSE_PCH:BOOLEAN=ON"
+ else
+ PCH="-DUSE_PCH:BOOLEAN=OFF"
+ fi
+
case `uname -s` in
MINGW*)
GEN_TYPE="-G\"MSYS Makefiles\""
@@ -82,9 +88,9 @@ Run_Build_System () {
REAL_SOURCE_DIR="$SOURCE_DIR"
fi
- echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
+ echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $PCH $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
- cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
+ cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $PCH $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
echo ""
if [ "$SOURCE_DIR" = "." ] ; then
@@ -117,6 +123,7 @@ RUNGROUP=
UMASK=
DEBUG="yes"
USE_RUN_CC_PL="no"
+USE_PCH="no"
EXTRA_CONFIG_ARGS=
CAN_QUICK="no"
SOURCE_DIR=`dirname $0`
@@ -360,6 +367,25 @@ echo ""
####
+TEMP_YN="n"
+if [ "$USE_PCH" = "yes" ] ; then
+ TEMP_YN="y"
+fi
+echo "Do you want to build using precompiled headers? This can speed up"
+echo "the build, but uses more disk space."
+echo2 "[$TEMP_YN] "
+read YN
+if [ "$YN" ] ; then
+ if [ "$YN" = "y" ] ; then
+ USE_PCH="yes"
+ else
+ USE_PCH="no"
+ fi
+fi
+echo ""
+
+####
+
echo "Are there any extra arguments you wish to pass to cmake?"
echo "You may only need to do this if cmake is unable to locate"
echo "missing dependencies without hints."
@@ -385,6 +411,7 @@ RUNGROUP="$RUNGROUP"
UMASK=$UMASK
DEBUG="$DEBUG"
USE_RUN_CC_PL="$USE_RUN_CC_PL"
+USE_PCH="$USE_PCH"
EXTRA_CONFIG_ARGS="$EXTRA_CONFIG_ARGS"
EOT
echo "done."
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index f7e653a8a..6170cde27 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -18,7 +18,7 @@ if(NOT WIN32)
endif(NOT WIN32)
set(PCH_SOURCES_GCH "")
-if(CMAKE_COMPILER_IS_GNUCXX)
+if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
string(REPLACE " " ";" PCH_CXXFLAGS "${CXXFLAGS} ${CMAKE_CXX_FLAGS}")
file(GLOB PCH_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
@@ -57,7 +57,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
DEPENDS ${INCLUDES_LIST} VERBATIM
)
endforeach(PCH_SOURCE ${PCH_SOURCES})
-endif(CMAKE_COMPILER_IS_GNUCXX)
+endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
# Add a custom target to the above file
add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})