This commit is contained in:
Clemens Wasser 2025-04-03 16:04:45 -07:00 committed by GitHub
commit 03607e656e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 524 additions and 1 deletions

View file

@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.16)
project(icu4c)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_library(icu_defaults INTERFACE)
target_compile_definitions(icu_defaults INTERFACE U_ATTRIBUTE_DEPRECATED=)
if(WIN32)
target_compile_definitions(icu_defaults INTERFACE
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:U_STATIC_IMPLEMENTATION>
WIN64
WIN32
WINVER=0x0601
_WIN32_WINNT=0x0601
_CRT_SECURE_NO_DEPRECATE
_MBCS
_HAS_EXCEPTIONS=0
$<$<CONFIG:Debug>:_DEBUG>)
else()
target_compile_definitions(icu_defaults INTERFACE
_REENTRANT U_HAVE_ELF_H=1 U_HAVE_STRTOD_L=1 U_HAVE_XLOCALE_H=0)
endif()
if(MSVC)
target_compile_options(icu_defaults INTERFACE /utf-8)
endif()
add_library(icu_lib_defaults INTERFACE)
target_link_libraries(icu_lib_defaults INTERFACE icu_defaults)
if(WIN32)
target_compile_definitions(icu_lib_defaults INTERFACE _HAS_EXCEPTIONS=0)
endif()
macro(icu_add_sources target_name)
file(STRINGS sources.txt sources)
target_sources("${target_name}" PRIVATE "${sources}")
endmacro()
add_subdirectory(common)
add_subdirectory(i18n)
add_subdirectory(io)
add_subdirectory(tools)
add_subdirectory(stubdata)
include(CTest)
if(BUILD_TESTING)
add_test(NAME icuinfo COMMAND icuinfo WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_subdirectory(test)
endif()

View file

@ -0,0 +1,9 @@
add_library(icuuc)
icu_add_sources(icuuc)
target_link_libraries(icuuc PRIVATE icu_defaults icu_lib_defaults icudt)
target_include_directories(icuuc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(icuuc PRIVATE U_COMMON_IMPLEMENTATION)
if(WIN32)
target_compile_definitions(icuuc PRIVATE $<$<CONFIG:Debug>:RBBI_DEBUG> U_PLATFORM_USES_ONLY_WIN32_API=1)
endif()

View file

@ -284,7 +284,13 @@ ICU_DATA_BUILD_VERBOSE=
# Three main targets: tools, core data, and test data.
# Keep track of whether they are built via timestamp files.
$(TOOLS_TS): "$(ICUTOOLS)\genrb\$(CFGTOOLS)\genrb.exe" "$(ICUTOOLS)\gencnval\$(CFGTOOLS)\gencnval.exe" "$(ICUTOOLS)\gencfu\$(CFGTOOLS)\gencfu.exe" "$(ICUTOOLS)\icupkg\$(CFGTOOLS)\icupkg.exe" "$(ICUTOOLS)\makeconv\$(CFGTOOLS)\makeconv.exe" "$(ICUPBIN)\pkgdata.exe"
GENRB_DIR=$(ICUTOOLS)\genrb\$(CFGTOOLS)
GENCNVAL_DIR=$(ICUTOOLS)\gencnval\$(CFGTOOLS)
GENCFU_DIR=$(ICUTOOLS)\gencfu\$(CFGTOOLS)
ICUPKG_DIR=$(ICUTOOLS)\icupkg\$(CFGTOOLS)
MAKECONV_DIR=$(ICUTOOLS)\makeconv\$(CFGTOOLS)
$(TOOLS_TS): "$(GENRB_DIR)\genrb.exe" "$(GENCNVAL_DIR)\gencnval.exe" "$(GENCFU_DIR)\gencfu.exe" "$(ICUPKG_DIR)\icupkg.exe" "$(MAKECONV_DIR)\makeconv.exe" "$(ICUPBIN)\pkgdata.exe"
@echo "timestamp" > $(TOOLS_TS)
# On Unix, Python generates at configure time a list of Makefile rules.

View file

@ -0,0 +1,5 @@
add_library(icui18n)
icu_add_sources(icui18n)
target_link_libraries(icui18n PRIVATE icu_lib_defaults icuuc)
target_compile_definitions(icui18n PRIVATE U_I18N_IMPLEMENTATION)
target_include_directories(icui18n PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -0,0 +1,5 @@
add_library(icuio)
icu_add_sources(icuio)
target_link_libraries(icuio PRIVATE icu_lib_defaults icuuc icui18n)
target_compile_definitions(icuio PRIVATE U_IO_IMPLEMENTATION)
target_include_directories(icuio PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -0,0 +1,10 @@
add_library(icudt)
icu_add_sources(icudt)
target_link_libraries(icudt PRIVATE icu_lib_defaults icuuc)
target_compile_definitions(icudt PRIVATE U_COMMON_IMPLEMENTATION)
add_custom_command(
TARGET icudt POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "File with stubdata build time, used as a dependency to trigger fresh data build, since stubdata dll will overwrite the real one." > "${CMAKE_CURRENT_LIST_DIR}/stubdatabuilt.txt"
WORKING_DIRECTORY ${icu4c_SOURCE_DIR}/extra/uconv
VERBATIM)

View file

@ -0,0 +1,8 @@
add_subdirectory(cintltst)
add_subdirectory(compat)
add_subdirectory(fuzzer)
add_subdirectory(intltest)
add_subdirectory(iotest)
#add_subdirectory(letest)
add_subdirectory(testmap)
#add_subdirectory(thaitest)

View file

@ -0,0 +1,96 @@
add_executable(cintltst)
target_link_libraries(cintltst PRIVATE icu_defaults icuuc ctestfw icui18n toolutil)
if(BUILD_TESTING)
add_test(NAME cintltst COMMAND cintltst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
target_sources(cintltst PRIVATE
bocu1tst.c
callcoll.c
calltest.c
capitst.c
cbiapts.c
cbididat.c
cbiditransformtst.c
cbiditst.c
cbkittst.c
ccaltst.c
ccapitst.c
ccolltst.c
cconvtst.c
cctest.c
ccurrtst.c
cdateintervalformattest.c
cdattst.c
cdetst.c
cdtdptst.c
cdtrgtst.c
cestst.c
cfintst.c
cformtst.c
cfrtst.c
cg7coll.c
cgendtst.c
chashtst.c
cintltst.c
citertst.c
cjaptst.c
cldrtest.c
cloctst.c
cmsccoll.c
cmsgtst.c
cnmdptst.c
cnormtst.c
cnumtst.c
cpluralrulestest.c
cposxtst.c
crelativedateformattest.c
crestst.c
creststn.c
cstrcase.c
cstrtest.c
cturtst.c
cucdapi.c
cucdtst.c
currtest.c
custrtrn.c
custrtst.c
cutiltst.c
encoll.c
eurocreg.c
hpmufn.c
idnatest.c
nccbtst.c
ncnvfbts.c
ncnvtst.c
nfsprep.c
nucnvtst.c
putiltst.c
reapits.c
sorttest.c
spooftest.c
spreptst.c
sprpdata.c
stdnmtst.c
tracetst.c
trie2test.c
trietest.c
ucnvseltst.c
ucptrietest.c
ucsdetst.c
udatatst.c
udatpg_test.c
uenumtst.c
uformattedvaluetst.c
ulistfmttest.c
unumberformattertst.c
unumberrangeformattertst.c
uregiontest.c
usettest.c
usrchtst.c
utexttst.c
utf16tst.c
utf8tst.c
utmstest.c
utransts.c)

View file

@ -0,0 +1,2 @@
add_executable(compat tzdate.c)
target_link_libraries(compat PRIVATE icu_defaults icuuc icui18n)

View file

@ -0,0 +1,22 @@
add_library(fuzzer fuzzer_driver.cpp locale_util.cpp)
target_link_libraries(fuzzer PRIVATE icu_defaults icuuc)
function(add_fuzzer fuzzer_name)
add_executable(${fuzzer_name} ${fuzzer_name}.cpp)
target_link_libraries(${fuzzer_name} PRIVATE icu_defaults icuuc icui18n fuzzer)
endfunction()
add_fuzzer(break_iterator_fuzzer)
add_fuzzer(collator_compare_fuzzer)
add_fuzzer(collator_rulebased_fuzzer)
add_fuzzer(converter_fuzzer)
add_fuzzer(locale_fuzzer)
add_fuzzer(number_format_fuzzer)
add_fuzzer(ucasemap_fuzzer)
add_fuzzer(uloc_canonicalize_fuzzer)
add_fuzzer(uloc_for_language_tag_fuzzer)
add_fuzzer(uloc_get_name_fuzzer)
add_fuzzer(uloc_is_right_to_left_fuzzer)
add_fuzzer(uloc_open_keywords_fuzzer)
add_fuzzer(unicode_string_codepage_create_fuzzer)
add_fuzzer(uregex_open_fuzzer)

View file

@ -0,0 +1,177 @@
add_executable(intltest)
target_link_libraries(intltest PRIVATE icu_defaults ctestfw icuuc icui18n toolutil)
if(BUILD_TESTING)
add_test(NAME intltest COMMAND intltest WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
target_sources(intltest PRIVATE
aliastst.cpp
allcoll.cpp
alphaindextst.cpp
apicoll.cpp
astrotst.cpp
bidiconf.cpp
bytestrietest.cpp
calcasts.cpp
callimts.cpp
calregts.cpp
caltest.cpp
caltztst.cpp
canittst.cpp
citrtest.cpp
collationtest.cpp
colldata.cpp
compactdecimalformattest.cpp
convtest.cpp
cpdtrtst.cpp
csdetest.cpp
currcoll.cpp
dadrcal.cpp
dadrfmt.cpp
datadrivennumberformattestsuite.cpp
dcfmapts.cpp
dcfmtest.cpp
decoll.cpp
displayoptions_test.cpp
dtfmapts.cpp
dtfmrgts.cpp
dtfmtrtts.cpp
dtfmttst.cpp
dtifmtts.cpp
dtptngts.cpp
encoll.cpp
erarulestest.cpp
escoll.cpp
ficoll.cpp
fldset.cpp
formatted_string_builder_test.cpp
formattedvaluetest.cpp
frcoll.cpp
g7coll.cpp
genderinfotest.cpp
icusvtst.cpp
idnaconf.cpp
idnaref.cpp
incaltst.cpp
intltest.cpp
itercoll.cpp
itformat.cpp
itmajor.cpp
itrbbi.cpp
itrbnf.cpp
itrbnfp.cpp
itrbnfrt.cpp
itspoof.cpp
ittrans.cpp
itutil.cpp
jacoll.cpp
jamotest.cpp
lcukocol.cpp
listformattertest.cpp
localebuildertest.cpp
localematchertest.cpp
locnmtst.cpp
loctest.cpp
lstmbetst.cpp
measfmttest.cpp
miscdtfm.cpp
mnkytst.cpp
msfmrgts.cpp
nmfmapts.cpp
nmfmtrt.cpp
normconf.cpp
nptrans.cpp
numberformattesttuple.cpp
numbertest_affixutils.cpp
numbertest_api.cpp
numbertest_decimalquantity.cpp
numbertest_doubleconversion.cpp
numbertest_modifiers.cpp
numbertest_parse.cpp
numbertest_patternmodifier.cpp
numbertest_patternstring.cpp
numbertest_permutation.cpp
numbertest_range.cpp
numbertest_simple.cpp
numbertest_skeletons.cpp
numfmtdatadriventest.cpp
numfmtspectest.cpp
numfmtst.cpp
numrgts.cpp
pluralmaptest.cpp
plurfmts.cpp
plurults.cpp
pptest.cpp
punyref.cpp
quantityformattertest.cpp
rbbiapts.cpp
rbbimonkeytest.cpp
rbbitst.cpp
regcoll.cpp
regextst.cpp
regiontst.cpp
reldatefmttest.cpp
reptest.cpp
restest.cpp
restsnew.cpp
scientificnumberformattertest.cpp
sdtfmtts.cpp
selfmts.cpp
sfwdchit.cpp
simpleformattertest.cpp
simplethread.cpp
srchtest.cpp
ssearch.cpp
static_unisets_test.cpp
strcase.cpp
string_segment_test.cpp
strtest.cpp
svccoll.cpp
tchcfmt.cpp
testidn.cpp
testidna.cpp
testutil.cpp
textfile.cpp
tfsmalls.cpp
thcoll.cpp
tmsgfmt.cpp
tokiter.cpp
transapi.cpp
transrt.cpp
transtst.cpp
trcoll.cpp
trnserr.cpp
tscoll.cpp
tsdate.cpp
tsdcfmsy.cpp
tsdtfmsy.cpp
tsmthred.cpp
tsnmfmt.cpp
tsputil.cpp
tstnorm.cpp
tstnrapi.cpp
tufmtts.cpp
tzbdtest.cpp
tzfmttst.cpp
tzoffloc.cpp
tzregts.cpp
tzrulets.cpp
tztest.cpp
ucaconf.cpp
ucdtest.cpp
ucharstrietest.cpp
unifiedcachetest.cpp
units_data_test.cpp
units_router_test.cpp
units_test.cpp
uobjtest.cpp
usettest.cpp
ustrtest.cpp
uts46test.cpp
utxttest.cpp
uvectest.cpp
v32test.cpp
windttst.cpp
winnmtst.cpp
winutil.cpp)

View file

@ -0,0 +1,6 @@
add_executable(iotest filetst.c iotest.cpp stream.cpp strtst.c trnstst.c)
target_link_libraries(iotest icu_defaults icuuc ctestfw icuio icui18n)
if(BUILD_TESTING)
add_test(NAME iotest COMMAND iotest WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()

View file

@ -0,0 +1,15 @@
add_executable(letest)
target_link_libraries(letest icu_defaults)
target_sources(letest PRIVATE
FontObject.cpp
FontTableCache.cpp
PortableFontInstance.cpp
SimpleFontInstance.cpp
cfonts.cpp
cletest.c
cmaps.cpp
gendata.cpp
letest.cpp
letsutil.cpp
testdata.cpp
xmlreader.cpp)

View file

@ -0,0 +1,2 @@
add_executable(testmap testmap.c)
target_link_libraries(testmap icu_defaults icuuc)

View file

@ -0,0 +1,2 @@
add_executable(thaitest thaitest.cpp)
target_link_libraries(thaitest icu_defaults)

View file

@ -0,0 +1,19 @@
add_subdirectory(ctestfw)
add_subdirectory(genbrk)
add_subdirectory(genccode)
add_subdirectory(gencfu)
add_subdirectory(gencmn)
add_subdirectory(gencnval)
add_subdirectory(gendict)
add_subdirectory(gennorm2)
add_subdirectory(genrb)
add_subdirectory(gensprep)
add_subdirectory(gentest)
add_subdirectory(icuexportdata)
add_subdirectory(icuinfo)
add_subdirectory(icupkg)
add_subdirectory(icuswap)
add_subdirectory(makeconv)
add_subdirectory(pkgdata)
add_subdirectory(toolutil)
add_subdirectory(tzcode)

View file

@ -0,0 +1,5 @@
add_library(ctestfw)
icu_add_sources(ctestfw)
target_link_libraries(ctestfw PRIVATE icu_defaults icuuc toolutil)
target_include_directories(ctestfw PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(ctestfw PRIVATE T_CTEST_IMPLEMENTATION)

View file

@ -0,0 +1,3 @@
add_executable(genbrk)
icu_add_sources(genbrk)
target_link_libraries(genbrk PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(genccode)
icu_add_sources(genccode)
target_link_libraries(genccode PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(gencfu)
icu_add_sources(gencfu)
target_link_libraries(gencfu PRIVATE icu_defaults icuuc toolutil icui18n)

View file

@ -0,0 +1,3 @@
add_executable(gencmn)
icu_add_sources(gencmn)
target_link_libraries(gencmn PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(gencnval)
icu_add_sources(gencnval)
target_link_libraries(gencnval PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(gendict)
icu_add_sources(gendict)
target_link_libraries(gendict PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(gennorm2)
icu_add_sources(gennorm2)
target_link_libraries(gennorm2 PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,6 @@
add_executable(genrb)
icu_add_sources(genrb)
target_link_libraries(genrb PRIVATE icu_defaults icuuc toolutil icui18n)
add_executable(derb derb.cpp)
target_link_libraries(derb PRIVATE icu_defaults icuuc toolutil icuio icui18n)

View file

@ -0,0 +1,3 @@
add_executable(gensprep)
icu_add_sources(gensprep)
target_link_libraries(gensprep PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(gentest)
icu_add_sources(gentest)
target_link_libraries(gentest PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(icuexportdata)
icu_add_sources(icuexportdata)
target_link_libraries(icuexportdata PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,6 @@
add_executable(icuinfo)
icu_add_sources(icuinfo)
target_link_libraries(icuinfo PRIVATE icu_defaults icuuc toolutil icui18n)
add_library(testplug testplug.c)
target_link_libraries(testplug PRIVATE icu_lib_defaults icuuc)

View file

@ -0,0 +1,3 @@
add_executable(icupkg)
icu_add_sources(icupkg)
target_link_libraries(icupkg PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(icuswap)
icu_add_sources(icuswap)
target_link_libraries(icuswap PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,3 @@
add_executable(makeconv)
icu_add_sources(makeconv)
target_link_libraries(makeconv PRIVATE icu_defaults icuuc toolutil)

View file

@ -0,0 +1,20 @@
add_executable(pkgdata)
icu_add_sources(pkgdata)
target_link_libraries(pkgdata PRIVATE icu_defaults icuuc toolutil)
add_dependencies(pkgdata gencnval)
add_custom_command(
TARGET pkgdata POST_BUILD
COMMAND nmake /nologo /f ${icu4c_SOURCE_DIR}/data/makedata.mak
ICUMAKE=${icu4c_SOURCE_DIR}/data
DLL_OUTPUT=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
ICUPBIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
GENRB_DIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
GENCNVAL_DIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
GENCFU_DIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
ICUPKG_DIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
MAKECONV_DIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
CFG=${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}\\$<CONFIG>
$<$<CONFIG:Debug>:DEBUG=true>
VERBATIM)

View file

@ -0,0 +1,5 @@
add_library(toolutil)
icu_add_sources(toolutil)
target_link_libraries(toolutil PRIVATE icu_lib_defaults icuuc icui18n)
target_include_directories(toolutil PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(toolutil PRIVATE U_TOOLUTIL_IMPLEMENTATION)

View file

@ -0,0 +1,3 @@
add_executable(icuzdump icuzdump.cpp)
target_link_libraries(icuzdump PRIVATE
icu_defaults icuuc toolutil icui18n icuio)