mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Meta: Add gn build for the MacPDF application
This commit is contained in:
parent
967ccd2be8
commit
4522c82459
Notes:
sideshowbarker
2024-07-17 00:25:35 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/4522c82459 Pull-request: https://github.com/SerenityOS/serenity/pull/21518 Reviewed-by: https://github.com/nico ✅
3 changed files with 147 additions and 0 deletions
37
Meta/gn/build/mac/compile_xib_resources.gni
Normal file
37
Meta/gn/build/mac/compile_xib_resources.gni
Normal file
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# This file introduces a template for compiling Apple platform interface
|
||||
# builder files.
|
||||
#
|
||||
# The output files will be placed in $target_gen_dir with the source name
|
||||
# suffix-replaced from "Foo.xib" to "Foo.nib"
|
||||
#
|
||||
# Example use:
|
||||
#
|
||||
# compile_xib_resources("my_nibs") {
|
||||
# sources = [
|
||||
# "A.xib",
|
||||
# "B.xib",
|
||||
# ]
|
||||
# }
|
||||
#
|
||||
|
||||
template("compile_xib_resources") {
|
||||
action_foreach(target_name) {
|
||||
forward_variables_from(invoker, [ "sources" ])
|
||||
|
||||
script = "//Meta/gn/build/invoke_process_with_args.py"
|
||||
|
||||
outputs = [ "$target_gen_dir/{{source_name_part}}.nib" ]
|
||||
args = [
|
||||
"ibtool",
|
||||
"--errors",
|
||||
"--warnings",
|
||||
"--notices",
|
||||
"--output-format",
|
||||
"human-readable-text",
|
||||
"--compile",
|
||||
rebase_path(target_gen_dir, root_build_dir) + "/{{source_name_part}}.nib",
|
||||
"{{source}}",
|
||||
]
|
||||
}
|
||||
}
|
|
@ -15,6 +15,12 @@ group("serenity") {
|
|||
deps = [ "//Kernel(//Meta/gn/build/toolchain:serenity)" ]
|
||||
}
|
||||
|
||||
group("macpdf") {
|
||||
if (current_os == "mac") {
|
||||
deps = [ "//Meta/Lagom/Contrib/MacPDF" ]
|
||||
}
|
||||
}
|
||||
|
||||
# A pool called "console" in the root BUILD.gn is magic and represents ninja's
|
||||
# built-in console pool. (Requires a GN with `gn --version` >= 552353.)
|
||||
pool("console") {
|
||||
|
|
104
Meta/gn/secondary/Meta/Lagom/Contrib/MacPDF/BUILD.gn
Normal file
104
Meta/gn/secondary/Meta/Lagom/Contrib/MacPDF/BUILD.gn
Normal file
|
@ -0,0 +1,104 @@
|
|||
import("//Meta/gn/build/mac/compile_xib_resources.gni")
|
||||
|
||||
assert(current_os == "mac", "This application is macOS specific")
|
||||
|
||||
group("MacPDF") {
|
||||
deps = [ ":MacPDF.app" ]
|
||||
}
|
||||
|
||||
compile_xib_resources("pdf_nibs") {
|
||||
sources = [ "MainMenu.xib" ]
|
||||
}
|
||||
|
||||
executable("MacPDF_executable") {
|
||||
include_dirs = [
|
||||
"//Userland/Libraries",
|
||||
"//Userland/Services",
|
||||
]
|
||||
defines = [ "AK_DONT_REPLACE_STD" ]
|
||||
cflags_objcc = [ "-fobjc-arc" ]
|
||||
deps = [
|
||||
":pdf_nibs",
|
||||
"//AK",
|
||||
"//Userland/Libraries/LibCore",
|
||||
"//Userland/Libraries/LibGfx",
|
||||
"//Userland/Libraries/LibPDF",
|
||||
]
|
||||
frameworks = [
|
||||
"Cocoa.framework",
|
||||
"UniformTypeIdentifiers.framework",
|
||||
]
|
||||
sources = [
|
||||
"AppDelegate.mm",
|
||||
"MacPDFDocument.mm",
|
||||
"MacPDFOutlineViewDataSource.mm",
|
||||
"MacPDFView.mm",
|
||||
"MacPDFWindowController.mm",
|
||||
"main.mm",
|
||||
]
|
||||
output_name = "MacPDF"
|
||||
}
|
||||
|
||||
bundle_data("pdf_bundle_info_plist") {
|
||||
sources = [ "Info.plist" ]
|
||||
outputs = [ "{{bundle_contents_dir}}/Info.plist" ]
|
||||
}
|
||||
|
||||
bundle_data("pdf_bundle_executables") {
|
||||
public_deps = [ ":MacPDF_executable" ]
|
||||
sources = [ "$root_out_dir/bin/MacPDF" ]
|
||||
outputs = [ "{{bundle_executable_dir}}/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
bundle_data("pdf_bundle_libs") {
|
||||
public_deps = [
|
||||
"//Userland/Libraries/LibCompress",
|
||||
"//Userland/Libraries/LibCore",
|
||||
"//Userland/Libraries/LibCrypto",
|
||||
"//Userland/Libraries/LibFileSystem",
|
||||
"//Userland/Libraries/LibGfx",
|
||||
"//Userland/Libraries/LibIPC",
|
||||
"//Userland/Libraries/LibPDF",
|
||||
"//Userland/Libraries/LibTextCodec",
|
||||
]
|
||||
sources = [
|
||||
"$root_out_dir/lib/liblagom-compress.dylib",
|
||||
"$root_out_dir/lib/liblagom-core.dylib",
|
||||
"$root_out_dir/lib/liblagom-crypto.dylib",
|
||||
"$root_out_dir/lib/liblagom-filesystem.dylib",
|
||||
"$root_out_dir/lib/liblagom-gfx.dylib",
|
||||
"$root_out_dir/lib/liblagom-ipc.dylib",
|
||||
"$root_out_dir/lib/liblagom-pdf.dylib",
|
||||
"$root_out_dir/lib/liblagom-textcodec.dylib",
|
||||
]
|
||||
outputs = [ "{{bundle_contents_dir}}/lib/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
bundle_data("pdf_bundle_nibs") {
|
||||
public_deps = [ ":pdf_nibs" ]
|
||||
sources = get_target_outputs(":pdf_nibs")
|
||||
outputs = [ "{{bundle_resources_dir}}" + "{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
bundle_data("pdf_resources") {
|
||||
# FIXME: Don't list directories here, list out the files directly
|
||||
sources = [ "//Base/res/fonts" ]
|
||||
outputs = [ "{{bundle_resources_dir}}/res/" + "{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
create_bundle("MacPDF.app") {
|
||||
product_type = "com.apple.product-type.application"
|
||||
|
||||
bundle_root_dir = "$root_build_dir/$target_name"
|
||||
bundle_contents_dir = "$bundle_root_dir/Contents"
|
||||
bundle_resources_dir = "$bundle_contents_dir/Resources"
|
||||
bundle_executable_dir = "$bundle_contents_dir/MacOS"
|
||||
|
||||
deps = [
|
||||
":pdf_bundle_executables",
|
||||
":pdf_bundle_info_plist",
|
||||
":pdf_bundle_libs",
|
||||
":pdf_bundle_nibs",
|
||||
":pdf_resources",
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue