Merge r3369 and r3451 (partial) to get precompiled header support in unix, and exception handling when in debug mode.

Originally committed to SVN as r3753.
This commit is contained in:
Amar Takhar 2009-10-31 02:27:13 +00:00
parent 1b2efdc51e
commit eba0fdf866
4 changed files with 46 additions and 5 deletions

View File

@ -1066,6 +1066,21 @@ 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)])
if test "$enable_gcc_prec" = "yes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL([PRECOMPILED_HEADER], [test "$enable_gcc_prec" = "yes"])
######################################################
# Debugging support
# This is added last so it doesn't slow down configure
@ -1102,6 +1117,17 @@ fi
AC_SUBST(PACKAGE_DEBUG)
AC_MSG_CHECKING([whether to use exception handling in debug mode])
AC_ARG_ENABLE(debug-exceptions, [ --enable-debug-exceptions
enable exception handling in debug mode (default=no)])
if test "$enable_debug_exceptions" = "yes"; then
AC_DEFINE(WITH_EXCEPTIONS, 1, [Enable exception handling in debug mode. (--enable-debug) This is always enabled when debug mode is off.])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
###########
# Profiling
###########

View File

@ -1,6 +1,7 @@
AUTOMAKE_OPTIONS = foreign
SUFFIXES = .c .cpp .rc
noinst_LIBRARIES=
AM_CXXFLAGS =
if BUILD_DARWIN
libosxutil_subdir = libosxutil
@ -12,13 +13,20 @@ if HAVE_AUTO3_LUA
libauto3 = libauto3
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_1_SOURCES = stdwx.h.gch
endif
SUBDIRS = \
bitmaps \
libresrc \
$(libauto3) \
$(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.1
aegisub_2_1_LDADD = libresrc/libresrc.a $(libosxutil_lib)
@ -26,6 +34,12 @@ aegisub_2_1_CPPFLAGS = @FREETYPE_CFLAGS@
aegisub_2_1_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_1_LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries
endif
@ -178,6 +192,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_1_SOURCES = \
$(precompiled_header) \
font_file_lister.cpp \
$(FONT_LISTER) \
audio_player_dsound.cpp \

View File

@ -138,7 +138,7 @@ bool AegisubApp::OnInit() {
#endif
// Crash handling
#ifndef _DEBUG
#if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
StartupLog(_T("Install exception handler"));
wxHandleFatalExceptions(true);
#endif
@ -205,7 +205,7 @@ bool AegisubApp::OnInit() {
AssExportFilterChain::PrepareFilters();
// Set association
#ifndef _DEBUG
#if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
StartupLog(_T("Install file type associations"));
if (!Options.AsBool(_T("Local config")))
RegistryAssociate();
@ -253,7 +253,7 @@ int AegisubApp::OnExit() {
}
#ifndef _DEBUG
#if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
/////////////////////////////////////////////
// Message displayed on unhandled exceptions
const static wxChar unhandled_exception_message[] = _T("Oops, Aegisub has crashed!\n\nI have tried to emergency-save a copy of your file, and a crash log file has been generated.\n\nYou can find the emergency-saved file in:\n%s\n\nIf you submit the crash log to the Aegisub team, we will investigate the problem and attempt to fix it. You can find the crashlog in:\n%s\n\nAegisub will now close.");

View File

@ -86,7 +86,7 @@ public:
virtual void MacOpenFile(const wxString &filename);
#endif
#ifndef _DEBUG
#if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
void OnUnhandledException();
void OnFatalException();
#endif