From 1b7bfb5e1864fc355715b536faac6693b5ce0218 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 30 Oct 2018 10:19:40 +0330 Subject: [PATCH] [cmake] Make build of tests and subset optional (#1329) --- .circleci/config.yml | 2 +- CMakeLists.txt | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 46fb65b2e..8ed1c3940 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,7 @@ jobs: # not needed to be a framework but we like to test that also # TODO: wrong way of targeting iOS as it doesn't point to iOS headers thus building # CoreText support is not possible, after the fix feel free HB_IOS from CMake altogether - - run: cmake -DBUILD_FRAMEWORK=ON -H. -Bbuild -GXcode -DHB_IOS=ON + - run: cmake -DBUILD_FRAMEWORK=ON -H. -Bbuild -GXcode -DHB_HAVE_CORETEXT=OFF -DHB_BUILD_SUBSET=OFF -DHB_BUILD_TESTS=OFF - run: cd build && xcodebuild -sdk iphoneos12.0 -configuration Release build -arch arm64 distcheck: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eb23af4d..019e205bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,9 @@ if (HB_BUILD_UTILS) set (HB_HAVE_FREETYPE ON) endif () +option(HB_BUILD_SUBSET "Build harfbuzz-subset" ON) +option(HB_BUILD_TESTS "Build harfbuzz tests" ON) + option(HB_HAVE_GOBJECT "Enable GObject Bindings" OFF) if (HB_HAVE_GOBJECT) set (HB_HAVE_GLIB ON) @@ -82,16 +85,6 @@ if (HB_CHECK) endif () endif () -set (HB_DISABLE_SUBSET OFF) -set (HB_DISABLE_TESTS OFF) -option(HB_IOS "Apply iOS specific build flags" OFF) -if (HB_IOS) - # We should fix their issue and enable them - set (HB_DISABLE_SUBSET ON) - set (HB_DISABLE_TESTS ON) - set (HB_HAVE_CORETEXT OFF) -endif () - include_directories(AFTER ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src @@ -556,7 +549,7 @@ add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_heade target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS}) ## Define harfbuzz-subset library -if (NOT HB_DISABLE_SUBSET) +if (HB_BUILD_SUBSET) add_library(harfbuzz-subset ${subset_project_sources} ${subset_project_headers}) add_dependencies(harfbuzz-subset harfbuzz) target_link_libraries(harfbuzz-subset harfbuzz ${THIRD_PARTY_LIBS}) @@ -580,7 +573,7 @@ if (UNIX OR MINGW) set (CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "m") # libm set (CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "") set_target_properties(harfbuzz PROPERTIES LINKER_LANGUAGE C) - if (NOT HB_DISABLE_SUBSET) + if (HB_BUILD_SUBSET) set_target_properties(harfbuzz-subset PROPERTIES LINKER_LANGUAGE C) endif () @@ -861,7 +854,7 @@ if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja") endif () -if (NOT HB_DISABLE_TESTS) +if (HB_BUILD_TESTS) ## src/ executables foreach (prog main test test-would-substitute test-size-params test-buffer-serialize hb-ot-tag test-unicode-ranges) set (prog_name ${prog})