Title: [219522] trunk
Revision
219522
Author
mcatanz...@igalia.com
Date
2017-07-14 13:29:43 -0700 (Fri, 14 Jul 2017)

Log Message

[CMake] Unclear distinction between WebKitHelpers and WebKitMacros
https://bugs.webkit.org/show_bug.cgi?id=153189

Reviewed by Antonio Gomes.

.:

Merge WebKitHelpers.cmake into WebKitMacros.cmake, since there is no meaningful distinction
between the macros that belong in each file. Then, move the macros that are only needed by
one project into project-specific CMake files. Retain here only the macros that are needed
in multiple places.

* Source/cmake/OptionsCommon.cmake: Update a comment.
* Source/cmake/OptionsGTK.cmake: New location for libtool macro, exclusively needed here.
* Source/cmake/WebKitCommon.cmake: Do not include WebKitHelpers.cmake.
* Source/cmake/WebKitHelpers.cmake: Removed.
* Source/cmake/WebKitMacros.cmake:

Source/WebCore:

* CMakeLists.txt: Include WebCoreMacros.cmake.
* WebCoreMacros.cmake: Added.

Source/WebKit:

New location for macros that are exclusively needed here.

* CMakeLists.txt:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/ChangeLog (219521 => 219522)


--- trunk/ChangeLog	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/ChangeLog	2017-07-14 20:29:43 UTC (rev 219522)
@@ -1,3 +1,21 @@
+2017-07-14  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Unclear distinction between WebKitHelpers and WebKitMacros
+        https://bugs.webkit.org/show_bug.cgi?id=153189
+
+        Reviewed by Antonio Gomes.
+
+        Merge WebKitHelpers.cmake into WebKitMacros.cmake, since there is no meaningful distinction
+        between the macros that belong in each file. Then, move the macros that are only needed by
+        one project into project-specific CMake files. Retain here only the macros that are needed
+        in multiple places.
+
+        * Source/cmake/OptionsCommon.cmake: Update a comment.
+        * Source/cmake/OptionsGTK.cmake: New location for libtool macro, exclusively needed here.
+        * Source/cmake/WebKitCommon.cmake: Do not include WebKitHelpers.cmake.
+        * Source/cmake/WebKitHelpers.cmake: Removed.
+        * Source/cmake/WebKitMacros.cmake:
+
 2017-07-13  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [GTK][WPE] Avoid setting settings that are set by default

Modified: trunk/Source/WebCore/CMakeLists.txt (219521 => 219522)


--- trunk/Source/WebCore/CMakeLists.txt	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-07-14 20:29:43 UTC (rev 219522)
@@ -1,6 +1,10 @@
 cmake_minimum_required(VERSION 2.8.12)
+
 include(WebKitCommon)
+include(WebCoreMacros.cmake)
+
 set_property(DIRECTORY . PROPERTY FOLDER "WebCore")
+
 add_subdirectory(PAL/pal)
 
 if (PAL_LIBRARY_TYPE MATCHES STATIC)

Modified: trunk/Source/WebCore/ChangeLog (219521 => 219522)


--- trunk/Source/WebCore/ChangeLog	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/WebCore/ChangeLog	2017-07-14 20:29:43 UTC (rev 219522)
@@ -1,3 +1,13 @@
+2017-07-14  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Unclear distinction between WebKitHelpers and WebKitMacros
+        https://bugs.webkit.org/show_bug.cgi?id=153189
+
+        Reviewed by Antonio Gomes.
+
+        * CMakeLists.txt: Include WebCoreMacros.cmake.
+        * WebCoreMacros.cmake: Added.
+
 2017-07-14  Jeremy Jones  <jere...@apple.com>
 
         Fix style for name of class alloc function in WebVideoFullscreenInterfaceAVKit.

Copied: trunk/Source/WebCore/WebCoreMacros.cmake (from rev 219521, trunk/Source/cmake/WebKitMacros.cmake) (0 => 219522)


--- trunk/Source/WebCore/WebCoreMacros.cmake	                        (rev 0)
+++ trunk/Source/WebCore/WebCoreMacros.cmake	2017-07-14 20:29:43 UTC (rev 219522)
@@ -0,0 +1,274 @@
+# Helper macro for using all-in-one builds
+# This macro removes the sources included in the _all_in_one_file from the input _file_list.
+# _file_list is a list of source files
+# _all_in_one_file is an all-in-one cpp file includes other cpp files
+# _result_file_list is the output file list
+macro(PROCESS_ALLINONE_FILE _file_list _all_in_one_file _result_file_list _no_compile)
+    file(STRINGS ${_all_in_one_file} _all_in_one_file_content)
+    set(${_result_file_list} ${_file_list})
+    set(_allins "")
+    foreach (_line ${_all_in_one_file_content})
+        string(REGEX MATCH "^#include [\"<](.*)[\">]" _found ${_line})
+        if (_found)
+            list(APPEND _allins ${CMAKE_MATCH_1})
+        endif ()
+    endforeach ()
+
+    foreach (_allin ${_allins})
+        if (${_no_compile})
+            # For DerivedSources.cpp, we still need the derived sources to be generated, but we do not want them to be compiled
+            # individually. We add the header to the result file list so that CMake knows to keep generating the files.
+            string(REGEX REPLACE "(.*)\\.cpp" "\\1" _allin_no_ext ${_allin})
+            string(REGEX REPLACE ";([^;]*/)${_allin_no_ext}\\.cpp;" ";\\1${_allin_no_ext}.h;" _new_result "${${_result_file_list}};")
+        else ()
+            string(REGEX REPLACE ";[^;]*/${_allin};" ";" _new_result "${${_result_file_list}};")
+        endif ()
+        set(${_result_file_list} ${_new_result})
+    endforeach ()
+
+endmacro()
+
+
+macro(MAKE_HASH_TOOLS _source)
+    get_filename_component(_name ${_source} NAME_WE)
+
+    if (${_source} STREQUAL "DocTypeStrings")
+        set(_hash_tools_h "${DERIVED_SOURCES_WEBCORE_DIR}/HashTools.h")
+    else ()
+        set(_hash_tools_h "")
+    endif ()
+
+    add_custom_command(
+        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}.cpp ${_hash_tools_h}
+        MAIN_DEPENDENCY ${_source}.gperf
+        COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/make-hash-tools.pl ${DERIVED_SOURCES_WEBCORE_DIR} ${_source}.gperf ${GPERF_EXECUTABLE}
+        VERBATIM)
+
+    unset(_name)
+    unset(_hash_tools_h)
+endmacro()
+
+
+# Append the given dependencies to the source file
+# This one consider the given dependencies are in ${DERIVED_SOURCES_WEBCORE_DIR}
+# and prepends this to every member of dependencies list
+macro(ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES _source _deps)
+    set(_tmp "")
+    foreach (f ${_deps})
+        list(APPEND _tmp "${DERIVED_SOURCES_WEBCORE_DIR}/${f}")
+    endforeach ()
+
+    ADD_SOURCE_DEPENDENCIES(${_source} ${_tmp})
+    unset(_tmp)
+endmacro()
+
+
+macro(MAKE_JS_FILE_ARRAYS _output_cpp _output_h _namespace _scripts _scripts_dependencies)
+    add_custom_command(
+        OUTPUT ${_output_h} ${_output_cpp}
+        DEPENDS ${_javascript_Core_SCRIPTS_DIR}/make-js-file-arrays.py ${${_scripts}}
+        COMMAND ${PYTHON_EXECUTABLE} ${_javascript_Core_SCRIPTS_DIR}/make-js-file-arrays.py -n ${_namespace} ${_output_h} ${_output_cpp} ${${_scripts}}
+        VERBATIM)
+    ADD_SOURCE_DEPENDENCIES(${${_scripts_dependencies}} ${_output_h} ${_output_cpp})
+endmacro()
+
+
+option(SHOW_BINDINGS_GENERATION_PROGRESS "Show progress of generating bindings" OFF)
+
+# Helper macro which wraps generate-bindings-all.pl script.
+#   target is a new target name to be added
+#   OUTPUT_SOURCE is a list name which will contain generated sources.(eg. WebCore_SOURCES)
+#   INPUT_FILES are IDL files to generate.
+#   BASE_DIR is base directory where script is called.
+#   IDL_INCLUDES is value of --include argument. (eg. ${WEBCORE_DIR}/bindings/js)
+#   FEATURES is a value of --defines argument.
+#   DESTINATION is a value of --outputDir argument.
+#   GENERATOR is a value of --generator argument.
+#   SUPPLEMENTAL_DEPFILE is a value of --supplementalDependencyFile. (optional)
+#   PP_EXTRA_OUTPUT is extra outputs of preprocess-idls.pl. (optional)
+#   PP_EXTRA_ARGS is extra arguments for preprocess-idls.pl. (optional)
+function(GENERATE_BINDINGS target)
+    set(options)
+    set(oneValueArgs OUTPUT_SOURCE BASE_DIR FEATURES DESTINATION GENERATOR SUPPLEMENTAL_DEPFILE)
+    set(multiValueArgs INPUT_FILES IDL_INCLUDES PP_EXTRA_OUTPUT PP_EXTRA_ARGS)
+    cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+    set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings-all.pl)
+    set(idl_attributes_file ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.json)
+    set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${target}.tmp)
+    set(_supplemental_dependency)
+
+    set(content)
+    foreach (f ${arg_INPUT_FILES})
+        if (NOT IS_ABSOLUTE ${f})
+            set(f ${CMAKE_CURRENT_SOURCE_DIR}/${f})
+        endif ()
+        set(content "${content}${f}\n")
+    endforeach ()
+    file(WRITE ${idl_files_list} ${content})
+
+    set(args
+        --defines ${arg_FEATURES}
+        --generator ${arg_GENERATOR}
+        --outputDir ${arg_DESTINATION}
+        --idlFilesList ${idl_files_list}
+        --preprocessor "${CODE_GENERATOR_PREPROCESSOR}"
+        --idlAttributesFile ${idl_attributes_file}
+    )
+    if (arg_SUPPLEMENTAL_DEPFILE)
+        list(APPEND args --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
+    endif ()
+    if (PROCESSOR_COUNT)
+        list(APPEND args --numOfJobs ${PROCESSOR_COUNT})
+    endif ()
+    foreach (i IN LISTS arg_IDL_INCLUDES)
+        if (IS_ABSOLUTE ${i})
+            list(APPEND args --include ${i})
+        else ()
+            list(APPEND args --include ${CMAKE_CURRENT_SOURCE_DIR}/${i})
+        endif ()
+    endforeach ()
+    foreach (i IN LISTS arg_PP_EXTRA_OUTPUT)
+        list(APPEND args --ppExtraOutput ${i})
+    endforeach ()
+    foreach (i IN LISTS arg_PP_EXTRA_ARGS)
+        list(APPEND args --ppExtraArgs ${i})
+    endforeach ()
+
+    set(common_generator_dependencies
+        ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl
+        ${SCRIPTS_BINDINGS}
+        # Changing enabled features should trigger recompiling all IDL files
+        # because some of them use #if.
+        ${CMAKE_BINARY_DIR}/cmakeconfig.h
+    )
+    if (EXISTS ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
+        list(APPEND common_generator_dependencies ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
+    endif ()
+    if (EXISTS ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
+        list(APPEND common_generator_dependencies ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
+    endif ()
+    foreach (i IN LISTS common_generator_dependencies)
+        list(APPEND args --generatorDependency ${i})
+    endforeach ()
+
+    set(gen_sources)
+    set(gen_headers)
+    foreach (_file ${arg_INPUT_FILES})
+        get_filename_component(_name ${_file} NAME_WE)
+        list(APPEND gen_sources ${arg_DESTINATION}/JS${_name}.cpp)
+        list(APPEND gen_headers ${arg_DESTINATION}/JS${_name}.h)
+    endforeach ()
+    set(${arg_OUTPUT_SOURCE} ${${arg_OUTPUT_SOURCE}} ${gen_sources} PARENT_SCOPE)
+    set(act_args)
+    if (SHOW_BINDINGS_GENERATION_PROGRESS)
+        list(APPEND args --showProgress)
+    endif ()
+    if (${CMAKE_VERSION} VERSION_LESS 3.2)
+        set_source_files_properties(${gen_sources} ${gen_headers} PROPERTIES GENERATED 1)
+    else ()
+        list(APPEND act_args BYPRODUCTS ${gen_sources} ${gen_headers})
+        if (SHOW_BINDINGS_GENERATION_PROGRESS)
+            list(APPEND act_args USES_TERMINAL)
+        endif ()
+    endif ()
+    add_custom_target(${target}
+        COMMAND ${PERL_EXECUTABLE} ${binding_generator} ${args}
+        WORKING_DIRECTORY ${arg_BASE_DIR}
+        COMMENT "Generate bindings (${target})"
+        VERBATIM ${act_args})
+endfunction()
+
+
+macro(GENERATE_FONT_NAMES _infile)
+    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
+    set(_arguments  --fonts ${_infile})
+    set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.h)
+
+    add_custom_command(
+        OUTPUT  ${_outputfiles}
+        MAIN_DEPENDENCY ${_infile}
+        DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments}
+        VERBATIM)
+endmacro()
+
+
+macro(GENERATE_EVENT_FACTORY _infile _outfile)
+    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_event_factory.pl)
+
+    add_custom_command(
+        OUTPUT  ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+        MAIN_DEPENDENCY ${_infile}
+        DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+        VERBATIM)
+endmacro()
+
+
+macro(GENERATE_EXCEPTION_CODE_DESCRIPTION _infile _outfile)
+    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_dom_exceptions.pl)
+
+    add_custom_command(
+        OUTPUT  ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+        MAIN_DEPENDENCY ${_infile}
+        DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+        VERBATIM)
+endmacro()
+
+
+macro(GENERATE_SETTINGS_MACROS _infile _outfile)
+    set(NAMES_GENERATOR ${WEBCORE_DIR}/page/make_settings.pl)
+
+    # Do not list the output in more than one independent target that may
+    # build in parallel or the two instances of the rule may conflict.
+    # <https://cmake.org/cmake/help/v3.0/command/add_custom_command.html>
+    set(_extra_output
+        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.h
+        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp
+        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl
+    )
+    set(_args BYPRODUCTS ${_extra_output})
+    if (${CMAKE_VERSION} VERSION_LESS 3.2)
+        set_source_files_properties(${_extra_output} PROPERTIES GENERATED 1)
+        set(_args)
+    endif ()
+    add_custom_command(
+        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+        MAIN_DEPENDENCY ${_infile}
+        DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+        VERBATIM ${_args})
+endmacro()
+
+
+macro(GENERATE_DOM_NAMES _namespace _attrs)
+    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
+    set(_arguments  --attrs ${_attrs})
+    set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.h)
+    set(_extradef)
+    set(_tags)
+
+    foreach (f ${ARGN})
+        if (_tags)
+            set(_extradef "${_extradef} ${f}")
+        else ()
+            set(_tags ${f})
+        endif ()
+    endforeach ()
+
+    if (_tags)
+        set(_arguments "${_arguments}" --tags ${_tags} --factory --wrapperFactory)
+        set(_outputfiles "${_outputfiles}" ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.h ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.h)
+    endif ()
+
+    if (_extradef)
+        set(_additionArguments "${_additionArguments}" --extraDefines=${_extradef})
+    endif ()
+
+    add_custom_command(
+        OUTPUT  ${_outputfiles}
+        DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS} ${_attrs} ${_tags}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --preprocessor "${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS}" --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments} ${_additionArguments}
+        VERBATIM)
+endmacro()

Modified: trunk/Source/WebKit/CMakeLists.txt (219521 => 219522)


--- trunk/Source/WebKit/CMakeLists.txt	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/WebKit/CMakeLists.txt	2017-07-14 20:29:43 UTC (rev 219522)
@@ -761,8 +761,29 @@
 
 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
 
-GENERATE_WEBKIT2_MESSAGE_SOURCES(WebKit2_DERIVED_SOURCES "${WebKit2_MESSAGES_IN_FILES}")
+# Helper macro which wraps generate-message-receiver.py and generate-message-header.py scripts
+#   _output_source is a list name which will contain generated sources.(eg. WebKit2_SOURCES)
+#   _input_files are messages.in files to generate.
+macro(GENERATE_MESSAGE_SOURCES _output_source _input_files)
+    foreach (_file ${_input_files})
+        get_filename_component(_name ${_file} NAME_WE)
+        add_custom_command(
+            OUTPUT ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}Messages.h
+            MAIN_DEPENDENCY ${_file}
+            DEPENDS ${WEBKIT2_DIR}/Scripts/webkit/__init__.py
+                    ${WEBKIT2_DIR}/Scripts/webkit/messages.py
+                    ${WEBKIT2_DIR}/Scripts/webkit/model.py
+                    ${WEBKIT2_DIR}/Scripts/webkit/parser.py
+            COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-message-receiver.py ${_file} > ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp
+            COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-messages-header.py ${_file} > ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}Messages.h
+            WORKING_DIRECTORY ${WEBKIT2_DIR}
+            VERBATIM)
 
+        list(APPEND ${_output_source} ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp)
+    endforeach ()
+endmacro()
+GENERATE_MESSAGE_SOURCES(WebKit2_DERIVED_SOURCES "${WebKit2_MESSAGES_IN_FILES}")
+
 set(WebKit2_AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS
     ${PROTOCOL_GENERATOR_SCRIPTS_DIR}/generate-inspector-protocol-bindings.py
     ${PROTOCOL_GENERATOR_SCRIPTS_DIR}/codegen/cpp_generator.py

Modified: trunk/Source/WebKit/ChangeLog (219521 => 219522)


--- trunk/Source/WebKit/ChangeLog	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/WebKit/ChangeLog	2017-07-14 20:29:43 UTC (rev 219522)
@@ -1,3 +1,14 @@
+2017-07-14  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Unclear distinction between WebKitHelpers and WebKitMacros
+        https://bugs.webkit.org/show_bug.cgi?id=153189
+
+        Reviewed by Antonio Gomes.
+
+        New location for macros that are exclusively needed here.
+
+        * CMakeLists.txt:
+
 2017-07-14  Brady Eidson  <beid...@apple.com>
 
         Make sure all CFHTTPCookieStorageRefs we create are scheduled.

Modified: trunk/Source/cmake/OptionsCommon.cmake (219521 => 219522)


--- trunk/Source/cmake/OptionsCommon.cmake	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/cmake/OptionsCommon.cmake	2017-07-14 20:29:43 UTC (rev 219522)
@@ -44,7 +44,7 @@
     endif ()
 endif ()
 
-# FIXME: Some warning flags should probably be set in WebKitHelpers.cmake instead.
+# FIXME: Some warning flags should probably be set in WEBKIT_SET_EXTRA_COMPILER_FLAGS instead.
 # But language-specific warnings probably cannot be moved there.
 if (COMPILER_IS_GCC_OR_CLANG)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")

Modified: trunk/Source/cmake/OptionsGTK.cmake (219521 => 219522)


--- trunk/Source/cmake/OptionsGTK.cmake	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/cmake/OptionsGTK.cmake	2017-07-14 20:29:43 UTC (rev 219522)
@@ -8,6 +8,12 @@
 
 # Libtool library version, not to be confused with API version.
 # See http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
+macro(CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE library_name current revision age)
+    math(EXPR ${library_name}_VERSION_MAJOR "${current} - ${age}")
+    set(${library_name}_VERSION_MINOR ${age})
+    set(${library_name}_VERSION_MICRO ${revision})
+    set(${library_name}_VERSION ${${library_name}_VERSION_MAJOR}.${age}.${revision})
+endmacro()
 CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 60 0 23)
 CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(_javascript_CORE 24 4 6)
 

Modified: trunk/Source/cmake/WebKitCommon.cmake (219521 => 219522)


--- trunk/Source/cmake/WebKitCommon.cmake	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/cmake/WebKitCommon.cmake	2017-07-14 20:29:43 UTC (rev 219522)
@@ -38,7 +38,6 @@
 
     include(WebKitMacros)
     include(WebKitFS)
-    include(WebKitHelpers)
     include(WebKitFeatures)
 
     include(OptionsCommon)

Deleted: trunk/Source/cmake/WebKitHelpers.cmake (219521 => 219522)


--- trunk/Source/cmake/WebKitHelpers.cmake	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/cmake/WebKitHelpers.cmake	2017-07-14 20:29:43 UTC (rev 219522)
@@ -1,109 +0,0 @@
-include(CMakeParseArguments)
-# Sets extra compile flags for a target, depending on the compiler being used.
-# Currently, only GCC is supported.
-macro(WEBKIT_SET_EXTRA_COMPILER_FLAGS _target)
-    set(options ENABLE_WERROR IGNORECXX_WARNINGS)
-    CMAKE_PARSE_ARGUMENTS("OPTION" "${options}" "" "" ${ARGN})
-    if (COMPILER_IS_GCC_OR_CLANG)
-        get_target_property(OLD_COMPILE_FLAGS ${_target} COMPILE_FLAGS)
-        if (${OLD_COMPILE_FLAGS} STREQUAL "OLD_COMPILE_FLAGS-NOTFOUND")
-            set(OLD_COMPILE_FLAGS "")
-        endif ()
-
-        if (NOT WIN32)
-            get_target_property(TARGET_TYPE ${_target} TYPE)
-            if (${TARGET_TYPE} STREQUAL "STATIC_LIBRARY") # -fPIC is automatically added to shared libraries
-                set(OLD_COMPILE_FLAGS "-fPIC ${OLD_COMPILE_FLAGS}")
-            endif ()
-        endif ()
-
-        # Suppress -Wparentheses-equality warning of Clang
-        if (COMPILER_IS_CLANG)
-            set(OLD_COMPILE_FLAGS "-Wno-parentheses-equality ${OLD_COMPILE_FLAGS}")
-        endif ()
-
-        # Enable warnings by default
-        if (NOT ${OPTION_IGNORECXX_WARNINGS})
-            set(OLD_COMPILE_FLAGS "-Wall -Wextra -Wcast-align -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wundef -Wwrite-strings ${OLD_COMPILE_FLAGS}")
-        endif ()
-
-        # Enable errors on warning
-        if (OPTION_ENABLE_WERROR)
-            set(OLD_COMPILE_FLAGS "-Werror ${OLD_COMPILE_FLAGS}")
-        endif ()
-
-        set_target_properties(${_target} PROPERTIES
-            COMPILE_FLAGS "${OLD_COMPILE_FLAGS}")
-
-        unset(OLD_COMPILE_FLAGS)
-    endif ()
-endmacro()
-
-
-# Append the given flag to the target property.
-# Builds on top of get_target_property() and set_target_properties()
-macro(ADD_TARGET_PROPERTIES _target _property _flags)
-    get_target_property(_tmp ${_target} ${_property})
-    if (NOT _tmp)
-        set(_tmp "")
-    endif (NOT _tmp)
-
-    foreach (f ${_flags})
-        set(_tmp "${_tmp} ${f}")
-    endforeach (f ${_flags})
-
-    set_target_properties(${_target} PROPERTIES ${_property} ${_tmp})
-    unset(_tmp)
-endmacro(ADD_TARGET_PROPERTIES _target _property _flags)
-
-
-# Append the given dependencies to the source file
-macro(ADD_SOURCE_DEPENDENCIES _source _deps)
-    get_source_file_property(_tmp ${_source} OBJECT_DEPENDS)
-    if (NOT _tmp)
-        set(_tmp "")
-    endif ()
-
-    foreach (f ${_deps})
-        list(APPEND _tmp "${f}")
-    endforeach ()
-
-    set_source_files_properties(${_source} PROPERTIES OBJECT_DEPENDS "${_tmp}")
-    unset(_tmp)
-endmacro()
-
-
-# Append the given dependencies to the source file
-# This one consider the given dependencies are in ${DERIVED_SOURCES_WEBCORE_DIR}
-# and prepends this to every member of dependencies list
-macro(ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES _source _deps)
-    set(_tmp "")
-    foreach (f ${_deps})
-        list(APPEND _tmp "${DERIVED_SOURCES_WEBCORE_DIR}/${f}")
-    endforeach ()
-
-    ADD_SOURCE_DEPENDENCIES(${_source} ${_tmp})
-    unset(_tmp)
-endmacro()
-
-macro(CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE library_name current revision age)
-    math(EXPR ${library_name}_VERSION_MAJOR "${current} - ${age}")
-    set(${library_name}_VERSION_MINOR ${age})
-    set(${library_name}_VERSION_MICRO ${revision})
-    set(${library_name}_VERSION ${${library_name}_VERSION_MAJOR}.${age}.${revision})
-endmacro()
-
-macro(POPULATE_LIBRARY_VERSION library_name)
-if (NOT DEFINED ${library_name}_VERSION_MAJOR)
-    set(${library_name}_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
-endif ()
-if (NOT DEFINED ${library_name}_VERSION_MINOR)
-    set(${library_name}_VERSION_MINOR ${PROJECT_VERSION_MINOR})
-endif ()
-if (NOT DEFINED ${library_name}_VERSION_MICRO)
-    set(${library_name}_VERSION_MICRO ${PROJECT_VERSION_MICRO})
-endif ()
-if (NOT DEFINED ${library_name}_VERSION)
-    set(${library_name}_VERSION ${PROJECT_VERSION})
-endif ()
-endmacro()

Modified: trunk/Source/cmake/WebKitMacros.cmake (219521 => 219522)


--- trunk/Source/cmake/WebKitMacros.cmake	2017-07-14 20:27:05 UTC (rev 219521)
+++ trunk/Source/cmake/WebKitMacros.cmake	2017-07-14 20:29:43 UTC (rev 219522)
@@ -1,3 +1,7 @@
+# This file is for macros that are used by multiple projects. If your macro is
+# exclusively needed in only one subdirectory of Source (e.g. only needed by
+# WebCore), then put it there instead.
+
 include(CMakeParseArguments)
 include(ProcessorCount)
 ProcessorCount(PROCESSOR_COUNT)
@@ -25,6 +29,7 @@
     endforeach ()
 
     set_source_files_properties(${_source} PROPERTIES OBJECT_DEPENDS "${_tmp}")
+    unset(_tmp)
 endmacro()
 
 macro(ADD_PRECOMPILED_HEADER _header _cpp _source)
@@ -56,223 +61,6 @@
     #FIXME: Add support for Xcode.
 endmacro()
 
-option(SHOW_BINDINGS_GENERATION_PROGRESS "Show progress of generating bindings" OFF)
-
-# Helper macro which wraps generate-bindings-all.pl script.
-#   target is a new target name to be added
-#   OUTPUT_SOURCE is a list name which will contain generated sources.(eg. WebCore_SOURCES)
-#   INPUT_FILES are IDL files to generate.
-#   BASE_DIR is base directory where script is called.
-#   IDL_INCLUDES is value of --include argument. (eg. ${WEBCORE_DIR}/bindings/js)
-#   FEATURES is a value of --defines argument.
-#   DESTINATION is a value of --outputDir argument.
-#   GENERATOR is a value of --generator argument.
-#   SUPPLEMENTAL_DEPFILE is a value of --supplementalDependencyFile. (optional)
-#   PP_EXTRA_OUTPUT is extra outputs of preprocess-idls.pl. (optional)
-#   PP_EXTRA_ARGS is extra arguments for preprocess-idls.pl. (optional)
-function(GENERATE_BINDINGS target)
-    set(options)
-    set(oneValueArgs OUTPUT_SOURCE BASE_DIR FEATURES DESTINATION GENERATOR SUPPLEMENTAL_DEPFILE)
-    set(multiValueArgs INPUT_FILES IDL_INCLUDES PP_EXTRA_OUTPUT PP_EXTRA_ARGS)
-    cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-    set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings-all.pl)
-    set(idl_attributes_file ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.json)
-    set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${target}.tmp)
-    set(_supplemental_dependency)
-
-    set(content)
-    foreach (f ${arg_INPUT_FILES})
-        if (NOT IS_ABSOLUTE ${f})
-            set(f ${CMAKE_CURRENT_SOURCE_DIR}/${f})
-        endif ()
-        set(content "${content}${f}\n")
-    endforeach ()
-    file(WRITE ${idl_files_list} ${content})
-
-    set(args
-        --defines ${arg_FEATURES}
-        --generator ${arg_GENERATOR}
-        --outputDir ${arg_DESTINATION}
-        --idlFilesList ${idl_files_list}
-        --preprocessor "${CODE_GENERATOR_PREPROCESSOR}"
-        --idlAttributesFile ${idl_attributes_file})
-    if (arg_SUPPLEMENTAL_DEPFILE)
-        list(APPEND args --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
-    endif ()
-    if (PROCESSOR_COUNT)
-        list(APPEND args --numOfJobs ${PROCESSOR_COUNT})
-    endif ()
-    foreach (i IN LISTS arg_IDL_INCLUDES)
-        if (IS_ABSOLUTE ${i})
-            list(APPEND args --include ${i})
-        else ()
-            list(APPEND args --include ${CMAKE_CURRENT_SOURCE_DIR}/${i})
-        endif ()
-    endforeach ()
-    foreach (i IN LISTS arg_PP_EXTRA_OUTPUT)
-        list(APPEND args --ppExtraOutput ${i})
-    endforeach ()
-    foreach (i IN LISTS arg_PP_EXTRA_ARGS)
-        list(APPEND args --ppExtraArgs ${i})
-    endforeach ()
-
-    set(common_generator_dependencies
-        ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl
-        ${SCRIPTS_BINDINGS}
-        # Changing enabled features should trigger recompiling all IDL files
-        # because some of them use #if.
-        ${CMAKE_BINARY_DIR}/cmakeconfig.h
-    )
-    if (EXISTS ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
-        list(APPEND common_generator_dependencies ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
-    endif ()
-    if (EXISTS ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
-        list(APPEND common_generator_dependencies ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
-    endif ()
-    foreach (i IN LISTS common_generator_dependencies)
-        list(APPEND args --generatorDependency ${i})
-    endforeach ()
-
-    set(gen_sources)
-    set(gen_headers)
-    foreach (_file ${arg_INPUT_FILES})
-        get_filename_component(_name ${_file} NAME_WE)
-        list(APPEND gen_sources ${arg_DESTINATION}/JS${_name}.cpp)
-        list(APPEND gen_headers ${arg_DESTINATION}/JS${_name}.h)
-    endforeach ()
-    set(${arg_OUTPUT_SOURCE} ${${arg_OUTPUT_SOURCE}} ${gen_sources} PARENT_SCOPE)
-    set(act_args)
-    if (SHOW_BINDINGS_GENERATION_PROGRESS)
-        list(APPEND args --showProgress)
-    endif ()
-    if (${CMAKE_VERSION} VERSION_LESS 3.2)
-        set_source_files_properties(${gen_sources} ${gen_headers} PROPERTIES GENERATED 1)
-    else ()
-        list(APPEND act_args BYPRODUCTS ${gen_sources} ${gen_headers})
-        if (SHOW_BINDINGS_GENERATION_PROGRESS)
-            list(APPEND act_args USES_TERMINAL)
-        endif ()
-    endif ()
-    add_custom_target(${target}
-        COMMAND ${PERL_EXECUTABLE} ${binding_generator} ${args}
-        WORKING_DIRECTORY ${arg_BASE_DIR}
-        COMMENT "Generate bindings (${target})"
-        VERBATIM ${act_args})
-endfunction()
-
-macro(GENERATE_FONT_NAMES _infile)
-    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
-    set(_arguments  --fonts ${_infile})
-    set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.h)
-
-    add_custom_command(
-        OUTPUT  ${_outputfiles}
-        MAIN_DEPENDENCY ${_infile}
-        DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments}
-        VERBATIM)
-endmacro()
-
-
-macro(GENERATE_EVENT_FACTORY _infile _outfile)
-    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_event_factory.pl)
-
-    add_custom_command(
-        OUTPUT  ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
-        MAIN_DEPENDENCY ${_infile}
-        DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
-        VERBATIM)
-endmacro()
-
-
-macro(GENERATE_EXCEPTION_CODE_DESCRIPTION _infile _outfile)
-    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_dom_exceptions.pl)
-
-    add_custom_command(
-        OUTPUT  ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
-        MAIN_DEPENDENCY ${_infile}
-        DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
-        VERBATIM)
-endmacro()
-
-
-macro(GENERATE_SETTINGS_MACROS _infile _outfile)
-    set(NAMES_GENERATOR ${WEBCORE_DIR}/page/make_settings.pl)
-
-    # Do not list the output in more than one independent target that may
-    # build in parallel or the two instances of the rule may conflict.
-    # <https://cmake.org/cmake/help/v3.0/command/add_custom_command.html>
-    set(_extra_output
-        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.h
-        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp
-        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl
-    )
-    set(_args BYPRODUCTS ${_extra_output})
-    if (${CMAKE_VERSION} VERSION_LESS 3.2)
-        set_source_files_properties(${_extra_output} PROPERTIES GENERATED 1)
-        set(_args)
-    endif ()
-    add_custom_command(
-        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
-        MAIN_DEPENDENCY ${_infile}
-        DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
-        VERBATIM ${_args})
-endmacro()
-
-
-macro(GENERATE_DOM_NAMES _namespace _attrs)
-    set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
-    set(_arguments  --attrs ${_attrs})
-    set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.h)
-    set(_extradef)
-    set(_tags)
-
-    foreach (f ${ARGN})
-        if (_tags)
-            set(_extradef "${_extradef} ${f}")
-        else ()
-            set(_tags ${f})
-        endif ()
-    endforeach ()
-
-    if (_tags)
-        set(_arguments "${_arguments}" --tags ${_tags} --factory --wrapperFactory)
-        set(_outputfiles "${_outputfiles}" ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.h ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.h)
-    endif ()
-
-    if (_extradef)
-        set(_additionArguments "${_additionArguments}" --extraDefines=${_extradef})
-    endif ()
-
-    add_custom_command(
-        OUTPUT  ${_outputfiles}
-        DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS} ${_attrs} ${_tags}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --preprocessor "${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS}" --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments} ${_additionArguments}
-        VERBATIM)
-endmacro()
-
-macro(MAKE_HASH_TOOLS _source)
-    get_filename_component(_name ${_source} NAME_WE)
-
-    if (${_source} STREQUAL "DocTypeStrings")
-        set(_hash_tools_h "${DERIVED_SOURCES_WEBCORE_DIR}/HashTools.h")
-    else ()
-        set(_hash_tools_h "")
-    endif ()
-
-    add_custom_command(
-        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}.cpp ${_hash_tools_h}
-        MAIN_DEPENDENCY ${_source}.gperf
-        COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/make-hash-tools.pl ${DERIVED_SOURCES_WEBCORE_DIR} ${_source}.gperf ${GPERF_EXECUTABLE}
-        VERBATIM)
-
-    unset(_name)
-    unset(_hash_tools_h)
-endmacro()
-
 macro(WEBKIT_WRAP_SOURCELIST)
     foreach (_file ${ARGN})
         get_filename_component(_basename ${_file} NAME_WE)
