2022-04-30 10:50:51 +00:00
|
|
|
function (generate_css_implementation)
|
2022-10-14 02:14:36 +00:00
|
|
|
set(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}")
|
2023-07-05 22:59:36 +00:00
|
|
|
invoke_generator(
|
|
|
|
"EasingFunctions.cpp"
|
|
|
|
Lagom::GenerateCSSEasingFunctions
|
|
|
|
"${LIBWEB_INPUT_FOLDER}/CSS/EasingFunctions.json"
|
|
|
|
"CSS/EasingFunctions.h"
|
|
|
|
"CSS/EasingFunctions.cpp"
|
|
|
|
arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/EasingFunctions.json"
|
|
|
|
)
|
|
|
|
|
2022-04-30 10:50:51 +00:00
|
|
|
invoke_generator(
|
|
|
|
"Enums.cpp"
|
|
|
|
Lagom::GenerateCSSEnums
|
|
|
|
"${LIBWEB_INPUT_FOLDER}/CSS/Enums.json"
|
2022-10-14 02:14:36 +00:00
|
|
|
"CSS/Enums.h"
|
|
|
|
"CSS/Enums.cpp"
|
2022-04-30 10:50:51 +00:00
|
|
|
arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/Enums.json"
|
|
|
|
)
|
|
|
|
|
2023-07-13 13:59:31 +00:00
|
|
|
invoke_generator(
|
|
|
|
"MathFunctions.cpp"
|
|
|
|
Lagom::GenerateCSSMathFunctions
|
|
|
|
"${LIBWEB_INPUT_FOLDER}/CSS/MathFunctions.json"
|
|
|
|
"CSS/MathFunctions.h"
|
|
|
|
"CSS/MathFunctions.cpp"
|
|
|
|
arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/MathFunctions.json"
|
|
|
|
)
|
|
|
|
|
2022-04-30 10:50:51 +00:00
|
|
|
invoke_generator(
|
|
|
|
"MediaFeatureID.cpp"
|
|
|
|
Lagom::GenerateCSSMediaFeatureID
|
|
|
|
"${LIBWEB_INPUT_FOLDER}/CSS/MediaFeatures.json"
|
2022-10-14 02:14:36 +00:00
|
|
|
"CSS/MediaFeatureID.h"
|
|
|
|
"CSS/MediaFeatureID.cpp"
|
2022-04-30 10:50:51 +00:00
|
|
|
arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/MediaFeatures.json"
|
|
|
|
)
|
|
|
|
|
|
|
|
invoke_generator(
|
|
|
|
"PropertyID.cpp"
|
|
|
|
Lagom::GenerateCSSPropertyID
|
|
|
|
"${LIBWEB_INPUT_FOLDER}/CSS/Properties.json"
|
2022-10-14 02:14:36 +00:00
|
|
|
"CSS/PropertyID.h"
|
|
|
|
"CSS/PropertyID.cpp"
|
2022-04-30 10:50:51 +00:00
|
|
|
arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/Properties.json"
|
|
|
|
)
|
|
|
|
|
|
|
|
invoke_generator(
|
|
|
|
"TransformFunctions.cpp"
|
|
|
|
Lagom::GenerateCSSTransformFunctions
|
|
|
|
"${LIBWEB_INPUT_FOLDER}/CSS/TransformFunctions.json"
|
2022-10-14 02:14:36 +00:00
|
|
|
"CSS/TransformFunctions.h"
|
|
|
|
"CSS/TransformFunctions.cpp"
|
2022-04-30 10:50:51 +00:00
|
|
|
arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/TransformFunctions.json"
|
|
|
|
)
|
|
|
|
|
|
|
|
invoke_generator(
|
|
|
|
"ValueID.cpp"
|
|
|
|
Lagom::GenerateCSSValueID
|
|
|
|
"${LIBWEB_INPUT_FOLDER}/CSS/Identifiers.json"
|
2022-10-14 02:14:36 +00:00
|
|
|
"CSS/ValueID.h"
|
|
|
|
"CSS/ValueID.cpp"
|
2022-04-30 10:50:51 +00:00
|
|
|
arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/Identifiers.json"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
2022-10-14 02:14:36 +00:00
|
|
|
OUTPUT CSS/DefaultStyleSheetSource.cpp
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E make_directory CSS
|
|
|
|
COMMAND "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" default_stylesheet_source "${LIBWEB_INPUT_FOLDER}/CSS/Default.css" > CSS/DefaultStyleSheetSource.cpp.tmp
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different CSS/DefaultStyleSheetSource.cpp.tmp CSS/DefaultStyleSheetSource.cpp
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove CSS/DefaultStyleSheetSource.cpp.tmp
|
2022-04-30 10:50:51 +00:00
|
|
|
VERBATIM
|
|
|
|
DEPENDS "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh"
|
2022-10-14 02:14:36 +00:00
|
|
|
MAIN_DEPENDENCY "${LIBWEB_INPUT_FOLDER}/CSS/Default.css"
|
2022-04-30 10:50:51 +00:00
|
|
|
)
|
2022-10-14 02:14:36 +00:00
|
|
|
add_custom_target(generate_DefaultStyleSheetSource.cpp DEPENDS CSS/DefaultStyleSheetSource.cpp)
|
|
|
|
add_dependencies(all_generated generate_DefaultStyleSheetSource.cpp)
|
2022-04-30 10:50:51 +00:00
|
|
|
|
|
|
|
add_custom_command(
|
2022-10-14 02:14:36 +00:00
|
|
|
OUTPUT CSS/QuirksModeStyleSheetSource.cpp
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E make_directory CSS
|
|
|
|
COMMAND "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh" quirks_mode_stylesheet_source "${LIBWEB_INPUT_FOLDER}/CSS/QuirksMode.css" > CSS/QuirksModeStyleSheetSource.cpp.tmp
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different CSS/QuirksModeStyleSheetSource.cpp.tmp CSS/QuirksModeStyleSheetSource.cpp
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove CSS/QuirksModeStyleSheetSource.cpp.tmp
|
2022-04-30 10:50:51 +00:00
|
|
|
VERBATIM
|
|
|
|
DEPENDS "${LIBWEB_INPUT_FOLDER}/Scripts/GenerateStyleSheetSource.sh"
|
2022-10-14 02:14:36 +00:00
|
|
|
MAIN_DEPENDENCY "${LIBWEB_INPUT_FOLDER}/CSS/Default.css"
|
2022-04-30 10:50:51 +00:00
|
|
|
)
|
2022-10-14 02:14:36 +00:00
|
|
|
add_custom_target(generate_QuirksModeStyleSheetSource.cpp DEPENDS CSS/QuirksModeStyleSheetSource.cpp)
|
|
|
|
add_dependencies(all_generated generate_QuirksModeStyleSheetSource.cpp)
|
2022-04-30 10:50:51 +00:00
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
2022-09-21 17:22:16 +00:00
|
|
|
function (generate_js_bindings target)
|
2022-10-14 02:14:36 +00:00
|
|
|
set(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}")
|
2022-09-21 17:22:16 +00:00
|
|
|
function(libweb_js_bindings class)
|
2023-03-15 14:02:04 +00:00
|
|
|
cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_BINDINGS "NAMESPACE;ITERABLE;GLOBAL" "" "")
|
2022-04-30 10:50:51 +00:00
|
|
|
get_filename_component(basename "${class}" NAME)
|
2023-03-15 14:02:04 +00:00
|
|
|
|
|
|
|
# FIXME: Instead of requiring a manual declaration of namespace bindings, we should ask BindingsGenerator if it's a namespace
|
|
|
|
if (LIBWEB_BINDINGS_NAMESPACE)
|
|
|
|
set(BINDINGS_SOURCES
|
|
|
|
"Bindings/${basename}Namespace.h"
|
|
|
|
"Bindings/${basename}Namespace.cpp"
|
|
|
|
)
|
|
|
|
set(BINDINGS_TYPES
|
|
|
|
namespace-header
|
|
|
|
namespace-implementation
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
set(BINDINGS_SOURCES
|
|
|
|
"Bindings/${basename}Constructor.h"
|
|
|
|
"Bindings/${basename}Constructor.cpp"
|
|
|
|
"Bindings/${basename}Prototype.h"
|
|
|
|
"Bindings/${basename}Prototype.cpp"
|
|
|
|
)
|
|
|
|
set(BINDINGS_TYPES
|
|
|
|
constructor-header
|
|
|
|
constructor-implementation
|
|
|
|
prototype-header
|
|
|
|
prototype-implementation
|
|
|
|
)
|
|
|
|
endif()
|
2022-08-06 12:51:11 +00:00
|
|
|
|
2022-09-21 17:22:16 +00:00
|
|
|
# FIXME: Instead of requiring a manual declaration of iterable bindings, we should ask BindingsGenerator if it's iterable
|
|
|
|
if(LIBWEB_BINDINGS_ITERABLE)
|
2022-04-30 10:50:51 +00:00
|
|
|
list(APPEND BINDINGS_SOURCES
|
2022-10-14 02:14:36 +00:00
|
|
|
"Bindings/${basename}IteratorPrototype.h"
|
|
|
|
"Bindings/${basename}IteratorPrototype.cpp"
|
2022-04-30 10:50:51 +00:00
|
|
|
)
|
|
|
|
list(APPEND BINDINGS_TYPES
|
|
|
|
iterator-prototype-header
|
|
|
|
iterator-prototype-implementation
|
|
|
|
)
|
|
|
|
endif()
|
2023-03-05 15:50:56 +00:00
|
|
|
|
|
|
|
# FIXME: Instead of requiring a manual declaration of global object bindings, we should ask BindingsGenerator if it's global
|
|
|
|
if(LIBWEB_BINDINGS_GLOBAL)
|
|
|
|
list(APPEND BINDINGS_SOURCES
|
|
|
|
"Bindings/${basename}GlobalMixin.h"
|
|
|
|
"Bindings/${basename}GlobalMixin.cpp"
|
|
|
|
)
|
|
|
|
list(APPEND BINDINGS_TYPES
|
|
|
|
global-mixin-header
|
|
|
|
global-mixin-implementation
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-04-30 10:50:51 +00:00
|
|
|
target_sources(${target} PRIVATE ${BINDINGS_SOURCES})
|
|
|
|
# FIXME: cmake_minimum_required(3.17) for ZIP_LISTS
|
|
|
|
list(LENGTH BINDINGS_SOURCES num_bindings)
|
|
|
|
math(EXPR bindings_end "${num_bindings} - 1")
|
|
|
|
foreach(iter RANGE "${bindings_end}")
|
|
|
|
list(GET BINDINGS_SOURCES ${iter} bindings_src)
|
|
|
|
list(GET BINDINGS_TYPES ${iter} bindings_type)
|
|
|
|
get_property(include_paths DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
|
|
|
list(TRANSFORM include_paths PREPEND -i)
|
2022-11-05 10:37:33 +00:00
|
|
|
|
|
|
|
# Ninja expects the target name in depfiles to be relative to CMAKE_BINARY_DIR, but ${bindings_src} is
|
|
|
|
# relative to CMAKE_CURRENT_BINARY_DIR. CMake >= 3.20 can do the rewriting transparently (CMP0116).
|
|
|
|
if(CMAKE_GENERATOR MATCHES "^Ninja" AND NOT POLICY CMP0116)
|
|
|
|
# FIXME: Drop this branch for cmake_minimum_required(3.20)
|
|
|
|
get_filename_component(full_path ${bindings_src} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
file(RELATIVE_PATH depfile_target ${CMAKE_BINARY_DIR} ${full_path})
|
|
|
|
else()
|
|
|
|
set(depfile_target ${bindings_src})
|
|
|
|
endif()
|
|
|
|
|
2022-04-30 10:50:51 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${bindings_src}"
|
2022-11-05 10:37:33 +00:00
|
|
|
COMMAND "$<TARGET_FILE:Lagom::BindingsGenerator>" "--${bindings_type}" -o "${bindings_src}.tmp" --depfile "${bindings_src}.d"
|
|
|
|
--depfile-target "${depfile_target}" ${include_paths} "${LIBWEB_INPUT_FOLDER}/${class}.idl" "${LIBWEB_INPUT_FOLDER}"
|
2022-04-30 10:50:51 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${bindings_src}.tmp" "${bindings_src}"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove "${bindings_src}.tmp"
|
|
|
|
VERBATIM
|
2022-09-21 17:22:16 +00:00
|
|
|
DEPENDS Lagom::BindingsGenerator
|
2022-10-14 02:14:36 +00:00
|
|
|
MAIN_DEPENDENCY ${class}.idl
|
2022-11-05 10:37:33 +00:00
|
|
|
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${bindings_src}.d
|
2022-04-30 10:50:51 +00:00
|
|
|
)
|
|
|
|
endforeach()
|
2022-10-17 05:49:52 +00:00
|
|
|
|
|
|
|
foreach(generated_file IN LISTS BINDINGS_SOURCES)
|
|
|
|
get_filename_component(generated_name ${generated_file} NAME)
|
|
|
|
add_custom_target(generate_${generated_name} DEPENDS ${generated_file})
|
|
|
|
add_dependencies(all_generated generate_${generated_name})
|
|
|
|
add_dependencies(${target} generate_${generated_name})
|
|
|
|
endforeach()
|
2022-10-08 22:58:55 +00:00
|
|
|
|
|
|
|
list(APPEND LIBWEB_ALL_IDL_FILES "${LIBWEB_INPUT_FOLDER}/${class}.idl")
|
|
|
|
set(LIBWEB_ALL_IDL_FILES ${LIBWEB_ALL_IDL_FILES} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(generate_exposed_interface_files)
|
2023-01-09 22:49:06 +00:00
|
|
|
set(exposed_interface_sources
|
|
|
|
Forward.h IntrinsicDefinitions.cpp
|
|
|
|
DedicatedWorkerExposedInterfaces.cpp DedicatedWorkerExposedInterfaces.h
|
|
|
|
SharedWorkerExposedInterfaces.cpp SharedWorkerExposedInterfaces.h
|
|
|
|
WindowExposedInterfaces.cpp WindowExposedInterfaces.h)
|
2022-10-14 02:14:36 +00:00
|
|
|
list(TRANSFORM exposed_interface_sources PREPEND "Bindings/")
|
2022-10-08 22:58:55 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${exposed_interface_sources}
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E make_directory "tmp"
|
|
|
|
COMMAND $<TARGET_FILE:Lagom::GenerateWindowOrWorkerInterfaces> -o "${CMAKE_CURRENT_BINARY_DIR}/tmp" -b "${LIBWEB_INPUT_FOLDER}" ${LIBWEB_ALL_IDL_FILES}
|
2023-01-09 22:49:06 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/Forward.h "Bindings/Forward.h"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/IntrinsicDefinitions.cpp "Bindings/IntrinsicDefinitions.cpp"
|
2022-10-14 02:14:36 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.h "Bindings/DedicatedWorkerExposedInterfaces.h"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.cpp "Bindings/DedicatedWorkerExposedInterfaces.cpp"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/SharedWorkerExposedInterfaces.h "Bindings/SharedWorkerExposedInterfaces.h"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/SharedWorkerExposedInterfaces.cpp "Bindings/SharedWorkerExposedInterfaces.cpp"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/WindowExposedInterfaces.h "Bindings/WindowExposedInterfaces.h"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/WindowExposedInterfaces.cpp "Bindings/WindowExposedInterfaces.cpp"
|
2022-10-08 22:58:55 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/tmp"
|
|
|
|
VERBATIM
|
|
|
|
DEPENDS Lagom::GenerateWindowOrWorkerInterfaces ${LIBWEB_ALL_IDL_FILES}
|
|
|
|
)
|
|
|
|
target_sources(${target} PRIVATE ${exposed_interface_sources})
|
2022-10-17 05:49:52 +00:00
|
|
|
add_custom_target(generate_exposed_interfaces DEPENDS ${exposed_interface_sources})
|
|
|
|
add_dependencies(all_generated generate_exposed_interfaces)
|
|
|
|
add_dependencies(${target} generate_exposed_interfaces)
|
2022-04-30 10:50:51 +00:00
|
|
|
endfunction()
|
|
|
|
|
2022-10-14 02:14:36 +00:00
|
|
|
include("idl_files.cmake")
|
2022-10-08 22:58:55 +00:00
|
|
|
generate_exposed_interface_files()
|
2022-04-30 10:50:51 +00:00
|
|
|
|
|
|
|
endfunction()
|