Created
October 29, 2020 16:42
-
-
Save qis/3659316142059cd2ec659cc826d34ebf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.19 FATAL_ERROR) | |
project(icu VERSION 68.1 LANGUAGES C CXX) | |
# Library: icudt | |
file(GLOB dt_sources src/source/stubdata/*.cpp) | |
add_library(dt SHARED ${headers} ${dt_sources}) | |
set_target_properties(dt PROPERTIES OUTPUT_NAME "icudt" INSTALL_RPATH "$ORIGIN") | |
# Library: icuuc | |
file(GLOB uc_sources src/source/common/*.cpp) | |
add_library(uc SHARED ${headers} ${uc_sources}) | |
set_target_properties(uc PROPERTIES OUTPUT_NAME "icuuc" INSTALL_RPATH "$ORIGIN") | |
target_link_libraries(uc PUBLIC icu::dt) | |
# Library: icuin | |
file(GLOB in_sources src/source/i18n/*.cpp) | |
add_library(in SHARED ${headers} ${in_sources}) | |
set_target_properties(in PROPERTIES OUTPUT_NAME "icuin" INSTALL_RPATH "$ORIGIN") | |
target_link_libraries(in PUBLIC icu::uc) | |
# Library: icuio | |
file(GLOB io_sources src/source/io/*.cpp) | |
add_library(io SHARED ${headers} ${io_sources}) | |
set_target_properties(io PROPERTIES OUTPUT_NAME "icuio" INSTALL_RPATH "$ORIGIN") | |
target_link_libraries(io PUBLIC icu::uc icu::in) | |
# Library: icutu | |
file(GLOB tu_sources src/source/tools/toolutil/*.cpp) | |
add_library(tu SHARED ${headers} ${tu_sources}) | |
set_target_properties(tu PROPERTIES OUTPUT_NAME "icutu" INSTALL_RPATH "$ORIGIN") | |
target_link_libraries(tu PUBLIC icu::uc icu::in) | |
# Data | |
add_executable(icupkg src/source/tools/icupkg/icupkg.cpp) | |
target_link_libraries(icupkg PRIVATE dt uc in io tu) | |
add_custom_command(DEPENDS icupkg COMMAND $<TARGET_FILE:icupkg> | |
-d out/build/icudt${PROJECT_VERSION_MAJOR}l --list | |
-x "*" ${CMAKE_CURRENT_SOURCE_DIR}/src/source/data/in/icudt${PROJECT_VERSION_MAJOR}l.dat | |
-o out/tmp/icudata.lst | |
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/source/data/in/icudt${PROJECT_VERSION_MAJOR}l.dat | |
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/out/tmp/icudata.lst | |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data) | |
add_executable(pkgdata src/source/tools/pkgdata/pkgdata.cpp src/source/tools/pkgdata/pkgtypes.c) | |
target_link_libraries(pkgdata PRIVATE dt uc in io tu) | |
add_custom_command(TARGET dt POST_BUILD | |
COMMAND $<TARGET_FILE:pkgdata> | |
-O icupkg.inc # ICU directory | |
-v # quiet (q) or verbose (v) | |
-c # copiright | |
-s out/build/icudt${PROJECT_VERSION_MAJOR}l # source directory | |
-d $<TARGET_FILE_DIR:dt> # destination directory | |
-r ${PROJECT_VERSION_MAJOR} # revision | |
-e icudt # entry point and export library name | |
-p icudt${PROJECT_VERSION_MAJOR}l # data name | |
-T out/tmp # temporary directory | |
-m dll # mode | |
-L icudt # import library name | |
out/tmp/icudata.lst | |
COMMAND ${CMAKE_COMMAND} -E copy out/build/icudt${PROJECT_VERSION_MAJOR}l/icudt.dll $<TARGET_FILE_DIR_DIR:dt> | |
COMMAND ${CMAKE_COMMAND} -E copy out/build/icudt${PROJECT_VERSION_MAJOR}l/icudt.lib $<TARGET_FILE_DIR_DIR:dt> | |
DEPENDS pkgdata ${CMAKE_CURRENT_BINARY_DIR}/data/out/tmp/icudata.lst | |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data) | |
# Install | |
install(TARGETS dt uc in io tu EXPORT icu | |
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | |
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | |
install(DIRECTORY src/source/common/unicode | |
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | |
CONFIGURATIONS Debug) | |
install(EXPORT icu FILE icu-config.cmake NAMESPACE icu:: | |
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/icu) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment