From 02581bf1f124029a1c0b20ce3c36cfcc4adc2616 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Thu, 6 Aug 2009 04:35:35 +0000 Subject: [PATCH] Add a new option --enable-gcc-prec which will enable the use of gcc precompiled headers, this speeds up the build time (including one time builds) by several oders of magnitude. closes #975 Originally committed to SVN as r3369. --- aegisub/configure.in | 10 ++++++++++ aegisub/src/Makefile.am | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/aegisub/configure.in b/aegisub/configure.in index 393ad689d..c483196c0 100644 --- a/aegisub/configure.in +++ b/aegisub/configure.in @@ -856,6 +856,16 @@ if test "$with_agi_cv_wxstc" = "no" || test "$enable_check_wx_stc:" = "yes"; the fi +############################ +# Precompiled Header Support +# Only works with gcc! +############################ + +AC_MSG_CHECKING([whether to use precompiled headers]) +AC_ARG_ENABLE(gcc-prec, [ --enable-gcc-prec enable GCC precompiled headers (default=no)]) +AM_CONDITIONAL([PRECOMPILED_HEADER], [test "$enable_gcc_prec" = "yes"]) + + ###################################################### # Debugging support # This is added last so it doesn't slow down configure diff --git a/aegisub/src/Makefile.am b/aegisub/src/Makefile.am index 58cee4ae6..f6403dc02 100644 --- a/aegisub/src/Makefile.am +++ b/aegisub/src/Makefile.am @@ -1,6 +1,7 @@ AUTOMAKE_OPTIONS = foreign SUFFIXES = .c .cpp .rc noinst_LIBRARIES= +AM_CXXFLAGS = if BUILD_DARWIN libosxutil_subdir = libosxutil @@ -8,12 +9,19 @@ libosxutil_lib = libosxutil/libosxutil.a libosxutil_ldflags = -framework CoreFoundation endif +if PRECOMPILED_HEADER +BUILT_SOURCES = stdwx.h.gch +precompiled_header = stdwx.h +AM_CXXFLAGS += -Winvalid-pch -fpch-deps -fpch-preprocess -include stdwx.h +nodist_aegisub_2_2_SOURCES = stdwx.h.gch +endif + SUBDIRS = \ bitmaps \ libresrc \ $(libosxutil_subdir) -AM_CXXFLAGS = -DAEGISUB -Iinclude -I../libffms/include @WX_CPPFLAGS@ @OPENMP_CXXFLAGS@ @LIBAVFORMAT_CFLAGS@ @LIBAVCODEC_CFLAGS@ @LIBSWSCALE_CFLAGS@ @LIBAVUTIL_CFLAGS@ +AM_CXXFLAGS += -DAEGISUB -Iinclude -I../libffms/include @WX_CPPFLAGS@ @OPENMP_CXXFLAGS@ @LIBAVFORMAT_CFLAGS@ @LIBAVCODEC_CFLAGS@ @LIBSWSCALE_CFLAGS@ @LIBAVUTIL_CFLAGS@ bin_PROGRAMS = aegisub-2.2 aegisub_2_2_LDADD = libresrc/libresrc.a $(libosxutil_lib) @@ -21,6 +29,12 @@ aegisub_2_2_CPPFLAGS = @FREETYPE_CFLAGS@ aegisub_2_2_LDFLAGS = @DEBUG_FLAGS@ @PROFILE_FLAGS@ @GL_LIBS@ @PTHREAD_LIBS@ @WX_LIBS@ @ICONV_LDFLAGS@ $(libosxutil_ldflags) @CCMALLOC_LDFLAGS@ @EFENCE_LDFLAGS@ LIBS += @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @CCMALLOC_LIBS@ +if PRECOMPILED_HEADER +# This doesn't depend on Makefile on purpose, you should already know what you're doing when using this. +stdwx.h.gch: stdwx.h + @CXX@ -include ../acconf.h $(DEFAULT_INCLUDES) @CXXFLAGS@ $(AM_CXXFLAGS) @DEBUG_FLAGS@ @PROFILE_FLAGS@ stdwx.h +endif + if BUILD_DARWIN aegisub_2_2_LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries endif @@ -132,6 +146,7 @@ endif ## These aren't built, but are listed here so 'make dist' can always find all the sources ## This should also list all Win32 specific files EXTRA_aegisub_2_2_SOURCES = \ + $(precompiled_header) \ font_file_lister.cpp \ $(FONT_LISTER) \ audio_player_dsound.cpp \