@@ -374,75 +162,85 @@
     endif ()
 endmacro()
 
-# Helper macro which wraps generate-message-receiver.py and generate-message-header.py scripts
-#   _output_source is a list name which will contain generated sources.(eg. WebKit2_SOURCES)
-#   _input_files are messages.in files to generate.
-macro(GENERATE_WEBKIT2_MESSAGE_SOURCES _output_source _input_files)
-    foreach (_file ${_input_files})
-        get_filename_component(_name ${_file} NAME_WE)
-        add_custom_command(
-            OUTPUT ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}Messages.h
-            MAIN_DEPENDENCY ${_file}
-            DEPENDS ${WEBKIT2_DIR}/Scripts/webkit/__init__.py
-                    ${WEBKIT2_DIR}/Scripts/webkit/messages.py
-                    ${WEBKIT2_DIR}/Scripts/webkit/model.py
-                    ${WEBKIT2_DIR}/Scripts/webkit/parser.py
-            COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-message-receiver.py ${_file} > ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-messages-header.py ${_file} > ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}Messages.h
-            WORKING_DIRECTORY ${WEBKIT2_DIR}
-            VERBATIM)
+# Helper macros for debugging CMake problems.
+macro(WEBKIT_DEBUG_DUMP_COMMANDS)
+    set(CMAKE_VERBOSE_MAKEFILE ON)
+endmacro()
 
-        list(APPEND ${_output_source} ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp)
+macro(WEBKIT_DEBUG_DUMP_VARIABLES)
+    set_cmake_property(_variableNames VARIABLES)
+    foreach (_variableName ${_variableNames})
+       message(STATUS "${_variableName}=${${_variableName}}")
     endforeach ()
 endmacro()
 
-macro(MAKE_JS_FILE_ARRAYS _output_cpp _output_h _namespace _scripts _scripts_dependencies)
-    add_custom_command(
-        OUTPUT ${_output_h} ${_output_cpp}
-        DEPENDS ${_javascript_Core_SCRIPTS_DIR}/make-js-file-arrays.py ${${_scripts}}
-        COMMAND ${PYTHON_EXECUTABLE} ${_javascript_Core_SCRIPTS_DIR}/make-js-file-arrays.py -n ${_namespace} ${_output_h} ${_output_cpp} ${${_scripts}}
-        VERBATIM)
-    ADD_SOURCE_DEPENDENCIES(${${_scripts_dependencies}} ${_output_h} ${_output_cpp})
-endmacro()
+# Sets extra compile flags for a target, depending on the compiler being used.
+# Currently, only GCC is supported.
+macro(WEBKIT_SET_EXTRA_COMPILER_FLAGS _target)
+    set(options ENABLE_WERROR IGNORECXX_WARNINGS)
+    CMAKE_PARSE_ARGUMENTS("OPTION" "${options}" "" "" ${ARGN})
+    if (COMPILER_IS_GCC_OR_CLANG)
+        get_target_property(OLD_COMPILE_FLAGS ${_target} COMPILE_FLAGS)
+        if (${OLD_COMPILE_FLAGS} STREQUAL "OLD_COMPILE_FLAGS-NOTFOUND")
+            set(OLD_COMPILE_FLAGS "")
+        endif ()
 
-# Helper macro for using all-in-one builds
-# This macro removes the sources included in the _all_in_one_file from the input _file_list.
-# _file_list is a list of source files
-# _all_in_one_file is an all-in-one cpp file includes other cpp files
-# _result_file_list is the output file list
-macro(PROCESS_ALLINONE_FILE _file_list _all_in_one_file _result_file_list _no_compile)
-    file(STRINGS ${_all_in_one_file} _all_in_one_file_content)
-    set(${_result_file_list} ${_file_list})
-    set(_allins "")
-    foreach (_line ${_all_in_one_file_content})
-        string(REGEX MATCH "^#include [\"<](.*)[\">]" _found ${_line})
-        if (_found)
-            list(APPEND _allins ${CMAKE_MATCH_1})
+        if (NOT WIN32)
+            get_target_property(TARGET_TYPE ${_target} TYPE)
+            if (${TARGET_TYPE} STREQUAL "STATIC_LIBRARY") # -fPIC is automatically added to shared libraries
+                set(OLD_COMPILE_FLAGS "-fPIC ${OLD_COMPILE_FLAGS}")
+            endif ()
         endif ()
-    endforeach ()
 
-    foreach (_allin ${_allins})
-        if (${_no_compile})
-            # For DerivedSources.cpp, we still need the derived sources to be generated, but we do not want them to be compiled
-            # individually. We add the header to the result file list so that CMake knows to keep generating the files.
-            string(REGEX REPLACE "(.*)\\.cpp" "\\1" _allin_no_ext ${_allin})
-            string(REGEX REPLACE ";([^;]*/)${_allin_no_ext}\\.cpp;" ";\\1${_allin_no_ext}.h;" _new_result "${${_result_file_list}};")
-        else ()
-            string(REGEX REPLACE ";[^;]*/${_allin};" ";" _new_result "${${_result_file_list}};")
+        # Suppress -Wparentheses-equality warning of Clang
+        if (COMPILER_IS_CLANG)
+            set(OLD_COMPILE_FLAGS "-Wno-parentheses-equality ${OLD_COMPILE_FLAGS}")
         endif ()
-        set(${_result_file_list} ${_new_result})
-    endforeach ()
 
-endmacro()
+        # Enable warnings by default
+        if (NOT ${OPTION_IGNORECXX_WARNINGS})
+            set(OLD_COMPILE_FLAGS "-Wall -Wextra -Wcast-align -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wundef -Wwrite-strings ${OLD_COMPILE_FLAGS}")
+        endif ()
 
-# Helper macros for debugging CMake problems.
-macro(WEBKIT_DEBUG_DUMP_COMMANDS)
-    set(CMAKE_VERBOSE_MAKEFILE ON)
+        # Enable errors on warning
+        if (OPTION_ENABLE_WERROR)
+            set(OLD_COMPILE_FLAGS "-Werror ${OLD_COMPILE_FLAGS}")
+        endif ()
+
+        set_target_properties(${_target} PROPERTIES
+            COMPILE_FLAGS "${OLD_COMPILE_FLAGS}")
+
+        unset(OLD_COMPILE_FLAGS)
+    endif ()
 endmacro()
 
-macro(WEBKIT_DEBUG_DUMP_VARIABLES)
-    set_cmake_property(_variableNames VARIABLES)
-    foreach (_variableName ${_variableNames})
-       message(STATUS "${_variableName}=${${_variableName}}")
-    endforeach ()
+# Append the given flag to the target property.
+# Builds on top of get_target_property() and set_target_properties()
+macro(ADD_TARGET_PROPERTIES _target _property _flags)
+    get_target_property(_tmp ${_target} ${_property})
+    if (NOT _tmp)
+        set(_tmp "")
+    endif (NOT _tmp)
+
+    foreach (f ${_flags})
+        set(_tmp "${_tmp} ${f}")
+    endforeach (f ${_flags})
+
+    set_target_properties(${_target} PROPERTIES ${_property} ${_tmp})
+    unset(_tmp)
+endmacro(ADD_TARGET_PROPERTIES _target _property _flags)
+
+macro(POPULATE_LIBRARY_VERSION library_name)
+    if (NOT DEFINED ${library_name}_VERSION_MAJOR)
+        set(${library_name}_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
+    endif ()
+    if (NOT DEFINED ${library_name}_VERSION_MINOR)
+        set(${library_name}_VERSION_MINOR ${PROJECT_VERSION_MINOR})
+    endif ()
+    if (NOT DEFINED ${library_name}_VERSION_MICRO)
+        set(${library_name}_VERSION_MICRO ${PROJECT_VERSION_MICRO})
+    endif ()
+    if (NOT DEFINED ${library_name}_VERSION)
+        set(${library_name}_VERSION ${PROJECT_VERSION})
+    endif ()
 endmacro()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to