Title: [207311] trunk
Revision
207311
Author
bb...@apple.com
Date
2016-10-13 14:48:43 -0700 (Thu, 13 Oct 2016)

Log Message

[CMake] Split the definition of CODE_GENERATOR_PREPROCESSOR so it can be used in a custom command
https://bugs.webkit.org/show_bug.cgi?id=163401

Reviewed by Michael Catanzaro.

In another patch, we need to use CODE_GENERATOR_PREPROCESSOR as the COMMAND argument
when defining an add_custom_command. Previously, it has only been used as a quoted argument
to various Perl code generation scripts.

To support both use cases, we need to be able to provide the executable and its arguments as
an unbroken quoted string, and as a CMake list suitable for passing as an argument to COMMAND.

* Source/cmake/OptionsCommon.cmake:
Split out the executable and argument string into separate variables that can be used elsewhere.
Compute the final unbroken quoted string using the two separate variables to arrive at the same result.

* Source/cmake/WebKitMacros.cmake:
Drive-by cleanup to add quotes around the use of CODE_GENERATOR_PREPROCESSOR so it matches other uses.

Modified Paths

Diff

Modified: trunk/ChangeLog (207310 => 207311)


--- trunk/ChangeLog	2016-10-13 21:41:01 UTC (rev 207310)
+++ trunk/ChangeLog	2016-10-13 21:48:43 UTC (rev 207311)
@@ -1,3 +1,24 @@
+2016-10-13  Brian Burg  <bb...@apple.com>
+
+        [CMake] Split the definition of CODE_GENERATOR_PREPROCESSOR so it can be used in a custom command
+        https://bugs.webkit.org/show_bug.cgi?id=163401
+
+        Reviewed by Michael Catanzaro.
+
+        In another patch, we need to use CODE_GENERATOR_PREPROCESSOR as the COMMAND argument
+        when defining an add_custom_command. Previously, it has only been used as a quoted argument
+        to various Perl code generation scripts.
+
+        To support both use cases, we need to be able to provide the executable and its arguments as
+        an unbroken quoted string, and as a CMake list suitable for passing as an argument to COMMAND.
+
+        * Source/cmake/OptionsCommon.cmake:
+        Split out the executable and argument string into separate variables that can be used elsewhere.
+        Compute the final unbroken quoted string using the two separate variables to arrive at the same result.
+
+        * Source/cmake/WebKitMacros.cmake:
+        Drive-by cleanup to add quotes around the use of CODE_GENERATOR_PREPROCESSOR so it matches other uses.
+
 2016-10-12  Chris Dumez  <cdu...@apple.com>
 
         [Web IDL] Drop support for legacy [ConstructorConditional=*]

Modified: trunk/Source/cmake/OptionsCommon.cmake (207310 => 207311)


--- trunk/Source/cmake/OptionsCommon.cmake	2016-10-13 21:41:01 UTC (rev 207310)
+++ trunk/Source/cmake/OptionsCommon.cmake	2016-10-13 21:48:43 UTC (rev 207311)
@@ -8,11 +8,19 @@
 if (MSVC)
     # FIXME: Some codegenerators don't support paths with spaces. So use the executable name only.
     get_filename_component(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER} ABSOLUTE)
-    set(CODE_GENERATOR_PREPROCESSOR "\"${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE}\" /nologo /EP")
-    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR}")
+
+    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "/nologo /EP")
+    set(CODE_GENERATOR_PREPROCESSOR "\"${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE}\" ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
+
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS ${CODE_GENERATOR_PREPROCESSOR})
 else ()
-    set(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -P -x c++")
-    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CMAKE_CXX_COMPILER} -E -x c++")
+    set(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER})
+
+    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "-E -P -x c++")
+    set(CODE_GENERATOR_PREPROCESSOR "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
+
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS "-E -x c++")
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} ${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS}")
 endif ()
 
 option(USE_THIN_ARCHIVES "Produce all static libraries as thin archives" ON)

Modified: trunk/Source/cmake/WebKitMacros.cmake (207310 => 207311)


--- trunk/Source/cmake/WebKitMacros.cmake	2016-10-13 21:41:01 UTC (rev 207310)
+++ trunk/Source/cmake/WebKitMacros.cmake	2016-10-13 21:48:43 UTC (rev 207311)
@@ -117,7 +117,7 @@
             OUTPUT ${arg_DESTINATION}/JS${_name}.cpp ${arg_DESTINATION}/JS${_name}.h
             MAIN_DEPENDENCY ${_file}
             DEPENDS ${common_generator_dependencies}
-            COMMAND ${PERL_EXECUTABLE} ${binding_generator} --defines ${arg_FEATURES} --generator ${arg_GENERATOR} ${idl_includes} --outputDir ${arg_DESTINATION} --preprocessor ${CODE_GENERATOR_PREPROCESSOR} --idlAttributesFile ${idl_attributes_file} ${_supplemental_dependency} ${_file}
+            COMMAND ${PERL_EXECUTABLE} ${binding_generator} --defines ${arg_FEATURES} --generator ${arg_GENERATOR} ${idl_includes} --outputDir ${arg_DESTINATION} --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --idlAttributesFile ${idl_attributes_file} ${_supplemental_dependency} ${_file}
             WORKING_DIRECTORY ${arg_BASE_DIR}
             VERBATIM)
         list(APPEND gen_sources ${arg_DESTINATION}/JS${_name}.cpp)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to