Add ENABLE_UNIFIED_BUILDS option to cmake ports
authoryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Dec 2018 21:19:09 +0000 (21:19 +0000)
committeryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Dec 2018 21:19:09 +0000 (21:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193045

Reviewed by Don Olmstead.

.:

This patch adds ENABLE_UNIFIED_BUILDS option to cmake ports, which allows us to disable Unified Builds in WebKit.
This makes `compile_commands.json` sane when the unified builds is disabled, and various tools can use this
compilation database. For example, YouCompleteMe completion server can use it.

* Source/cmake/WebKitFeatures.cmake:
* Source/cmake/WebKitMacros.cmake:

Source/WTF:

* Scripts/generate-unified-source-bundles.rb:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239561 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/WTF/ChangeLog
Source/WTF/Scripts/generate-unified-source-bundles.rb
Source/cmake/WebKitFeatures.cmake
Source/cmake/WebKitMacros.cmake

index 1079b98..bf4a5b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2018-12-28  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
+
+        Add ENABLE_UNIFIED_BUILDS option to cmake ports
+        https://bugs.webkit.org/show_bug.cgi?id=193045
+
+        Reviewed by Don Olmstead.
+
+        This patch adds ENABLE_UNIFIED_BUILDS option to cmake ports, which allows us to disable Unified Builds in WebKit.
+        This makes `compile_commands.json` sane when the unified builds is disabled, and various tools can use this
+        compilation database. For example, YouCompleteMe completion server can use it.
+
+        * Source/cmake/WebKitFeatures.cmake:
+        * Source/cmake/WebKitMacros.cmake:
+
 2018-12-27  Alex Christensen  <achristensen@webkit.org>
 
         Resurrect Mac CMake build
index 4803c26..8316c1b 100644 (file)
@@ -1,3 +1,12 @@
+2018-12-28  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
+
+        Add ENABLE_UNIFIED_BUILDS option to cmake ports
+        https://bugs.webkit.org/show_bug.cgi?id=193045
+
+        Reviewed by Don Olmstead.
+
+        * Scripts/generate-unified-source-bundles.rb:
+
 2018-12-27  Alex Christensen  <achristensen@webkit.org>
 
         Resurrect Mac CMake build
index 8880e6f..6ffbf08 100644 (file)
@@ -45,6 +45,7 @@ def usage(message)
     puts
     puts "Optional arguments:"
     puts "--print-bundled-sources              Print bundled sources rather than generating sources"
+    puts "--print-all-sources                  Print all sources rather than generating sources"
     puts "--generate-xcfilelists               Generate .xcfilelist files"
     puts "--input-xcfilelist-path              Path of the generated input .xcfilelist file"
     puts "--output-xcfilelist-path             Path of the generated output .xcfilelist file"
@@ -78,6 +79,7 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT],
                ['--source-tree-path', '-s', GetoptLong::REQUIRED_ARGUMENT],
                ['--feature-flags', '-f', GetoptLong::REQUIRED_ARGUMENT],
                ['--print-bundled-sources', GetoptLong::NO_ARGUMENT],
+               ['--print-all-sources', GetoptLong::NO_ARGUMENT],
                ['--generate-xcfilelists', GetoptLong::NO_ARGUMENT],
                ['--input-xcfilelist-path', GetoptLong::REQUIRED_ARGUMENT],
                ['--output-xcfilelist-path', GetoptLong::REQUIRED_ARGUMENT],
@@ -98,6 +100,8 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT],
         arg.gsub(/\s+/, ";").split(";").map { |x| $featureFlags[x] = true }
     when '--print-bundled-sources'
         $mode = :PrintBundledSources
+    when '--print-all-sources'
+        $mode = :PrintAllSources
     when '--generate-xcfilelists'
         $mode = :GenerateXCFilelists
     when '--input-xcfilelist-path'
@@ -323,6 +327,8 @@ sourceFiles.sort.each {
     case $mode
     when :GenerateBundles, :GenerateXCFilelists
         ProcessFileForUnifiedSourceGeneration(sourceFile)
+    when :PrintAllSources
+        $generatedSources << sourceFile
     when :PrintBundledSources
         $generatedSources << sourceFile if $bundleManagers[sourceFile.path.extname] && sourceFile.unifiable
     end
index 657ed0c..4a3f88e 100644 (file)
@@ -192,6 +192,7 @@ macro(WEBKIT_OPTION_BEGIN)
     WEBKIT_OPTION_DEFINE(ENABLE_TEXT_AUTOSIZING "Toggle automatic text size adjustment support" PRIVATE OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_EVENTS "Toggle Touch Events support" PRIVATE OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_SLIDER "Toggle Touch Slider support" PRIVATE OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_UNIFIED_BUILDS "Toggle unified builds" PRIVATE ON)
     WEBKIT_OPTION_DEFINE(ENABLE_USERSELECT_ALL "Toggle user-select:all support" PRIVATE ON)
     WEBKIT_OPTION_DEFINE(ENABLE_USER_MESSAGE_HANDLERS "Toggle user script message handler support" PRIVATE ON)
     WEBKIT_OPTION_DEFINE(ENABLE_VARIATION_FONTS "Toggle variation fonts support" PRIVATE OFF)
index 36e5a02..6d58d57 100644 (file)
@@ -16,41 +16,59 @@ macro(WEBKIT_COMPUTE_SOURCES _framework)
         set(WTF_SCRIPTS_DIR "${FORWARDING_HEADERS_DIR}/wtf/Scripts")
     endif ()
 
-    execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
-        "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
-        "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
-        "--print-bundled-sources"
-        "--feature-flags" "${UNIFIED_SOURCE_LIST_ENABLED_FEATURES}"
-        ${_sourceListFileTruePaths}
-        RESULT_VARIABLE _resultTmp
-        OUTPUT_VARIABLE _outputTmp)
-
-    if (${_resultTmp})
-         message(FATAL_ERROR "generate-unified-source-bundles.rb exited with non-zero status, exiting")
-    endif ()
+    if (ENABLE_UNIFIED_BUILDS)
+        execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
+            "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
+            "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
+            "--print-bundled-sources"
+            "--feature-flags" "${UNIFIED_SOURCE_LIST_ENABLED_FEATURES}"
+            ${_sourceListFileTruePaths}
+            RESULT_VARIABLE _resultTmp
+            OUTPUT_VARIABLE _outputTmp)
+
+        if (${_resultTmp})
+             message(FATAL_ERROR "generate-unified-source-bundles.rb exited with non-zero status, exiting")
+        endif ()
 
-    foreach (_sourceFileTmp IN LISTS _outputTmp)
-        set_source_files_properties(${_sourceFileTmp} PROPERTIES HEADER_FILE_ONLY ON)
-        list(APPEND ${_framework}_HEADERS ${_sourceFileTmp})
-    endforeach ()
-    unset(_sourceFileTmp)
-
-    execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
-        "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
-        "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
-        "--feature-flags" "${UNIFIED_SOURCE_LIST_ENABLED_FEATURES}"
-        ${_sourceListFileTruePaths}
-        RESULT_VARIABLE  _resultTmp
-        OUTPUT_VARIABLE _outputTmp)
-
-    if (${_resultTmp})
-        message(FATAL_ERROR "generate-unified-source-bundles.rb exited with non-zero status, exiting")
-    endif ()
+        foreach (_sourceFileTmp IN LISTS _outputTmp)
+            set_source_files_properties(${_sourceFileTmp} PROPERTIES HEADER_FILE_ONLY ON)
+            list(APPEND ${_framework}_HEADERS ${_sourceFileTmp})
+        endforeach ()
+        unset(_sourceFileTmp)
+
+        execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
+            "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
+            "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
+            "--feature-flags" "${UNIFIED_SOURCE_LIST_ENABLED_FEATURES}"
+            ${_sourceListFileTruePaths}
+            RESULT_VARIABLE  _resultTmp
+            OUTPUT_VARIABLE _outputTmp)
+
+        if (${_resultTmp})
+            message(FATAL_ERROR "generate-unified-source-bundles.rb exited with non-zero status, exiting")
+        endif ()
 
-    list(APPEND ${_framework}_SOURCES ${_outputTmp})
-    unset(_platformSourcesFile)
-    unset(_resultTmp)
-    unset(_outputTmp)
+        list(APPEND ${_framework}_SOURCES ${_outputTmp})
+        unset(_resultTmp)
+        unset(_outputTmp)
+    else ()
+        execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
+            "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
+            "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
+            "--print-all-sources"
+            "--feature-flags" "${UNIFIED_SOURCE_LIST_ENABLED_FEATURES}"
+            ${_sourceListFileTruePaths}
+            RESULT_VARIABLE _resultTmp
+            OUTPUT_VARIABLE _outputTmp)
+
+        if (${_resultTmp})
+             message(FATAL_ERROR "generate-unified-source-bundles.rb exited with non-zero status, exiting")
+        endif ()
+
+        list(APPEND ${_framework}_SOURCES ${_outputTmp})
+        unset(_resultTmp)
+        unset(_outputTmp)
+    endif ()
 endmacro()
 
 macro(WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS)