Merge pull request #4741 from Orphis/cmake_cleanup

CMake cleanup
This commit is contained in:
Markus Wick 2017-01-24 14:35:05 +01:00 committed by GitHub
commit 63f56ccd02
17 changed files with 46 additions and 127 deletions

View File

@ -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)
@ -1006,7 +977,6 @@ if(NOT DISABLE_WX)
set(wxWidgets_FOUND TRUE)
set(wxWidgets_LIBRARIES "wx")
endif(wxWidgets_FOUND)
add_definitions(-DHAVE_WX=1)
endif(NOT DISABLE_WX)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD")

View File

@ -1,6 +1,7 @@
set(LIB_NAME libcurl)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DHAVE_CONFIG_H)
endif()
add_definitions(-DHAVE_CONFIG_H)
include_directories(.)
file(GLOB SRCS *.c vauth/*.c vtls/*.c)
@ -11,3 +12,4 @@ add_library(
)
target_link_libraries(curl ${MBEDTLS_LIBRARIES})
target_compile_definitions(curl PUBLIC CURL_STATICLIB PRIVATE CURL_DISABLE_LDAP)

View File

@ -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"
@ -890,6 +892,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})

View File

@ -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"
}
}

View File

@ -8,52 +8,9 @@ endif()
add_definitions(-D__STDC_LIMIT_MACROS)
add_definitions(-D__STDC_CONSTANT_MACROS)
set(CMAKE_FAKELANG_CREATE_STATIC_LIBRARY "touch <TARGET>")
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)

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <climits>
#include <cstring>
#include <thread>

View File

@ -37,12 +37,6 @@ extern const std::string scm_distributor_str;
// Memory leak checks
#define CHECK_HEAP_INTEGRITY()
// Since they are always around on Windows
#define HAVE_WX 1
#define HAVE_OPENAL 1
#define HAVE_PORTAUDIO 1
// Debug definitions
#if defined(_DEBUG)
#include <crtdbg.h>

View File

@ -12,6 +12,8 @@
#ifndef _WIN32
#ifdef __FreeBSD__
#include <unistd.h>
#include <machine/cpufunc.h>
#include <sys/types.h>
#endif

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <algorithm>
#include <cstring>
#include <string>
#include "Common/FileUtil.h"

View File

@ -6,6 +6,7 @@
#include <array>
#include <bitset>
#include <cstring>
#include <functional>
#include <map>
#include <memory>

View File

@ -10,12 +10,6 @@
#include <string>
#include <utility>
#include <vector>
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
#include <signal.h>
#endif
#ifdef _WIN32
#include <windows.h>
#endif
#include <wx/aui/auibook.h>
#include <wx/aui/framemanager.h>
#include <wx/filename.h>
@ -31,6 +25,24 @@
#include <wx/thread.h>
#include <wx/toolbar.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"
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
#include <signal.h>
#endif
#ifdef _WIN32
#include <windows.h>
#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"
@ -70,6 +71,10 @@
#include "VideoCommon/VideoConfig.h"
#if defined(HAVE_X11) && HAVE_X11
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
// X11Utils nastiness that's only used here
namespace X11Utils
{

View File

@ -11,10 +11,8 @@
#include "Common/Common.h"
#if defined(HAVE_WX) && HAVE_WX
#include <wx/bitmap.h>
#include <wx/image.h>
#endif
namespace DiscIO
{
@ -60,12 +58,9 @@ public:
u64 GetVolumeSize() const { return m_VolumeSize; }
// 0 is the first disc, 1 is the second disc
u8 GetDiscNumber() const { return m_disc_number; }
#if defined(HAVE_WX) && HAVE_WX
// NOTE: Banner image is at the original resolution, use WxUtils::ScaleImageToBitmap
// to display it
const wxImage& GetBannerImage() const { return m_image; }
#endif
void DoState(PointerWrap& p);
private:
@ -90,9 +85,7 @@ private:
DiscIO::BlobType m_blob_type;
u16 m_Revision;
#if defined(HAVE_WX) && HAVE_WX
wxImage m_image;
#endif
bool m_Valid;
std::vector<u8> m_pImage;
int m_ImageWidth, m_ImageHeight;

View File

@ -14,10 +14,6 @@
#include <wx/stattext.h>
#include <wx/textctrl.h>
#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)

View File

@ -7,11 +7,12 @@
#include <wx/sizer.h>
#include <wx/stattext.h>
#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()),

View File

@ -13,13 +13,9 @@
extern char** environ;
#if defined(HAVE_WX) && HAVE_WX
#include <algorithm>
#include <string>
#include "DolphinWX/WxUtils.h"
#endif
namespace X11Utils
{
bool ToggleFullscreen(Display* dpy, Window win)

View File

@ -12,12 +12,6 @@
// is terrible, but such is the life with Xlib.
#include <SFML/Network.hpp> // NOLINT
#if defined(HAVE_WX) && HAVE_WX
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <wx/arrstr.h>
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
@ -33,10 +27,8 @@
namespace X11Utils
{
bool ToggleFullscreen(Display* dpy, Window win);
#if defined(HAVE_WX) && HAVE_WX
Window XWindowFromHandle(void* Handle);
Display* XDisplayFromHandle(void* Handle);
#endif
void InhibitScreensaver(Display* dpy, Window win, bool suspend);

View File

@ -55,6 +55,8 @@
<PreprocessorDefinitions>PSAPI_VERSION=1;_M_X86=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SFML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_OPENAL=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_PORTAUDIO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_ARCH_64=1;_M_X86_64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!--
Make sure we include a clean version of windows.h.