mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Merge upstream/changelog-26.6 (9593 commits) into our debranded fork. - 190 conflicts resolved: 24 delete-side kept-removed (grpc/arrowflight/gcloud), submodules+version→26.6, contrib/CMakeLists keeps zap + new libpng, drops capnproto (zap provides kj), Server.cpp/CMakeLists re-apply the ZAP wiring + gRPC/arrowflight/gcloud removal. - Full-tree debrand re-swept over the new 26.6 code (uniform Datastore naming; Azure fork Clickhouse* symbols preserved). 0 clickhouse in product src/programs/CMakeLists. - Version now 26.6.1.1. gRPC/google-cloud/chdig stay removed; ZAP remains the transport.
77 lines
2.9 KiB
CMake
77 lines
2.9 KiB
CMake
set(LIBRARY_DIR "${Datastore_SOURCE_DIR}/contrib/cctz")
|
|
|
|
set (SRCS
|
|
"${LIBRARY_DIR}/src/civil_time_detail.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_fixed.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_format.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_if.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_impl.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_info.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_libc.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_lookup.cc"
|
|
"${LIBRARY_DIR}/src/time_zone_posix.cc"
|
|
"${LIBRARY_DIR}/src/zone_info_source.cc"
|
|
)
|
|
|
|
add_library (_cctz ${SRCS})
|
|
target_include_directories (_cctz PUBLIC "${LIBRARY_DIR}/include")
|
|
|
|
if (OS_FREEBSD)
|
|
# yes, need linux, because bsd check inside linux in time_zone_libc.cc:24
|
|
target_compile_definitions (_cctz PRIVATE __USE_BSD linux _XOPEN_SOURCE=600)
|
|
endif ()
|
|
|
|
# Related to time_zones table:
|
|
# TimeZones.generated.cpp is autogenerated each time during a build
|
|
set(TIMEZONES_FILE "${CMAKE_CURRENT_BINARY_DIR}/TimeZones.generated.cpp")
|
|
# remove existing copies so that its generated fresh on each build.
|
|
file(REMOVE ${TIMEZONES_FILE})
|
|
|
|
# get the list of timezones from tzdata shipped with cctz
|
|
set(TZDIR "${LIBRARY_DIR}/testdata/zoneinfo")
|
|
file(STRINGS "${LIBRARY_DIR}/testdata/version" TZDATA_VERSION)
|
|
set_property(GLOBAL PROPERTY TZDATA_VERSION_PROP "${TZDATA_VERSION}")
|
|
message(STATUS "Packaging with tzdata version: ${TZDATA_VERSION}")
|
|
|
|
# each file in that dir (except of tab and localtime) store the info about timezone
|
|
execute_process(COMMAND
|
|
bash -c "cd ${TZDIR} && find * -type f -and ! -name '*.tab' -and ! -name 'localtime' | LC_ALL=C sort | paste -sd ';' -"
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
OUTPUT_VARIABLE TIMEZONES
|
|
COMMAND_ERROR_IS_FATAL ANY
|
|
)
|
|
|
|
file(APPEND ${TIMEZONES_FILE} "// autogenerated by Datastore/contrib/cctz-cmake/CMakeLists.txt\n")
|
|
|
|
set (COUNTER 1)
|
|
foreach(TIMEZONE ${TIMEZONES})
|
|
file(APPEND ${TIMEZONES_FILE} "constexpr unsigned char resource_timezone${COUNTER}[] = {\n#embed \"${TZDIR}/${TIMEZONE}\"\n};\n")
|
|
MATH(EXPR COUNTER "${COUNTER}+1")
|
|
endforeach(TIMEZONE)
|
|
|
|
file(APPEND ${TIMEZONES_FILE} "const char * auto_time_zones[] {\n" )
|
|
|
|
foreach(TIMEZONE ${TIMEZONES})
|
|
file(APPEND ${TIMEZONES_FILE} " \"${TIMEZONE}\",\n")
|
|
MATH(EXPR COUNTER "${COUNTER}+1")
|
|
endforeach(TIMEZONE)
|
|
|
|
file(APPEND ${TIMEZONES_FILE} " nullptr\n};\n\n")
|
|
|
|
file(APPEND ${TIMEZONES_FILE} "#include <string_view>\n\n")
|
|
file(APPEND ${TIMEZONES_FILE} "std::string_view getTimeZone(const char * name)\n{\n" )
|
|
|
|
set (COUNTER 1)
|
|
foreach(TIMEZONE ${TIMEZONES})
|
|
file(APPEND ${TIMEZONES_FILE} " if (std::string_view(\"${TIMEZONE}\") == name) return { reinterpret_cast<const char *>(resource_timezone${COUNTER}), std::size(resource_timezone${COUNTER}) };\n")
|
|
MATH(EXPR COUNTER "${COUNTER}+1")
|
|
endforeach(TIMEZONE)
|
|
|
|
file(APPEND ${TIMEZONES_FILE} " return {};\n")
|
|
file(APPEND ${TIMEZONES_FILE} "}\n")
|
|
|
|
add_library (tzdata ${TIMEZONES_FILE})
|
|
target_link_libraries(_cctz tzdata)
|
|
|
|
add_library(ch_contrib::cctz ALIAS _cctz)
|