From 72458c1cff9572fa17b1dc5f29d15e16a8da1bdf Mon Sep 17 00:00:00 2001 From: David Korth Date: Sat, 30 Jun 2018 11:46:46 -0400 Subject: [PATCH 1/2] CMake: Use thin archives on Linux. Thin archives contain pathnames pointing to the object files instead of full copies of the object files. This significantly reduces the disk usage when building Dolphin. Size of *.a files: (gcc-8.1.0, Linux amd64) - Before: 83,876 KB - After: 1,876 KB - Diff: -82,000 KB The resulting binaries are the same as before. A similar change was implemented in the Linux kernel v4.8: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5967db9af51a84f5e181600954714a9e4c69f1f --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92b0a2d849..99dec1a297 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,6 +259,15 @@ else() dolphin_compile_definitions(_DEBUG DEBUG_ONLY) check_and_add_flag(GGDB -ggdb DEBUG_ONLY) + + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # GNU ar: Create thin archive files. + # Requires binutils-2.19 or later. + set(CMAKE_C_ARCHIVE_CREATE " qcTP ") + set(CMAKE_C_ARCHIVE_APPEND " qTP ") + set(CMAKE_CXX_ARCHIVE_CREATE " qcTP ") + set(CMAKE_CXX_ARCHIVE_APPEND " qTP ") + endif() endif() if(CMAKE_SYSTEM_NAME MATCHES "Darwin") From 0149d22385b042fb0f5edea72376e1cb8a6e3850 Mon Sep 17 00:00:00 2001 From: David Korth Date: Mon, 2 Jul 2018 13:01:16 -0400 Subject: [PATCH 2/2] Removed some more double-expansions of CMAKE_SYSTEM_NAME. --- CMakeLists.txt | 4 ++-- Source/Core/Common/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99dec1a297..125eb278ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ option(OPROFILING "Enable profiling" OFF) option(DSPTOOL "Build dsptool" OFF) # Enable SDL for default on operating systems that aren't OSX, Android, Linux or Windows. -if(NOT APPLE AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT MSVC) +if(NOT APPLE AND NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT MSVC) option(ENABLE_SDL "Enables SDL as a generic controller backend" ON) else() option(ENABLE_SDL "Enables SDL as a generic controller backend" OFF) @@ -59,7 +59,7 @@ if(APPLE) option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF) endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") option(ENABLE_VTUNE "Enable Intel VTune integration for JIT code." OFF) if(NOT ANDROID) diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 36d1018575..f93bd67efb 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -142,7 +142,7 @@ elseif(USE_X11) target_link_libraries(common PUBLIC ${XRANDR_LIBRARIES}) endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_link_libraries(common PUBLIC dl rt) endif()