diff --git a/CMakeLists.txt b/CMakeLists.txt index a686e36ce7..5980081e7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,13 +23,42 @@ add_definitions(-DLIBS_DIR="${plugindir}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries/plugins) +# Precompiled header support for MSVC: +# Call this after setting the source list (and don't add the source file used to generate the pch file, this will be done here automatically) +function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_FILE SOURCE_VARIABLE_NAME) + if(MSVC) + set(files ${${SOURCE_VARIABLE_NAME}}) + + # Generate precompiled header translation unit + get_filename_component(pch_basename ${PRECOMPILED_HEADER} NAME_WE) + set(pch_abs ${CMAKE_CURRENT_SOURCE_DIR}/${PRECOMPILED_HEADER}) + set(pch_unity ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) + set_source_files_properties(${pch_unity} PROPERTIES COMPILE_FLAGS "/Yc\"${pch_abs}\"") + + # Update properties of source files to use the precompiled header. + # Additionally, force the inclusion of the precompiled header at beginning of each source file. + foreach(source_file ${files} ) + set_source_files_properties(${source_file} PROPERTIES COMPILE_FLAGS "/Yu\"${pch_abs}\" /FI\"${pch_abs}\"") + endforeach(source_file) + + # Finally, update the source file collection to contain the precompiled header translation unit + set(${SOURCE_VARIABLE_NAME} ${pch_unity} ${${SOURCE_VARIABLE_NAME}} PARENT_SCOPE) + endif(MSVC) +endfunction(enable_precompiled_headers) + + include(FindSubversion OPTIONAL) # for revision info if(Subversion_FOUND AND NOT DOLPHIN_WC_REVISION) Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} DOLPHIN) # defines DOLPHIN_WC_REVISION endif() # Various compile flags -add_definitions(-msse2 -Wall) +add_definitions(-msse2) + +# Enabling all warnings in MSVC spams too much +if(NOT MSVC) + add_definitions(-Wall) +endif(NOT MSVC) # gcc uses some optimizations which might break stuff without this flag add_definitions(-fno-strict-aliasing -fno-exceptions) @@ -61,8 +90,6 @@ if(WIN32) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) endif(WIN32) -add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE) - if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (Release/Debug/RelWithDebInfo/MinSizeRe)" FORCE) @@ -362,6 +389,8 @@ file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/Src/svnrev.h include_directories("${PROJECT_BINARY_DIR}/Source/Core/Common/Src") +add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE) + ######################################## # Start compiling our code # diff --git a/Externals/wxWidgets/CMakeLists.txt b/Externals/wxWidgets/CMakeLists.txt index e7924a79e4..c7459cae29 100644 --- a/Externals/wxWidgets/CMakeLists.txt +++ b/Externals/wxWidgets/CMakeLists.txt @@ -1,7 +1,6 @@ # wxAdv28 set(SRCS src/common/accesscmn.cpp src/common/datavcmn.cpp - src/common/dummy.cpp src/common/taskbarcmn.cpp src/generic/aboutdlgg.cpp src/generic/animateg.cpp @@ -26,6 +25,7 @@ set(SRCS src/common/accesscmn.cpp src/msw/joystick.cpp src/msw/sound.cpp src/msw/taskbar.cpp) +enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS) add_library(wxAdv28 STATIC ${SRCS}) @@ -35,8 +35,8 @@ set(SRCS src/aui/auibar.cpp src/aui/dockart.cpp src/aui/floatpane.cpp src/aui/framemanager.cpp - src/aui/tabmdi.cpp - src/common/dummy.cpp) + src/aui/tabmdi.cpp) +enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS) add_library(wxAui STATIC ${SRCS}) @@ -52,7 +52,6 @@ set(SRCS src/common/appbase.cpp src/common/datetime.cpp src/common/datstrm.cpp src/common/dircmn.cpp - src/common/dummy.cpp src/common/dynarray.cpp src/common/dynlib.cpp src/common/dynload.cpp @@ -130,6 +129,7 @@ set(SRCS src/common/appbase.cpp src/msw/utils.cpp src/msw/utilsexc.cpp src/msw/volume.cpp) +enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS) add_library(wxBase28 STATIC ${SRCS}) @@ -163,7 +163,6 @@ set(SRCS src/common/accesscmn.cpp src/common/docview.cpp src/common/dpycmn.cpp src/common/dseldlg.cpp - src/common/dummy.cpp src/common/effects.cpp src/common/event.cpp src/common/evtloopcmn.cpp @@ -374,8 +373,11 @@ set(SRCS src/common/accesscmn.cpp src/msw/ole/dropsrc.cpp src/msw/ole/droptgt.cpp src/msw/ole/oleutils.cpp - src/msw/ole/uuid.cpp - src/png/png.c + src/msw/ole/uuid.cpp) +enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS) + +# These shouldn't link against the precompiled header +set(SRCS ${SRCS} src/png/png.c src/png/pngerror.c src/png/pnggccrd.c src/png/pngget.c @@ -393,4 +395,6 @@ set(SRCS src/common/accesscmn.cpp src/png/pngwrite.c src/png/pngwtran.c src/png/pngwutil.c) + + add_library(wxCore28 STATIC ${SRCS}) diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 915110ded5..ae22004e9c 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -30,17 +30,19 @@ set(SRCS Src/ABI.cpp Src/Version.cpp Src/x64Analyzer.cpp Src/x64Emitter.cpp - Src/Crypto/aes_cbc.c - Src/Crypto/aes_core.c + Src/Crypto/aes_cbc.cpp + Src/Crypto/aes_core.cpp Src/Crypto/bn.cpp Src/Crypto/ec.cpp Src/Crypto/md5.cpp Src/Crypto/sha1.cpp) if(WIN32) - set(SRCS ${SRCS} Src/ExtendedTrace.cpp Src/stdafx.cpp) + set(SRCS ${SRCS} Src/ExtendedTrace.cpp) endif(WIN32) +enable_precompiled_headers(Src/stdafx.h Src/stdafx.cpp SRCS) + add_library(common STATIC ${SRCS}) target_link_libraries(common ${CMAKE_DL_LIBS}) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj index b21c8c61bc..1b2b05a32b 100644 --- a/Source/Core/Common/Common.vcproj +++ b/Source/Core/Common/Common.vcproj @@ -537,120 +537,12 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -