CodeCache should check that the UnlinkedCodeBlock was successfully created before...
[WebKit-https.git] / Source / JavaScriptCore / PlatformGTK.cmake
1 include(GLib.cmake)
2
3 set(JavaScriptCore_OUTPUT_NAME javascriptcoregtk-${WEBKITGTK_API_VERSION})
4
5 list(APPEND JavaScriptCore_UNIFIED_SOURCE_LIST_FILES
6     "SourcesGTK.txt"
7 )
8
9 list(APPEND JavaScriptCore_PRIVATE_INCLUDE_DIRECTORIES
10     "${DERIVED_SOURCES_JAVASCRIPCOREGTK_DIR}"
11     "${JAVASCRIPTCORE_DIR}/inspector/remote/glib"
12 )
13
14 list(APPEND JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
15     inspector/remote/glib/RemoteInspectorServer.h
16     inspector/remote/glib/RemoteInspectorUtils.h
17 )
18
19 configure_file(javascriptcoregtk.pc.in ${JavaScriptCore_PKGCONFIG_FILE} @ONLY)
20
21 install(FILES "${CMAKE_BINARY_DIR}/Source/JavaScriptCore/javascriptcoregtk-${WEBKITGTK_API_VERSION}.pc"
22         DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
23 )
24
25 install(FILES ${JavaScriptCore_PUBLIC_FRAMEWORK_HEADERS}
26         DESTINATION "${WEBKITGTK_HEADER_INSTALL_DIR}/JavaScriptCore"
27 )
28
29 install(FILES ${JavaScriptCore_INSTALLED_HEADERS}
30         DESTINATION "${WEBKITGTK_HEADER_INSTALL_DIR}/jsc"
31 )
32
33 if (ENABLE_INTROSPECTION)
34     install(FILES ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
35             DESTINATION ${INTROSPECTION_INSTALL_GIRDIR}
36     )
37     install(FILES ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib
38             DESTINATION ${INTROSPECTION_INSTALL_TYPELIBDIR}
39     )
40 endif ()
41
42 add_definitions(-DSTATICALLY_LINKED_WITH_WTF)
43 add_definitions(-DJSC_COMPILATION)
44
45 list(APPEND JavaScriptCore_LIBRARIES
46     ${GLIB_LIBRARIES}
47 )
48 list(APPEND JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES
49     ${GLIB_INCLUDE_DIRS}
50 )
51
52 if (ENABLE_INTROSPECTION)
53     # Add ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} to LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
54     if (APPLE)
55         set(LOADER_LIBRARY_PATH_VAR "DYLD_LIBRARY_PATH")
56         set(PREV_LOADER_LIBRARY_PATH "$ENV{DYLD_LIBRARY_PATH}")
57     else ()
58         set(LOADER_LIBRARY_PATH_VAR "LD_LIBRARY_PATH")
59         set(PREV_LOADER_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}")
60     endif ()
61     string(COMPARE EQUAL "${PREV_LOADER_LIBRARY_PATH}" "" ld_library_path_does_not_exist)
62     if (ld_library_path_does_not_exist)
63         set(INTROSPECTION_ADDITIONAL_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
64     else ()
65         set(INTROSPECTION_ADDITIONAL_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:${PREV_LOADER_LIBRARY_PATH}")
66     endif ()
67
68     # Add required -L flags from ${CMAKE_SHARED_LINKER_FLAGS} for g-ir-scanner
69     string(REGEX MATCHALL "-L[^ ]*" INTROSPECTION_ADDITIONAL_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
70
71     add_custom_command(
72         OUTPUT ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
73         DEPENDS JavaScriptCore
74         COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations LDFLAGS=
75             ${LOADER_LIBRARY_PATH_VAR}="${INTROSPECTION_ADDITIONAL_LIBRARY_PATH}"
76             ${INTROSPECTION_SCANNER}
77             --quiet
78             --warn-all
79             --symbol-prefix=jsc
80             --identifier-prefix=JSC
81             --namespace=JavaScriptCore
82             --nsversion=${WEBKITGTK_API_VERSION}
83             --include=GObject-2.0
84             --library=javascriptcoregtk-${WEBKITGTK_API_VERSION}
85             -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
86             ${INTROSPECTION_ADDITIONAL_LINKER_FLAGS}
87             --no-libtool
88             --pkg=gobject-2.0
89             --pkg-export=javascriptcoregtk-${WEBKITGTK_API_VERSION}
90             --output=${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
91             --c-include="jsc/jsc.h"
92             -DJSC_COMPILATION
93             -I${CMAKE_SOURCE_DIR}/Source
94             -I${JAVASCRIPTCORE_DIR}
95             -I${DERIVED_SOURCES_JAVASCRIPCOREGTK_DIR}
96             -I${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib
97             ${JavaScriptCore_INSTALLED_HEADERS}
98             ${JAVASCRIPTCORE_DIR}/API/glib/*.cpp
99     )
100
101     add_custom_command(
102         OUTPUT ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib
103         DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
104         COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir -o ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib
105         VERBATIM
106     )
107
108     ADD_TYPELIB(${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib)
109 endif ()
110
111 file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-jsc-glib.cfg
112     "[jsc-glib-${WEBKITGTK_API_VERSION}]\n"
113     "pkgconfig_file=${JavaScriptCore_PKGCONFIG_FILE}\n"
114     "decorator=JSC_API\n"
115     "deprecation_guard=JSC_DISABLE_DEPRECATED\n"
116     "namespace=jsc\n"
117     "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
118     "       -I${JAVASCRIPTCORE_DIR}/API/glib\n"
119     "       -I${DERIVED_SOURCES_JAVASCRIPCOREGTK_DIR}\n"
120     "       -I${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib\n"
121     "doc_dir=${JAVASCRIPTCORE_DIR}/API/glib/docs\n"
122     "source_dirs=${JAVASCRIPTCORE_DIR}/API/glib\n"
123     "headers=${JavaScriptCore_INSTALLED_HEADERS}\n"
124     "main_sgml_file=jsc-glib-docs.sgml\n"
125 )