branches/work/unity/WebKit/WebCore
Alexander Neundorf
neundorf at kde.org
Sat Sep 9 14:14:23 CEST 2006
SVN commit 582446 by neundorf:
-fix dependencies for generated files with cpp-suffix by naming
the generated files *.inl and create just simple helper cpp-files
compiles now, but when linking I get an undefined reference to CSSParser::lex()
CCMAIL: treat at kde.org,kde-buildsystem at kde.org
Alex
M +40 -6 CMakeLists.txt
--- branches/work/unity/WebKit/WebCore/CMakeLists.txt #582445:582446
@@ -212,18 +212,52 @@
create_lut(WebCore-unity_LIB_SRCS bindings/js/JSXMLSerializer.cpp JSXMLSerializer.lut.h bindings/js/JSXMLSerializer.cpp)
create_lut(WebCore-unity_LIB_SRCS bindings/js/JSXMLHttpRequest.cpp JSXMLHttpRequest.lut.h bindings/js/JSXMLHttpRequest.cpp)
create_lut(WebCore-unity_LIB_SRCS bindings/js/JSXSLTProcessor.cpp JSXSLTProcessor.lut.h bindings/js/JSXSLTProcessor.cpp)
-create_cpp_lut(bindings/js/JSHTMLInputElementBase.cpp JSHTMLInputElementBaseTable.cpp bindings/js/JSHTMLInputElementBase.cpp)
+# now this is ugly
+# WebKit sources include some generated files which have the suffix ".cpp"
+# the CMake way to create the dependencies of targets to generated files is
+# to list the generated files as part of the sources for the target.
+# If this would be done for the generated-and-then-included cpp-files
+# they would be compiled twice (once included and once on their own).
+# The easy way would be to rename the generated files to use the suffix
+# ".inl" or something like this. But this is not wanted by the WebKit developers
+# AFAIK. So we have to work around it here. This is done by renaming the
+# generated files to *.inl and adding these files to the list of sources
+# (WebCore-unity_LIB_SRCS). But the include-statements still want a cpp-file,
+# so tell CMake to create these cpp-files at cmake-time, but these files contain
+# nothing except an include-statement for the inl-file. Alex
+macro(CREATE_GENERATED_CPP_HELPER _inlName)
+ get_filename_component(_baseName ${_inlName} NAME_WE)
+ if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.cpp)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.cpp
+"/* This file is autogenerated by CMake. *
+ * Do not edit, changes will be lost. *
+ * With the CMake buildsystem giving generated-but-not-compiled-on-their-own *
+ * files the suffix \".cpp\" is not recommended, because it breaks the *
+ * dependency handling. So the actual generated file has the suffix \".inl\" *
+ * and this file here only exists as a helper. */
+#include \"${CMAKE_CURRENT_BINARY_DIR}/${_inlName}\"\n")
+ endif (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.cpp)
+ set(WebCore-unity_LIB_SRCS ${WebCore-unity_LIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/${_inlName})
+endmacro(CREATE_GENERATED_CPP_HELPER _inlName)
+
+
+create_cpp_lut(bindings/js/JSHTMLInputElementBase.cpp JSHTMLInputElementBaseTable.inl bindings/js/JSHTMLInputElementBase.cpp)
+create_generated_cpp_helper(JSHTMLInputElementBaseTable.inl)
+
IF (USE_WEBKIT_SVG_SUPPORT)
- create_cpp_lut(ksvg2/bindings/js/JSSVGPoint.cpp JSSVGPointTable.cpp ksvg2/bindings/js/JSSVGPoint.cpp)
- create_cpp_lut(ksvg2/bindings/js/JSSVGRect.cpp JSSVGRectTable.cpp ksvg2/bindings/js/JSSVGRect.cpp)
+
+ create_cpp_lut(ksvg2/bindings/js/JSSVGPoint.cpp JSSVGPointTable.inl ksvg2/bindings/js/JSSVGPoint.cpp)
+ create_generated_cpp_helper(JSSVGPointTable.inl)
+ create_cpp_lut(ksvg2/bindings/js/JSSVGRect.cpp JSSVGRectTable.inl ksvg2/bindings/js/JSSVGRect.cpp)
+ create_generated_cpp_helper(JSSVGRectTable.inl)
ENDIF (USE_WEBKIT_SVG_SUPPORT)
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tokenizer.cpp
- COMMAND flex -t < ${CMAKE_CURRENT_SOURCE_DIR}/css/tokenizer.flex | perl ${CMAKE_CURRENT_SOURCE_DIR}/css/maketokenizer > ${CMAKE_CURRENT_BINARY_DIR}/tokenizer.cpp
-
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tokenizer.inl
+ COMMAND flex -t < ${CMAKE_CURRENT_SOURCE_DIR}/css/tokenizer.flex | perl ${CMAKE_CURRENT_SOURCE_DIR}/css/maketokenizer > ${CMAKE_CURRENT_BINARY_DIR}/tokenizer.inl
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/css/tokenizer.flex
)
+create_generated_cpp_helper(tokenizer.inl)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/CSSPropertyNames.h ${CMAKE_CURRENT_BINARY_DIR}/CSSPropertyNames.c
More information about the Kde-buildsystem
mailing list