Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework build system to use prebuilt ICU4C #10

Merged
merged 5 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:

- name: "Set up CMake and Ninja"
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.26.0"

- name: "CMake: Configure release"
run: |
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[submodule "icu4c"]
path = icu4c
url = https://github.com/florisboard/icu4c.git
[submodule "external/termbox2"]
path = external/termbox2
url = https://github.com/termbox/termbox2
[submodule "thread-pool/thread-pool"]
path = external/thread-pool
url = https://github.com/bshoshany/thread-pool.git
[submodule "icu4c/icu"]
path = icu4c/icu
url = https://github.com/unicode-org/icu
[submodule "external/nlohmann-json"]
path = external/nlohmann-json
url = https://github.com/nlohmann/json
Expand Down
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if (NOT ANDROID)
if(NOT ANDROID)
cmake_minimum_required(VERSION 3.26)
else()
cmake_minimum_required(VERSION 3.22)
Expand All @@ -10,7 +10,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
find_package(Python 3.10...<4 REQUIRED COMPONENTS Interpreter)

include(EnforceSystemEnv)
if (NOT ANDROID)
if(NOT ANDROID)
include(CxxModules)
else()
include(RewriteCppmToHeader)
Expand All @@ -32,12 +32,12 @@ get_filename_component(LLVM_TOOLCHAIN ${LLVM_TOOLCHAIN} DIRECTORY)

# We MUST disable json ranges support else this project will not compile properly with clang-16.
# See also: external/nlohmann-json/docs/mkdocs/docs/api/macros/json_has_ranges.md
if (NOT ANDROID)
if(NOT ANDROID)
set(FLORIS_COMPILE_OPTIONS -stdlib=libc++ -DJSON_HAS_RANGES=0)
set(FLORIS_LINK_OPTIONS -lc++)
else()
set(FLORIS_COMPILE_OPTIONS -DJSON_HAS_RANGES=0)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(FLORIS_LINK_OPTIONS
-Wl,--gc-sections,-rpath-link=${LLVM_TOOLCHAIN}/sysroot/usr/lib
-lc -lstdc++)
Expand All @@ -56,21 +56,21 @@ add_link_options(${FLORIS_LINK_OPTIONS})
# add_compile_options(-gdwarf-4)

# Set up static/shared library vars
if (BUILD_SHARED_LIBS)
if(BUILD_SHARED_LIBS)
set(FLORIS_LIBRARY_TYPE SHARED)
set(FLORIS_LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
set(FLORIS_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(FLORIS_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
else ()
else()
set(FLORIS_LIBRARY_TYPE STATIC)
set(FLORIS_LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(FLORIS_LIBRARY_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
if (NOT ANDROID)
if(NOT ANDROID)
set(FLORIS_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
else()
set(FLORIS_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
endif()
endif ()
endif()

# External libraries
add_subdirectory(external)
Expand All @@ -79,6 +79,6 @@ add_subdirectory(icu4c)
# Internal libraries
add_subdirectory(icuext)
add_subdirectory(nlpcore)
if (NOT ANDROID)
if(NOT ANDROID)
add_subdirectory(nlptools)
endif()
3 changes: 2 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_SHARED_LIBS": true,
"BUILD_SHARED_LIBS": false,
"ICU_BUILD_FROM_SOURCE": false,
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API": "2182bf5c-ef0d-489a-91da-49dbc3090d2a",
Expand Down
1 change: 1 addition & 0 deletions icu4c
Submodule icu4c added at 697809
211 changes: 0 additions & 211 deletions icu4c/CMakeLists.txt

This file was deleted.

67 changes: 0 additions & 67 deletions icu4c/data-feature-filter.json

This file was deleted.

1 change: 0 additions & 1 deletion icu4c/icu
Submodule icu deleted from 5861e1
2 changes: 1 addition & 1 deletion icuext/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ target_module_sources(fl_icuext PUBLIC
udata.cppm
utext.cppm
)
target_link_icu4c_libraries(fl_icuext PUBLIC FlorisICU::uc FlorisICU::data)
target_link_libraries(fl_icuext PUBLIC FlorisICU::uc FlorisICU::data)
target_link_libraries(fl_icuext PUBLIC nlohmann_json::nlohmann_json)
Loading