From fa04c1479eca3d27e6c3ee1fbe3505c6c140e061 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Tue, 24 Jan 2017 01:37:34 +0100 Subject: [PATCH 1/8] cmake: Remove PCH support Compilers are very picky and don't use PCH when they have been compiled with different flags. I even got some ICE in MSVC, so removing them for now. Modules are the solution. --- CMakeLists.txt | 29 ------------------- Externals/wxWidgets3/CMakeLists.txt | 1 - Source/Android/app/build.gradle | 2 +- Source/CMakeLists.txt | 43 ----------------------------- 4 files changed, 1 insertion(+), 74 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fd09dbe8b..c80e059c74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ option(USE_SHARED_GTEST "Use shared gtest library if found" OFF) option(USE_UPNP "Enables UPnP port mapping support" ON) option(DISABLE_WX "Disable wxWidgets (use Qt or CLI interface)" OFF) option(ENABLE_QT2 "Enable Qt2 (use the other experimental Qt interface)" OFF) -option(ENABLE_PCH "Use PCH to speed up compilation" ON) option(ENABLE_LTO "Enables Link Time Optimization" OFF) option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF) option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF) @@ -122,34 +121,6 @@ endif() # as defined above. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries) -# 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) - # setup CCache include(CCache) diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 1f09e3318e..0783b91934 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -890,6 +890,5 @@ add_definitions(-DWXBUILDING) # wxWidgets warnings are not our problem. add_definitions(-w) -#enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS) add_library(wx STATIC ${PNG_SRCS} ${SRCS}) target_link_libraries(wx ${LIBS}) diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index f82df2b1d5..359065102c 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -65,7 +65,7 @@ android { defaultConfig { externalNativeBuild { cmake { - arguments "-DANDROID_STL=c++_static", "-DCMAKE_BUILD_TYPE=RelWithDebInfo", "-DENABLE_PCH=OFF" // , "-DENABLE_GENERIC=ON" + arguments "-DANDROID_STL=c++_static", "-DCMAKE_BUILD_TYPE=RelWithDebInfo" // , "-DENABLE_GENERIC=ON" abiFilters "arm64-v8a" //, "armeabi-v7a", "x86_64", "x86" } } diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 46f2a9c9cc..a13a96d70b 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -8,52 +8,9 @@ endif() add_definitions(-D__STDC_LIMIT_MACROS) add_definitions(-D__STDC_CONSTANT_MACROS) -set(CMAKE_FAKELANG_CREATE_STATIC_LIBRARY "touch ") -if(ENABLE_PCH) - # This is actually a .h file, but trick cmake into compiling it as a source file - set(pch_out_filename "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/pch.dir/pch.h") - if (ANDROID) - set(pch_lib_filename "${LIBRARY_OUTPUT_PATH}/libpch.a") - else() - set(pch_lib_filename "${CMAKE_CURRENT_BINARY_DIR}/libpch.a") - endif() - set(pch_src_filename "${CMAKE_CURRENT_SOURCE_DIR}/PCH/pch.h") - - if(APPLE) - set(type objective-c++-header) - else() - set(type c++-header) - endif() - - set_source_files_properties( - PCH/pch.h PROPERTIES - COMPILE_FLAGS "-x ${type}" - HEADER_FILE_ONLY 0 - LANGUAGE CXX) - - add_library(pch STATIC PCH/pch.h) - - add_custom_command( - TARGET pch - PRE_LINK - COMMAND ln -fs "${pch_out_filename}.o" "${pch_out_filename}.gch" - COMMAND ln -fs "${pch_out_filename}.o" "${pch_out_filename}.pch" - COMMAND cp "${pch_src_filename}" "${pch_out_filename}") - - set_target_properties( - pch PROPERTIES - LINKER_LANGUAGE FAKELANG) -endif(ENABLE_PCH) macro(add_dolphin_library lib srcs libs) add_library(${lib} STATIC ${srcs}) target_link_libraries(${lib} ${libs}) - if(ENABLE_PCH) - add_dependencies(${lib} pch) - set_source_files_properties( - ${srcs} PROPERTIES - COMPILE_FLAGS "-include '${pch_out_filename}'" - OBJECT_DEPENDS "${pch_lib_filename}") - endif(ENABLE_PCH) endmacro(add_dolphin_library) add_subdirectory(Core) From 7fe8395c33881f60dc3a00c1b42eaf900ddb5b28 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Mon, 23 Jan 2017 13:48:10 +0100 Subject: [PATCH 2/8] cmake: Move listctrl in wxWidgts to platform specific generic --- Externals/wxWidgets3/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 0783b91934..1e6eda5ad1 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -296,7 +296,7 @@ set(SRCS_GENERIC "src/generic/infobar.cpp" "src/generic/laywin.cpp" "src/generic/listbkg.cpp" - "src/generic/listctrl.cpp" + "src/generic/logg.cpp" #"src/generic/markuptext.cpp" #"src/generic/mask.cpp" @@ -344,6 +344,7 @@ set(SRCS_GENERICGTK "src/generic/activityindicator.cpp" "src/generic/icon.cpp" "src/generic/imaglist.cpp" + "src/generic/listctrl.cpp" "src/generic/paletteg.cpp" "src/generic/preferencesg.cpp") @@ -358,7 +359,8 @@ set(SRCS_GENERICOSX "src/generic/colrdlgg.cpp" "src/generic/dirdlgg.cpp" "src/generic/filedlgg.cpp" - "src/generic/fontpickerg.cpp") + "src/generic/fontpickerg.cpp" + "src/generic/listctrl.cpp") set(SRCS_GTK "src/aui/tabartgtk.cpp" From cac53603c52af62372bccb660fb081fb6cdb2e40 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Tue, 24 Jan 2017 02:20:40 +0100 Subject: [PATCH 3/8] DolphinWX: Put wx related headers before including anything else Including Windows.h before them creates compilation errors. --- Source/Core/DolphinWX/Frame.cpp | 35 ++++++++++--------- .../DolphinWX/NetPlay/NetPlaySetupFrame.cpp | 9 ++--- .../Core/DolphinWX/NetPlay/PadMapDialog.cpp | 5 +-- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 9bb98c5f62..7bf2f7e1e1 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -10,12 +10,6 @@ #include #include #include -#if defined(__unix__) || defined(__unix) || defined(__APPLE__) -#include -#endif -#ifdef _WIN32 -#include -#endif #include #include #include @@ -31,6 +25,24 @@ #include #include +#include "DolphinWX/Config/ConfigMain.h" +#include "DolphinWX/Debugger/BreakpointDlg.h" +#include "DolphinWX/Debugger/CodeWindow.h" +#include "DolphinWX/Debugger/MemoryCheckDlg.h" +#include "DolphinWX/GameListCtrl.h" +#include "DolphinWX/Globals.h" +#include "DolphinWX/LogWindow.h" +#include "DolphinWX/Main.h" +#include "DolphinWX/TASInputDlg.h" +#include "DolphinWX/WxUtils.h" + +#if defined(__unix__) || defined(__unix) || defined(__APPLE__) +#include +#endif +#ifdef _WIN32 +#include +#endif + #include "AudioCommon/AudioCommon.h" #include "Common/CommonTypes.h" @@ -51,17 +63,6 @@ #include "Core/Movie.h" #include "Core/State.h" -#include "DolphinWX/Config/ConfigMain.h" -#include "DolphinWX/Debugger/BreakpointDlg.h" -#include "DolphinWX/Debugger/CodeWindow.h" -#include "DolphinWX/Debugger/MemoryCheckDlg.h" -#include "DolphinWX/GameListCtrl.h" -#include "DolphinWX/Globals.h" -#include "DolphinWX/LogWindow.h" -#include "DolphinWX/Main.h" -#include "DolphinWX/TASInputDlg.h" -#include "DolphinWX/WxUtils.h" - #include "InputCommon/GCPadStatus.h" #include "VideoCommon/OnScreenDisplay.h" diff --git a/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp b/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp index 643b2fd959..8202c5b9a8 100644 --- a/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp @@ -14,10 +14,6 @@ #include #include -#include "Common/FileUtil.h" -#include "Common/IniFile.h" -#include "Core/NetPlayClient.h" -#include "Core/NetPlayServer.h" #include "DolphinWX/Frame.h" #include "DolphinWX/Main.h" #include "DolphinWX/NetPlay/NetPlayLauncher.h" @@ -25,6 +21,11 @@ #include "DolphinWX/NetPlay/NetWindow.h" #include "DolphinWX/WxUtils.h" +#include "Common/FileUtil.h" +#include "Common/IniFile.h" +#include "Core/NetPlayClient.h" +#include "Core/NetPlayServer.h" + namespace { wxString GetTraversalLabelText(IniFile::Section& section) diff --git a/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp b/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp index cad10dce0f..3426c594f1 100644 --- a/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp +++ b/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp @@ -7,11 +7,12 @@ #include #include +#include "DolphinWX/NetPlay/PadMapDialog.h" +#include "DolphinWX/WxUtils.h" + #include "Core/NetPlayClient.h" #include "Core/NetPlayProto.h" #include "Core/NetPlayServer.h" -#include "DolphinWX/NetPlay/PadMapDialog.h" -#include "DolphinWX/WxUtils.h" PadMapDialog::PadMapDialog(wxWindow* parent, NetPlayServer* server, NetPlayClient* client) : wxDialog(parent, wxID_ANY, _("Controller Ports")), m_pad_mapping(server->GetPadMapping()), From c649bf104b486202b092dd316f6e6677ddf87ea3 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Tue, 24 Jan 2017 02:21:01 +0100 Subject: [PATCH 4/8] cmake: Prevent HAVE_OPENAL and HAVE_PORTAUDIO to be redefined --- Source/Core/Common/Common.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/Common/Common.h b/Source/Core/Common/Common.h index a48203a874..df9970a962 100644 --- a/Source/Core/Common/Common.h +++ b/Source/Core/Common/Common.h @@ -39,9 +39,13 @@ extern const std::string scm_distributor_str; // Since they are always around on Windows #define HAVE_WX 1 +#ifndef HAVE_OPENAL #define HAVE_OPENAL 1 +#endif +#ifndef HAVE_PORTAUDIO #define HAVE_PORTAUDIO 1 +#endif // Debug definitions #if defined(_DEBUG) From a7bf9271b5b213e50ea6d3d95265388373f99d26 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Tue, 24 Jan 2017 02:44:10 +0100 Subject: [PATCH 5/8] Fix missing includes --- Source/Core/AudioCommon/OpenALStream.cpp | 1 + Source/Core/Common/x64CPUDetect.cpp | 2 ++ Source/Core/Core/FifoPlayer/FifoDataFile.cpp | 1 + Source/Core/Core/PowerPC/JitCommon/JitCache.h | 1 + 4 files changed, 5 insertions(+) diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp index cdbe086450..aee276e691 100644 --- a/Source/Core/AudioCommon/OpenALStream.cpp +++ b/Source/Core/AudioCommon/OpenALStream.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include diff --git a/Source/Core/Common/x64CPUDetect.cpp b/Source/Core/Common/x64CPUDetect.cpp index b35a91b50e..5e655b1850 100644 --- a/Source/Core/Common/x64CPUDetect.cpp +++ b/Source/Core/Common/x64CPUDetect.cpp @@ -12,6 +12,8 @@ #ifndef _WIN32 #ifdef __FreeBSD__ +#include + #include #include #endif diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp index 9d25ba81f2..231f8cb82d 100644 --- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp +++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include #include "Common/FileUtil.h" diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/PowerPC/JitCommon/JitCache.h index 85ae3bfbb8..ea053a3dfa 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include From 0baf1c78c0310b5e00707f18166d2cf347d48638 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Tue, 24 Jan 2017 03:51:07 +0100 Subject: [PATCH 6/8] vs: Move defines out of Common.h to the build system --- Source/Core/Common/Common.h | 7 ------- Source/VSProps/Base.props | 2 ++ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/Core/Common/Common.h b/Source/Core/Common/Common.h index df9970a962..8be79c3cdc 100644 --- a/Source/Core/Common/Common.h +++ b/Source/Core/Common/Common.h @@ -39,13 +39,6 @@ extern const std::string scm_distributor_str; // Since they are always around on Windows #define HAVE_WX 1 -#ifndef HAVE_OPENAL -#define HAVE_OPENAL 1 -#endif - -#ifndef HAVE_PORTAUDIO -#define HAVE_PORTAUDIO 1 -#endif // Debug definitions #if defined(_DEBUG) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 66013cc4a9..0dbbdd59ff 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -55,6 +55,8 @@ PSAPI_VERSION=1;_M_X86=1;%(PreprocessorDefinitions) SFML_STATIC;%(PreprocessorDefinitions) CURL_STATICLIB;%(PreprocessorDefinitions) + HAVE_OPENAL=1;%(PreprocessorDefinitions) + HAVE_PORTAUDIO=1;%(PreprocessorDefinitions) _ARCH_64=1;_M_X86_64=1;%(PreprocessorDefinitions)