mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
Meta: Build select Services in Lagom
Add overrides for serenity_bin and serenity_lib to allow the actual CMakeLists.txt from Userland to be used to build as many services as possible without adding more clutter to Meta/Lagom/CMakeLists.txt
This commit is contained in:
parent
2b29e611fe
commit
0a62fcfbdf
3 changed files with 93 additions and 44 deletions
|
@ -33,27 +33,31 @@ function(serenity_generated_sources target_name)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(serenity_lib target_name fs_name)
|
if (NOT COMMAND serenity_lib)
|
||||||
serenity_install_headers(${target_name})
|
function(serenity_lib target_name fs_name)
|
||||||
serenity_install_sources()
|
serenity_install_headers(${target_name})
|
||||||
add_library(${target_name} SHARED ${SOURCES} ${GENERATED_SOURCES})
|
serenity_install_sources()
|
||||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
add_library(${target_name} SHARED ${SOURCES} ${GENERATED_SOURCES})
|
||||||
set_target_properties(${target_name} PROPERTIES VERSION "serenity")
|
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
|
set_target_properties(${target_name} PROPERTIES VERSION "serenity")
|
||||||
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
|
||||||
serenity_generated_sources(${target_name})
|
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
||||||
endfunction()
|
serenity_generated_sources(${target_name})
|
||||||
|
endfunction()
|
||||||
|
endif()
|
||||||
|
|
||||||
function(serenity_lib_static target_name fs_name)
|
if (NOT COMMAND serenity_lib_static)
|
||||||
serenity_install_headers(${target_name})
|
function(serenity_lib_static target_name fs_name)
|
||||||
serenity_install_sources()
|
serenity_install_headers(${target_name})
|
||||||
add_library(${target_name} STATIC ${SOURCES} ${GENERATED_SOURCES})
|
serenity_install_sources()
|
||||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
add_library(${target_name} STATIC ${SOURCES} ${GENERATED_SOURCES})
|
||||||
set_target_properties(${target_name} PROPERTIES VERSION "serenity")
|
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
|
set_target_properties(${target_name} PROPERTIES VERSION "serenity")
|
||||||
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
|
||||||
serenity_generated_sources(${target_name})
|
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
||||||
endfunction()
|
serenity_generated_sources(${target_name})
|
||||||
|
endfunction()
|
||||||
|
endif()
|
||||||
|
|
||||||
function(serenity_libc target_name fs_name)
|
function(serenity_libc target_name fs_name)
|
||||||
serenity_install_headers("")
|
serenity_install_headers("")
|
||||||
|
@ -81,13 +85,15 @@ function(serenity_libc target_name fs_name)
|
||||||
serenity_generated_sources(${target_name})
|
serenity_generated_sources(${target_name})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(serenity_bin target_name)
|
if (NOT COMMAND serenity_bin)
|
||||||
serenity_install_sources()
|
function(serenity_bin target_name)
|
||||||
add_executable(${target_name} ${SOURCES})
|
serenity_install_sources()
|
||||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
add_executable(${target_name} ${SOURCES})
|
||||||
install(TARGETS ${target_name} RUNTIME DESTINATION bin OPTIONAL)
|
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
serenity_generated_sources(${target_name})
|
install(TARGETS ${target_name} RUNTIME DESTINATION bin OPTIONAL)
|
||||||
endfunction()
|
serenity_generated_sources(${target_name})
|
||||||
|
endfunction()
|
||||||
|
endif()
|
||||||
|
|
||||||
function(serenity_test test_src sub_dir)
|
function(serenity_test test_src sub_dir)
|
||||||
cmake_parse_arguments(PARSE_ARGV 2 SERENITY_TEST "MAIN_ALREADY_DEFINED" "CUSTOM_MAIN" "LIBS")
|
cmake_parse_arguments(PARSE_ARGV 2 SERENITY_TEST "MAIN_ALREADY_DEFINED" "CUSTOM_MAIN" "LIBS")
|
||||||
|
|
|
@ -23,6 +23,7 @@ get_filename_component(
|
||||||
SERENITY_PROJECT_ROOT "${PROJECT_SOURCE_DIR}/../.."
|
SERENITY_PROJECT_ROOT "${PROJECT_SOURCE_DIR}/../.."
|
||||||
ABSOLUTE CACHE
|
ABSOLUTE CACHE
|
||||||
)
|
)
|
||||||
|
set(SerenityOS_SOURCE_DIR "${SERENITY_PROJECT_ROOT}" CACHE STRING "")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${SERENITY_PROJECT_ROOT}/Meta/CMake")
|
list(APPEND CMAKE_MODULE_PATH "${SERENITY_PROJECT_ROOT}/Meta/CMake")
|
||||||
|
|
||||||
|
@ -137,8 +138,11 @@ configure_file(../../AK/Debug.h.in AK/Debug.h @ONLY)
|
||||||
include_directories(../../)
|
include_directories(../../)
|
||||||
include_directories(../../Userland/)
|
include_directories(../../Userland/)
|
||||||
include_directories(../../Userland/Libraries/)
|
include_directories(../../Userland/Libraries/)
|
||||||
|
include_directories(../../Userland/Services)
|
||||||
include_directories(${CMAKE_BINARY_DIR})
|
include_directories(${CMAKE_BINARY_DIR})
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
include_directories(${CMAKE_BINARY_DIR}/Libraries)
|
||||||
|
include_directories(${CMAKE_BINARY_DIR}/Services)
|
||||||
|
|
||||||
# install rules, think about moving to its own helper cmake file
|
# install rules, think about moving to its own helper cmake file
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
@ -222,6 +226,31 @@ function(lagom_test source)
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(serenity_bin name)
|
||||||
|
add_executable(${name} ${SOURCES} ${GENERATED_SOURCES})
|
||||||
|
add_executable(Lagom::${name} ALIAS ${name})
|
||||||
|
install(
|
||||||
|
TARGETS ${target_name}
|
||||||
|
EXPORT LagomTargets
|
||||||
|
RUNTIME #
|
||||||
|
COMPONENT Lagom_Runtime
|
||||||
|
LIBRARY #
|
||||||
|
COMPONENT Lagom_Runtime
|
||||||
|
NAMELINK_COMPONENT Lagom_Development
|
||||||
|
ARCHIVE #
|
||||||
|
COMPONENT Lagom_Development
|
||||||
|
INCLUDES #
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(serenity_lib name fs_name)
|
||||||
|
lagom_lib(name fs_name SOURCES ${SOURCES} ${GENERATED_SOURCES})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
add_custom_target(components ALL)
|
||||||
|
option(BUILD_EVERYTHING "Build all optional components" ON)
|
||||||
|
|
||||||
if (NOT TARGET all_generated)
|
if (NOT TARGET all_generated)
|
||||||
# Meta target to run all code-gen steps in the build.
|
# Meta target to run all code-gen steps in the build.
|
||||||
add_custom_target(all_generated)
|
add_custom_target(all_generated)
|
||||||
|
@ -306,6 +335,12 @@ if (BUILD_LAGOM)
|
||||||
SOURCES ${LIBCRYPTO_SOURCES} ${LIBCRYPTO_SUBDIR_SOURCES} ${LIBCRYPTO_SUBSUBDIR_SOURCES}
|
SOURCES ${LIBCRYPTO_SOURCES} ${LIBCRYPTO_SUBDIR_SOURCES} ${LIBCRYPTO_SUBSUBDIR_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
file(GLOB LIBDNS_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibDNS/*.cpp")
|
||||||
|
lagom_lib(DNS dns
|
||||||
|
SOURCES ${LIBDNS_SOURCES}
|
||||||
|
LIBS LibIPC
|
||||||
|
)
|
||||||
|
|
||||||
# ELF
|
# ELF
|
||||||
# FIXME: Excluding arm64 is a temporary hack to circumvent a build problem
|
# FIXME: Excluding arm64 is a temporary hack to circumvent a build problem
|
||||||
# for Lagom on Apple M1
|
# for Lagom on Apple M1
|
||||||
|
@ -525,6 +560,9 @@ if (BUILD_LAGOM)
|
||||||
SOURCES ${LIBXML_SOURCES})
|
SOURCES ${LIBXML_SOURCES})
|
||||||
|
|
||||||
if (NOT ENABLE_FUZZERS AND NOT ENABLE_COMPILER_EXPLORER_BUILD)
|
if (NOT ENABLE_FUZZERS AND NOT ENABLE_COMPILER_EXPLORER_BUILD)
|
||||||
|
# Lagom Services
|
||||||
|
add_subdirectory("${SERENITY_PROJECT_ROOT}/Userland/Services" "${CMAKE_CURRENT_BINARY_DIR}/Services")
|
||||||
|
|
||||||
# Lagom Examples
|
# Lagom Examples
|
||||||
add_executable(TestApp TestApp.cpp)
|
add_executable(TestApp TestApp.cpp)
|
||||||
target_link_libraries(TestApp LibCore)
|
target_link_libraries(TestApp LibCore)
|
||||||
|
@ -766,4 +804,6 @@ endif()
|
||||||
|
|
||||||
if (ENABLE_FUZZERS)
|
if (ENABLE_FUZZERS)
|
||||||
add_subdirectory(Fuzzers)
|
add_subdirectory(Fuzzers)
|
||||||
|
else()
|
||||||
|
export_components("${CMAKE_BINARY_DIR}/components.ini")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
add_subdirectory(AudioServer)
|
|
||||||
add_subdirectory(ChessEngine)
|
|
||||||
add_subdirectory(Clipboard)
|
|
||||||
add_subdirectory(ConfigServer)
|
add_subdirectory(ConfigServer)
|
||||||
add_subdirectory(CrashDaemon)
|
|
||||||
add_subdirectory(DHCPClient)
|
|
||||||
add_subdirectory(EchoServer)
|
add_subdirectory(EchoServer)
|
||||||
add_subdirectory(FileSystemAccessServer)
|
|
||||||
add_subdirectory(FileOperation)
|
add_subdirectory(FileOperation)
|
||||||
add_subdirectory(ImageDecoder)
|
add_subdirectory(ImageDecoder)
|
||||||
add_subdirectory(InspectorServer)
|
add_subdirectory(InspectorServer)
|
||||||
add_subdirectory(KeyboardPreferenceLoader)
|
|
||||||
add_subdirectory(LaunchServer)
|
|
||||||
add_subdirectory(LoginServer)
|
|
||||||
add_subdirectory(LookupServer)
|
add_subdirectory(LookupServer)
|
||||||
add_subdirectory(NetworkServer)
|
|
||||||
add_subdirectory(NotificationServer)
|
|
||||||
add_subdirectory(RequestServer)
|
add_subdirectory(RequestServer)
|
||||||
add_subdirectory(SQLServer)
|
add_subdirectory(SQLServer)
|
||||||
add_subdirectory(SpiceAgent)
|
|
||||||
add_subdirectory(SystemServer)
|
|
||||||
add_subdirectory(Taskbar)
|
|
||||||
add_subdirectory(TelnetServer)
|
|
||||||
add_subdirectory(WebContent)
|
|
||||||
add_subdirectory(WebServer)
|
add_subdirectory(WebServer)
|
||||||
add_subdirectory(WebSocket)
|
add_subdirectory(WebSocket)
|
||||||
add_subdirectory(WindowServer)
|
|
||||||
|
if (SERENITYOS)
|
||||||
|
add_subdirectory(AudioServer)
|
||||||
|
add_subdirectory(ChessEngine)
|
||||||
|
add_subdirectory(Clipboard)
|
||||||
|
add_subdirectory(CrashDaemon)
|
||||||
|
add_subdirectory(DHCPClient)
|
||||||
|
add_subdirectory(FileSystemAccessServer)
|
||||||
|
add_subdirectory(KeyboardPreferenceLoader)
|
||||||
|
add_subdirectory(LaunchServer)
|
||||||
|
add_subdirectory(LoginServer)
|
||||||
|
add_subdirectory(NetworkServer)
|
||||||
|
add_subdirectory(NotificationServer)
|
||||||
|
add_subdirectory(SpiceAgent)
|
||||||
|
add_subdirectory(SystemServer)
|
||||||
|
add_subdirectory(Taskbar)
|
||||||
|
add_subdirectory(TelnetServer)
|
||||||
|
add_subdirectory(WebContent)
|
||||||
|
add_subdirectory(WindowServer)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue