Skip to content

Instantly share code, notes, and snippets.

@tonyrewin
Created August 24, 2018 21:14
Show Gist options
  • Save tonyrewin/ce5ce87c57b6f8ed51cada61c17b2284 to your computer and use it in GitHub Desktop.
Save tonyrewin/ce5ce87c57b6f8ed51cada61c17b2284 to your computer and use it in GitHub Desktop.
android cmake icu4c
cmake_minimum_required(VERSION 3.6)
set( CPP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp )
file( GLOB ICUUC_SRC ${CPP_DIR}/icu/source/common/*.cpp )
file( GLOB ICUI18N_SRC ${CPP_DIR}/icu/source/i18n/*.cpp )
add_library(icu SHARED
${ICUUC_SRC}
${ICUI18N_SRC}
${CPP_DIR}/icu/source/stubdata/stubdata.cpp
)
target_include_directories( icu PRIVATE
${CPP_DIR}/icu/sources/common
${CPP_DIR}/icu/sources/i18n
)
target_compile_definitions( icu PRIVATE
-DU_COMMON_IMPLEMENTATION
-DU_I18N_IMPLEMENTATION
-D__STDC_INT64__
)
target_compile_options( icu PRIVATE
-O3 -Os -fno-exceptions -fno-short-wchar -fno-short-enums -frtti
)
# NOTE: suppose icu4c sources downloaded to CPP_DIR
include_directories (
${CPP_DIR}
${CPP_DIR}/icu/source/common/unicode
${CPP_DIR}/icu/source/i18n/unicode
)
file( GLOB JNI_SRC
${CPP_DIR}/*.cpp
)
add_library( hello-jni
SHARED
${JNI_SRC}
)
find_library (log-lib log)
target_link_libraries( hello-jni icu ${log-lib} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment