2024-03-25 10:08:52 -04:00
|
|
|
# These are the minimal set of sources needed to build the code generators. We separate them to allow
|
|
|
|
|
# LibCore to depend on generated sources.
|
2020-05-06 18:40:06 +03:00
|
|
|
set(SOURCES
|
|
|
|
|
ArgsParser.cpp
|
2022-04-10 18:28:43 +02:00
|
|
|
Directory.cpp
|
2024-10-24 22:22:11 +05:00
|
|
|
DirectoryEntry.cpp
|
|
|
|
|
DirIterator.cpp
|
2024-03-29 15:32:06 -04:00
|
|
|
Environment.cpp
|
2024-03-25 10:08:52 -04:00
|
|
|
File.cpp
|
|
|
|
|
StandardPaths.cpp
|
|
|
|
|
Version.cpp
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-30 17:19:29 +10:00
|
|
|
if (WIN32)
|
2024-12-17 21:18:02 +05:00
|
|
|
list(APPEND SOURCES
|
2025-02-13 10:43:55 +05:00
|
|
|
ProcessWindows.cpp
|
2024-12-17 21:18:02 +05:00
|
|
|
SocketpairWindows.cpp
|
|
|
|
|
SystemWindows.cpp)
|
2023-08-30 17:19:29 +10:00
|
|
|
else()
|
2025-02-13 10:43:55 +05:00
|
|
|
list(APPEND SOURCES
|
|
|
|
|
Process.cpp
|
|
|
|
|
System.cpp)
|
2023-08-30 17:19:29 +10:00
|
|
|
endif()
|
|
|
|
|
|
2025-06-30 08:11:44 -07:00
|
|
|
ladybird_lib(LibCoreMinimal coreminimal)
|
2024-03-25 10:08:52 -04:00
|
|
|
|
2024-10-24 22:56:43 +05:00
|
|
|
if (WIN32)
|
|
|
|
|
find_path(DIRENT_INCLUDE_DIR dirent.h REQUIRED)
|
|
|
|
|
target_include_directories(LibCoreMinimal PRIVATE ${DIRENT_INCLUDE_DIR})
|
|
|
|
|
endif()
|
|
|
|
|
|
2025-05-13 01:03:07 -07:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
|
|
|
|
# NetBSD has its shm_open and shm_unlink functions in librt so we need to link that
|
|
|
|
|
target_link_libraries(LibCoreMinimal PRIVATE rt)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-06-23 08:35:17 -04:00
|
|
|
if (LAGOM_TOOLS_ONLY)
|
|
|
|
|
return()
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-03-25 10:08:52 -04:00
|
|
|
set(SOURCES
|
2024-06-23 08:15:58 -04:00
|
|
|
ConfigFile.cpp
|
2024-03-25 10:08:52 -04:00
|
|
|
DateTime.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
ElapsedTimer.cpp
|
|
|
|
|
Event.cpp
|
|
|
|
|
EventLoop.cpp
|
2023-04-24 12:25:14 +02:00
|
|
|
EventLoopImplementation.cpp
|
2023-08-06 18:09:39 +02:00
|
|
|
EventReceiver.cpp
|
2021-11-23 11:32:25 +01:00
|
|
|
MappedFile.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
MimeData.cpp
|
|
|
|
|
Notifier.cpp
|
2023-10-02 14:36:53 -06:00
|
|
|
Resource.cpp
|
|
|
|
|
ResourceImplementation.cpp
|
|
|
|
|
ResourceImplementationFile.cpp
|
2022-01-15 11:56:48 +00:00
|
|
|
SystemServerTakeover.cpp
|
2023-04-23 19:45:12 +02:00
|
|
|
ThreadEventQueue.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Timer.cpp
|
|
|
|
|
)
|
2024-10-27 18:13:42 +05:00
|
|
|
|
|
|
|
|
if (WIN32)
|
2025-02-10 13:02:32 -07:00
|
|
|
# FIXME: Support UDPServer and TCPServer on Windows
|
2024-10-31 12:44:19 +05:00
|
|
|
list(APPEND SOURCES
|
2025-02-07 21:37:11 +05:00
|
|
|
SocketWindows.cpp
|
2024-10-31 12:44:19 +05:00
|
|
|
AnonymousBufferWindows.cpp
|
|
|
|
|
EventLoopImplementationWindows.cpp)
|
2024-10-27 18:13:42 +05:00
|
|
|
else()
|
2024-10-31 12:44:19 +05:00
|
|
|
list(APPEND SOURCES
|
2025-02-10 13:02:32 -07:00
|
|
|
Command.cpp
|
2025-02-07 21:37:11 +05:00
|
|
|
Socket.cpp
|
2024-10-31 12:44:19 +05:00
|
|
|
AnonymousBuffer.cpp
|
2025-02-10 13:02:32 -07:00
|
|
|
EventLoopImplementationUnix.cpp
|
|
|
|
|
UDPServer.cpp
|
|
|
|
|
TCPServer.cpp)
|
2024-10-27 18:13:42 +05:00
|
|
|
endif()
|
|
|
|
|
|
2023-07-19 09:55:49 -06:00
|
|
|
if (NOT WIN32 AND NOT EMSCRIPTEN)
|
|
|
|
|
list(APPEND SOURCES LocalServer.cpp)
|
|
|
|
|
endif()
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2024-08-24 12:15:13 -04:00
|
|
|
# FIXME: Implement these for other systems.
|
2024-06-03 20:10:39 -04:00
|
|
|
if (LINUX AND NOT EMSCRIPTEN)
|
2024-04-20 23:35:17 -04:00
|
|
|
list(APPEND SOURCES
|
|
|
|
|
FileWatcherLinux.cpp
|
|
|
|
|
Platform/ProcessStatisticsLinux.cpp
|
2024-08-24 12:15:13 -04:00
|
|
|
TimeZoneWatcherLinux.cpp
|
2024-04-20 23:35:17 -04:00
|
|
|
)
|
2024-02-27 14:32:29 +01:00
|
|
|
elseif (APPLE AND NOT IOS)
|
2024-04-20 23:35:17 -04:00
|
|
|
list(APPEND SOURCES
|
|
|
|
|
FileWatcherMacOS.mm
|
|
|
|
|
Platform/ProcessStatisticsMach.cpp
|
2024-08-24 12:15:13 -04:00
|
|
|
TimeZoneWatcherMacOS.mm
|
2024-04-20 23:35:17 -04:00
|
|
|
)
|
2023-01-17 13:49:21 -05:00
|
|
|
else()
|
2024-04-20 23:35:17 -04:00
|
|
|
list(APPEND SOURCES
|
|
|
|
|
FileWatcherUnimplemented.cpp
|
|
|
|
|
Platform/ProcessStatisticsUnimplemented.cpp
|
2024-08-24 12:15:13 -04:00
|
|
|
TimeZoneWatcherUnimplemented.cpp
|
2024-04-20 23:35:17 -04:00
|
|
|
)
|
2023-01-17 13:49:21 -05:00
|
|
|
endif()
|
|
|
|
|
|
2024-04-04 13:59:44 -06:00
|
|
|
if (APPLE OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
|
|
|
|
|
list(APPEND SOURCES MachPort.cpp)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-06-20 21:33:34 +03:00
|
|
|
if (APPLE)
|
|
|
|
|
list(APPEND SOURCES IOSurface.cpp)
|
|
|
|
|
endif()
|
|
|
|
|
|
2025-06-30 08:11:44 -07:00
|
|
|
ladybird_lib(LibCore core)
|
2025-05-13 01:03:07 -07:00
|
|
|
target_link_libraries(LibCore PRIVATE LibUnicode LibURL Threads::Threads)
|
2024-03-29 15:32:06 -04:00
|
|
|
target_link_libraries(LibCore PUBLIC LibCoreMinimal)
|
2023-01-18 14:03:14 -05:00
|
|
|
|
2025-05-13 01:03:07 -07:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
|
|
|
|
# NetBSD has its shm_open and shm_unlink functions in librt so we need to link that
|
|
|
|
|
target_link_libraries(LibCore PRIVATE rt)
|
|
|
|
|
endif()
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
|
|
|
|
# Solaris has socket and networking related functions in two extra libraries
|
|
|
|
|
target_link_libraries(LibCore PRIVATE nsl socket)
|
|
|
|
|
endif()
|
|
|
|
|
if (HAIKU)
|
|
|
|
|
# Haiku has networking related functions in the network library
|
|
|
|
|
target_link_libraries(LibCore PRIVATE network)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-01-18 14:03:14 -05:00
|
|
|
if (APPLE)
|
|
|
|
|
target_link_libraries(LibCore PUBLIC "-framework CoreFoundation")
|
|
|
|
|
target_link_libraries(LibCore PUBLIC "-framework CoreServices")
|
|
|
|
|
target_link_libraries(LibCore PUBLIC "-framework Foundation")
|
2024-06-20 21:33:34 +03:00
|
|
|
target_link_libraries(LibCore PUBLIC "-framework IOSurface")
|
2023-01-18 14:03:14 -05:00
|
|
|
endif()
|
2023-09-13 23:19:25 -06:00
|
|
|
|
|
|
|
|
if (ANDROID)
|
|
|
|
|
target_link_libraries(LibCore PRIVATE log)
|
|
|
|
|
endif()
|
2025-03-09 13:43:51 -06:00
|
|
|
|
|
|
|
|
if (ENABLE_SWIFT)
|
|
|
|
|
set(SWIFT_EXCLUDE_HEADERS "SocketAddressWindows.h")
|
|
|
|
|
if(WIN32)
|
|
|
|
|
list(APPEND SWIFT_EXCLUDE_HEADERS "EventLoopImplementationUnix.h")
|
|
|
|
|
else()
|
|
|
|
|
list(APPEND SWIFT_EXCLUDE_HEADERS "EventLoopImplementationWindows.h")
|
|
|
|
|
endif()
|
2025-03-17 17:46:42 -06:00
|
|
|
if (NOT APPLE)
|
|
|
|
|
list(APPEND SWIFT_EXCLUDE_HEADERS
|
|
|
|
|
IOSurface.h
|
|
|
|
|
MachPort.h
|
|
|
|
|
MachMessageTypes.h
|
|
|
|
|
ProcessStatisticsMach.h
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2025-03-09 13:43:51 -06:00
|
|
|
|
|
|
|
|
generate_clang_module_map(LibCore EXCLUDE_FILES ${SWIFT_EXCLUDE_HEADERS})
|
|
|
|
|
target_sources(LibCore PRIVATE
|
|
|
|
|
EventSwift.mm
|
|
|
|
|
EventLoopExecutor.swift)
|
2025-03-17 17:46:42 -06:00
|
|
|
set_source_files_properties(EventSwift.mm PRIVATE PROPERTIES COMPILE_FLAGS -fblocks)
|
2025-03-09 13:43:51 -06:00
|
|
|
target_link_libraries(LibCore PRIVATE AK)
|
|
|
|
|
add_swift_target_properties(LibCore LAGOM_LIBRARIES AK)
|
|
|
|
|
endif()
|