1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 12:17:45 +00:00

Meta: Add the start of a gn build based on the LLVM gn build

"based on" in this context means "largely copied from"
This commit is contained in:
Andrew Kaster 2023-03-28 06:43:12 -06:00 committed by Andrew Kaster
parent 4a9a1d1656
commit 4bfb146181
19 changed files with 1225 additions and 0 deletions

View file

@ -0,0 +1,371 @@
import("//Meta/gn/build/write_cmake_config.gni")
config("ak_headers") {
include_dirs = [
"//",
"$root_gen_dir",
]
}
source_set("AK") {
public_configs = [ ":ak_headers" ]
public_deps = [ ":ak_debug_gen" ]
# NOTE: Headers only!
sources = [
"AllOf.h",
"AnyOf.h",
"ArbitrarySizedEnum.h",
"Array.h",
"Assertions.h",
"Atomic.h",
"AtomicRefCounted.h",
"Badge.h",
"Base64.h",
"BigIntBase.h",
"BinaryBufferWriter.h",
"BinaryHeap.h",
"BinarySearch.h",
"BitCast.h",
"BitStream.h",
"Bitmap.h",
"BitmapView.h",
"BufferedStream.h",
"BuiltinWrappers.h",
"BumpAllocator.h",
"ByteBuffer.h",
"ByteReader.h",
"CharacterTypes.h",
"Checked.h",
"CheckedFormatString.h",
"CircularBuffer.h",
"CircularDeque.h",
"CircularQueue.h",
"Complex.h",
"Concepts.h",
"ConstrainedStream.h",
"CountingStream.h",
"DOSPackedTime.h",
"DateConstants.h",
"DefaultDelete.h",
"Demangle.h",
"DeprecatedFlyString.h",
"DeprecatedString.h",
"Diagnostics.h",
"DisjointChunks.h",
"DistinctNumeric.h",
"DoublyLinkedList.h",
"Endian.h",
"EnumBits.h",
"Error.h",
"ExtraMathConstants.h",
"FPControl.h",
"Find.h",
"FixedArray.h",
"FixedPoint.h",
"FloatingPoint.h",
"FloatingPointStringConversions.h",
"FlyString.h",
"Format.h",
"Forward.h",
"Function.h",
"FuzzyMatch.h",
"GenericLexer.h",
"GenericShorthands.h",
"HashFunctions.h",
"HashMap.h",
"HashTable.h",
"Hex.h",
"IDAllocator.h",
"IPv4Address.h",
"IPv6Address.h",
"InsertionSort.h",
"IntegralMath.h",
"IntrusiveDetails.h",
"IntrusiveList.h",
"IntrusiveListRelaxedConst.h",
"IntrusiveRedBlackTree.h",
"IterationDecision.h",
"Iterator.h",
"JsonArray.h",
"JsonArraySerializer.h",
"JsonObject.h",
"JsonObjectSerializer.h",
"JsonParser.h",
"JsonPath.h",
"JsonValue.h",
"LEB128.h",
"LexicalPath.h",
"MACAddress.h",
"Math.h",
"MaybeOwned.h",
"MemMem.h",
"Memory.h",
"MemoryStream.h",
"NeverDestroyed.h",
"NoAllocationGuard.h",
"Noncopyable.h",
"NonnullOwnPtr.h",
"NonnullRefPtr.h",
"NumberFormat.h",
"NumericLimits.h",
"OptionParser.h",
"Optional.h",
"OwnPtr.h",
"Platform.h",
"PrintfImplementation.h",
"Ptr32.h",
"Queue.h",
"QuickSelect.h",
"QuickSort.h",
"Random.h",
"RecursionDecision.h",
"RedBlackTree.h",
"RefCountForwarder.h",
"RefCounted.h",
"RefPtr.h",
"Result.h",
"ReverseIterator.h",
"SIMD.h",
"SIMDExtras.h",
"SIMDMath.h",
"ScopeGuard.h",
"ScopeLogger.h",
"ScopedValueRollback.h",
"Singleton.h",
"SinglyLinkedList.h",
"SinglyLinkedListSizePolicy.h",
"SourceGenerator.h",
"SourceLocation.h",
"Span.h",
"Stack.h",
"StackInfo.h",
"Statistics.h",
"StdLibExtraDetails.h",
"StdLibExtras.h",
"Stream.h",
"String.h",
"StringBuilder.h",
"StringFloatingPointConversions.h",
"StringHash.h",
"StringImpl.h",
"StringUtils.h",
"StringView.h",
"TemporaryChange.h",
"Time.h",
"Traits.h",
"Trie.h",
"Try.h",
"Tuple.h",
"TypeCasts.h",
"TypeList.h",
"TypedTransfer.h",
"Types.h",
"UBSanitizer.h",
"UFixedBigInt.h",
"UFixedBigIntDivision.h",
"URL.h",
"URLParser.h",
"UUID.h",
"UnicodeUtils.h",
"Userspace.h",
"Utf16View.h",
"Utf32View.h",
"Utf8View.h",
"Variant.h",
"Vector.h",
"WeakPtr.h",
"Weakable.h",
"kmalloc.h",
"kstdio.h",
]
}
source_set("sources") {
deps = [ ":AK" ]
# FIXME: Split out non-kernel sources to their own set
sources = [
"Assertions.cpp",
"Base64.cpp",
"CircularBuffer.cpp",
"ConstrainedStream.cpp",
"CountingStream.cpp",
"DOSPackedTime.cpp",
"DeprecatedFlyString.cpp",
"DeprecatedString.cpp",
"Error.cpp",
"FloatingPointStringConversions.cpp",
"FlyString.cpp",
"Format.cpp",
"FuzzyMatch.cpp",
"GenericLexer.cpp",
"Hex.cpp",
"JsonObject.cpp",
"JsonParser.cpp",
"JsonPath.cpp",
"JsonValue.cpp",
"LexicalPath.cpp",
"MemoryStream.cpp",
"NumberFormat.cpp",
"OptionParser.cpp",
"Random.cpp",
"StackInfo.cpp",
"Stream.cpp",
"String.cpp",
"StringBuilder.cpp",
"StringFloatingPointConversions.cpp",
"StringImpl.cpp",
"StringUtils.cpp",
"StringView.cpp",
"Time.cpp",
"URL.cpp",
"URLParser.cpp",
"UUID.cpp",
"Utf16View.cpp",
"Utf32View.cpp",
"Utf8View.cpp",
"kmalloc.cpp",
]
}
write_cmake_config("ak_debug_gen") {
input = "Debug.h.in"
output = "$root_gen_dir/AK/Debug.h"
values = [
"AFLACLOADER_DEBUG=",
"AUDIO_DEBUG=",
"AWAVLOADER_DEBUG=",
"BINDINGS_GENERATOR_DEBUG=",
"BMP_DEBUG=",
"CACHE_DEBUG=",
"CALLBACK_MACHINE_DEBUG=",
"CANVAS_RENDERING_CONTEXT_2D_DEBUG=",
"CMAKE_DEBUG=",
"COMPOSE_DEBUG=",
"COPY_DEBUG=",
"CPP_DEBUG=",
"CPP_LANGUAGE_SERVER_DEBUG=",
"CRYPTO_DEBUG=",
"CSS_LOADER_DEBUG=",
"CSS_PARSER_DEBUG=",
"CSS_TOKENIZER_DEBUG=",
"DDS_DEBUG=",
"DHCPV4CLIENT_DEBUG=",
"DHCPV4_DEBUG=",
"DIFF_DEBUG=",
"DISASM_DUMP_DEBUG=",
"DOUBLECLICK_DEBUG=",
"DRAG_DEBUG=",
"DWARF_DEBUG=",
"DYNAMIC_LOAD_DEBUG=",
"EDITOR_DEBUG=",
"ELF_IMAGE_DEBUG=",
"EMOJI_DEBUG=",
"ESCAPE_SEQUENCE_DEBUG=",
"EVENT_DEBUG=",
"FILE_CONTENT_DEBUG=",
"FILE_WATCHER_DEBUG=",
"FILL_PATH_DEBUG=",
"GEMINI_DEBUG=",
"GENERATE_DEBUG=",
"GHASH_PROCESS_DEBUG=",
"GIF_DEBUG=",
"GLOBAL_DTORS_DEBUG=",
"GL_DEBUG=",
"GPT_DEBUG=",
"HEAP_DEBUG=",
"HEARTS_DEBUG=",
"HEX_DEBUG=",
"HIGHLIGHT_FOCUSED_FRAME_DEBUG=",
"HTML_PARSER_DEBUG=",
"HTML_SCRIPT_DEBUG=",
"HTTPJOB_DEBUG=",
"HUNKS_DEBUG=",
"ICO_DEBUG=",
"IMAGE_DECODER_DEBUG=",
"IMAGE_LOADER_DEBUG=",
"ITEM_RECTS_DEBUG=",
"JOB_DEBUG=",
"JPEG_DEBUG=",
"JS_BYTECODE_DEBUG=",
"JS_MODULE_DEBUG=",
"KEYBOARD_SHORTCUTS_DEBUG=",
"LANGUAGE_SERVER_DEBUG=",
"LEXER_DEBUG=",
"LIBWEB_CSS_ANIMATION_DEBUG=",
"LIBWEB_CSS_DEBUG=",
"LINE_EDITOR_DEBUG=",
"LOG_DEBUG=",
"LOOKUPSERVER_DEBUG=",
"LZMA_DEBUG=",
"MALLOC_DEBUG=",
"MARKDOWN_DEBUG=",
"MATROSKA_DEBUG=",
"MATROSKA_TRACE_DEBUG=",
"MBR_DEBUG=",
"MEMORY_DEBUG=",
"MENU_DEBUG=",
"MOVE_DEBUG=",
"NETWORKJOB_DEBUG=",
"NT_DEBUG=",
"OCCLUSIONS_DEBUG=",
"OPENTYPE_GPOS_DEBUG=",
"PATH_DEBUG=",
"PDF_DEBUG=",
"PLAYBACK_MANAGER_DEBUG=",
"PNG_DEBUG=",
"PORTABLE_IMAGE_LOADER_DEBUG=",
"PROMISE_DEBUG=",
"PTHREAD_DEBUG=",
"REACHABLE_DEBUG=",
"REGEX_DEBUG=",
"REQUESTSERVER_DEBUG=",
"RESIZE_DEBUG=",
"RESOURCE_DEBUG=",
"RSA_PARSE_DEBUG=",
"SERVICE_DEBUG=",
"SHARED_QUEUE_DEBUG=",
"SHELL_JOB_DEBUG=",
"SHELL_POSIX_PARSER_DEBUG=",
"SH_DEBUG=",
"SH_LANGUAGE_SERVER_DEBUG=",
"SOLITAIRE_DEBUG=",
"SPAM_DEBUG=",
"SPICE_AGENT_DEBUG=",
"SQLSERVER_DEBUG=",
"SQL_DEBUG=",
"SYNTAX_HIGHLIGHTING_DEBUG=",
"SYSCALL_1_DEBUG=",
"SYSTEMSERVER_DEBUG=",
"SYSTEM_MENU_DEBUG=",
"TERMCAP_DEBUG=",
"TERMINAL_DEBUG=",
"TEXTEDITOR_DEBUG=",
"TIME_ZONE_DEBUG=",
"TLS_DEBUG=",
"TLS_SSL_KEYLOG_DEBUG=",
"TOKENIZER_TRACE_DEBUG=",
"UCI_DEBUG=",
"UPDATE_COALESCING_DEBUG=",
"URL_PARSER_DEBUG=",
"UTF8_DEBUG=",
"VPX_DEBUG=",
"WASI_DEBUG=",
"WASM_BINPARSER_DEBUG=",
"WASI_FINE_GRAINED_DEBUG=",
"WASM_TRACE_DEBUG=",
"WASM_VALIDATOR_DEBUG=",
"WEBDRIVER_DEBUG=",
"WEBGL_CONTEXT_DEBUG=",
"WEBP_DEBUG=",
"WEBSERVER_DEBUG=",
"WEB_FETCH_DEBUG=",
"WEB_WORKER_DEBUG=",
"WINDOWMANAGER_DEBUG=",
"WORKER_THREAD_DEBUG=",
"WSMESSAGELOOP_DEBUG=",
"WSSCREEN_DEBUG=",
"XML_PARSER_DEBUG=",
]
}

View file

@ -0,0 +1,11 @@
import("//Meta/gn/build/toolchain/compiler.gni")
group("default") {
deps = [ "//Userland/Libraries/LibCore" ]
}
# 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") {
depth = 1
}

View file

@ -0,0 +1,142 @@
source_set("sources") {
include_dirs = [ "//Userland/Libraries" ]
deps = [ "//AK" ]
sources = [
"AnonymousBuffer.cpp",
"AnonymousBuffer.h",
"ArgsParser.cpp",
"ArgsParser.h",
"Command.cpp",
"Command.h",
"ConfigFile.cpp",
"ConfigFile.h",
"DateTime.cpp",
"DateTime.h",
"Debounce.h",
"DeferredInvocationContext.h",
"DirIterator.cpp",
"DirIterator.h",
"Directory.cpp",
"Directory.h",
"DirectoryEntry.cpp",
"DirectoryEntry.h",
"ElapsedTimer.cpp",
"ElapsedTimer.h",
"Event.cpp",
"Event.h",
"EventLoop.cpp",
"EventLoop.h",
"EventLoopImplementation.cpp",
"EventLoopImplementation.h",
"EventLoopImplementationUnix.cpp",
"EventLoopImplementationUnix.h",
"File.cpp",
"File.h",
"Forward.h",
"LockFile.cpp",
"LockFile.h",
"MappedFile.cpp",
"MappedFile.h",
"MimeData.cpp",
"MimeData.h",
"NetworkJob.cpp",
"NetworkJob.h",
"NetworkResponse.h",
"Notifier.cpp",
"Notifier.h",
"Object.cpp",
"Object.h",
"Process.cpp",
"Process.h",
"ProcessStatisticsReader.cpp",
"ProcessStatisticsReader.h",
"Promise.h",
"Property.cpp",
"Property.h",
"Proxy.h",
"SOCKSProxyClient.cpp",
"SOCKSProxyClient.h",
"SecretString.cpp",
"SecretString.h",
"SessionManagement.cpp",
"SessionManagement.h",
"SharedCircularQueue.h",
"Socket.cpp",
"Socket.h",
"SocketAddress.h",
"StandardPaths.cpp",
"StandardPaths.h",
"System.cpp",
"System.h",
"SystemServerTakeover.cpp",
"SystemServerTakeover.h",
"TCPServer.cpp",
"TCPServer.h",
"ThreadEventQueue.cpp",
"ThreadEventQueue.h",
"Timer.cpp",
"Timer.h",
"UDPServer.cpp",
"UDPServer.h",
"UmaskScope.h",
"Version.cpp",
"Version.h",
]
if (current_os != "android") {
sources += [
"Account.cpp",
"Account.h",
"FilePermissionsMask.cpp",
"FilePermissionsMask.h",
"GetPassword.cpp",
"GetPassword.h",
"Group.cpp",
"Group.h",
"LocalServer.cpp",
"LocalServer.h",
]
}
}
source_set("filewatcher") {
include_dirs = [ "//Userland/Libraries" ]
sources = [ "FileWatcher.h" ]
deps = [ "//AK" ]
frameworks = []
if (current_os == "linux") {
sources += [ "FileWatcherLinux.cpp" ]
} else if (current_os == "mac") {
sources += [ "FileWatcherMacOS.mm" ]
frameworks += [
"CoreFoundation.framework",
"CoreServices.framework",
"Foundation.framework",
]
} else if (current_os == "serenity") {
sources += [ "FileWatcherSerenity.cpp" ]
} else {
sources += [ "FileWatcherUnimplemented.cpp" ]
}
}
shared_library("LibCore") {
libs = []
if (current_os == "linux" || current_os == "android") {
libs += [ "dl" ]
}
if (current_os == "linux") {
libs += [ "rt" ]
}
output_name = "core"
deps = [
":filewatcher",
":sources",
"//AK:sources",
"//Meta/gn/build/libs/crypt",
"//Meta/gn/build/libs/pthread",
"//Userland/Libraries/LibSystem",
]
}

View file

@ -0,0 +1,36 @@
group("LibCrypt") {
deps = []
libs = []
if (current_os == "serenity") {
deps += [
":crypt_shared",
":crypt_static",
]
} else if (current_os == "linux") {
libs += [ "crypt" ]
}
}
if (current_os == "serenity") {
# FIXME: Special handling for LibCrypo/Hash/SHA2.cpp
shared_library("crypt_shared") {
output_name = "crypt"
cflags_cc = [ "-nostdlib" ]
ldflags = [
"-nostdlib",
"-static-libstdc++",
]
sources = [
"crypt.cpp",
"crypt.h",
]
}
static_library("crypt_static") {
output_name = "crypt"
sources = [
"crypt.cpp",
"crypt.h",
]
}
}

View file

@ -0,0 +1,32 @@
group("LibSystem") {
deps = []
if (current_os == "serenity") {
deps += [
":system_shared",
":system_static",
]
}
}
if (current_os == "serenity") {
shared_library("system_shared") {
output_name = "system"
cflags_cc = [ "-nostdlib" ]
ldflags = [
"-nostdlib",
"-static-libstdc++",
]
sources = [
"syscall.cpp",
"syscall.h",
]
}
static_library("system_static") {
output_name = "system"
sources = [
"syscall.cpp",
"syscall.h",
]
}
}