Meta: Use add_serenity_directory for LibTimeZone

This lets us eliminate the "meta prefix" for the LibTimeZone generators.
This commit is contained in:
Andrew Kaster 2022-10-13 15:54:06 -06:00 committed by Linus Groh
parent f7f92f104f
commit a01c0e81f3
Notes: sideshowbarker 2024-07-17 05:42:19 +09:00
2 changed files with 9 additions and 23 deletions

View file

@ -68,30 +68,18 @@ if (ENABLE_TIME_ZONE_DATABASE_DOWNLOAD)
extract_tzdb_file("${TZDB_SOUTH_AMERICA_SOURCE}" "${TZDB_SOUTH_AMERICA_PATH}")
extract_tzdb_file("${TZDB_ZONE_1970_SOURCE}" "${TZDB_ZONE_1970_PATH}")
set(TIME_ZONE_DATA_HEADER LibTimeZone/TimeZoneData.h)
set(TIME_ZONE_DATA_IMPLEMENTATION LibTimeZone/TimeZoneData.cpp)
set(TIME_ZONE_META_TARGET_PREFIX LibTimeZone_)
if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibTimeZone") # Serenity build.
set(TIME_ZONE_DATA_HEADER TimeZoneData.h)
set(TIME_ZONE_DATA_IMPLEMENTATION TimeZoneData.cpp)
set(TIME_ZONE_META_TARGET_PREFIX "")
endif()
invoke_generator(
"TimeZoneData"
Lagom::GenerateTimeZoneData
"${TZDB_VERSION_FILE}"
"${TIME_ZONE_META_TARGET_PREFIX}"
"${TIME_ZONE_DATA_HEADER}"
"${TIME_ZONE_DATA_IMPLEMENTATION}"
""
"TimeZoneData.h"
"TimeZoneData.cpp"
arguments -z "${TZDB_ZONE_1970_PATH}" "${TZDB_AFRICA_PATH}" "${TZDB_ANTARCTICA_PATH}" "${TZDB_ASIA_PATH}" "${TZDB_AUSTRALASIA_PATH}" "${TZDB_BACKWARD_PATH}" "${TZDB_ETCETERA_PATH}" "${TZDB_EUROPE_PATH}" "${TZDB_NORTH_AMERICA_PATH}" "${TZDB_SOUTH_AMERICA_PATH}"
)
set(TIME_ZONE_DATA_SOURCES
${TIME_ZONE_DATA_HEADER}
${TIME_ZONE_DATA_IMPLEMENTATION}
"TimeZoneData.h"
"TimeZoneData.cpp"
)
endif()

View file

@ -143,6 +143,7 @@ include_directories(../../Userland/Services)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_BINARY_DIR}/Libraries)
include_directories(${CMAKE_BINARY_DIR}/Userland/Libraries)
include_directories(${CMAKE_BINARY_DIR}/Services)
# install rules, think about moving to its own helper cmake file
@ -298,12 +299,9 @@ add_serenity_subdirectory(Userland/Libraries/LibMain)
# LibTimeZone
# This is needed even if Lagom is not enabled because it is depended upon by code generators.
include(time_zone_data)
file(GLOB LIBTIMEZONE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibTimeZone/*.cpp")
lagom_lib(TimeZone timezone
SOURCES ${LIBTIMEZONE_SOURCES} ${TIME_ZONE_DATA_SOURCES}
)
target_compile_definitions(LibTimeZone PRIVATE ENABLE_TIME_ZONE_DATA=$<BOOL:${ENABLE_TIME_ZONE_DATABASE_DOWNLOAD}>)
add_serenity_subdirectory(Userland/Libraries/LibTimeZone)
# We need an install rule for LibTimeZone b/c it is a manual OBJECT library instead of serenity_lib
install(TARGETS LibTimeZone EXPORT LagomTargets)
# LibIDL
# This is used by the BindingsGenerator so needs to always be built.