diff --git a/.circleci/config.yml b/.circleci/config.yml index 93913a823..2a82abaad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ jobs: - checkout - run: apt update && apt install -y pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev - run: ./autogen.sh && make distcheck - - run: make distdir && cd harfbuzz-* && cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GLIB=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && ninja -Cbuild install + - run: make distdir && cd harfbuzz-* && cmake -DDHB_CHECK=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && ninja -Cbuild install psvita: docker: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b713b638..ebbfbe3ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,25 @@ if (HB_HAVE_INTROSPECTION) set (HB_HAVE_GLIB ON) endif () +option(HB_CHECK OFF "Do a configuration suitable for testing (shared library and enable all options)") +if (HB_CHECK) + set (BUILD_SHARED_LIBS ON) + set (HB_BUILD_UTILS ON) + set (HB_BUILTIN_UCDN ON) + set (HB_HAVE_ICU) + set (HB_HAVE_GLIB ON) + #set (HB_HAVE_GOBJECT ON) + #set (HB_HAVE_INTROSPECTION ON) + set (HB_HAVE_FREETYPE ON) + set (HB_HAVE_GRAPHITE2 ON) + if (WIN32) + set (HB_HAVE_UNISCRIBE ON) + set (HB_HAVE_DIRECTWRITE ON) + elseif (APPLE) + set (HB_HAVE_CORETEXT ON) + endif () +endif () + include_directories(AFTER ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src @@ -71,6 +90,9 @@ add_definitions(-DHAVE_FALLBACK) if (BUILD_SHARED_LIBS) add_definitions(-DHAVE_ATEXIT) + if (APPLE) + set (CMAKE_MACOSX_RPATH ON) + endif () endif () if (MSVC) @@ -710,23 +732,31 @@ if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja") endif () endif () + ## Tests if (UNIX) if (BUILD_SHARED_LIBS) - add_test(NAME check-static-inits.sh - COMMAND ${PROJECT_SOURCE_DIR}/src/check-static-inits.sh - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles/harfbuzz.dir/src # hack - ) # does some "make" stuff inside - # add_test(NAME check-defs.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-defs.sh) - add_test(NAME check-libstdc++.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-libstdc++.sh) - add_test(NAME check-symbols.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-symbols.sh) + #add_test(NAME check-defs.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-defs.sh) + #set_tests_properties(check-defs.sh PROPERTIES ENVIRONMENT "libs=.") + + # broken on cmake builds right now :( + #add_test(NAME check-symbols.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-symbols.sh) + #add_test(NAME check-libstdc++.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-libstdc++.sh) + #set_tests_properties(check-symbols.sh check-libstdc++.sh PROPERTIES ENVIRONMENT "libs=.") + + if (NOT APPLE) + add_test(NAME check-static-inits.sh + COMMAND ${PROJECT_SOURCE_DIR}/src/check-static-inits.sh + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles/harfbuzz.dir/src # ugly hack + ) + set_tests_properties(check-static-inits.sh PROPERTIES ENVIRONMENT "libs=.") + endif () else () - message(WARN "You can enable BUILD_SHARED_LIBS for more tests.") + message(WARN "Enable BUILD_SHARED_LIBS for more tests.") endif () - # disabled as it doesn't work anyway - if (OFF AND IN_HB_DIST) + if (IN_HB_DIST) add_test(NAME check-c-linkage-decls.sh COMMAND ./check-c-linkage-decls.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src) add_test(NAME check-header-guards.sh COMMAND ./check-header-guards.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src) endif () @@ -737,4 +767,4 @@ endif () # Needs to come last so that variables defined above are passed to # subdirectories. -add_subdirectory(test) +add_subdirectory(test) \ No newline at end of file diff --git a/autogen.sh b/autogen.sh index ff1b0c0c9..cbc8627d5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -42,5 +42,7 @@ echo "running autoreconf --force --install --verbose" autoreconf --force --install --verbose || exit $? cd $olddir -echo "running configure $@" -test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" +test -n "$NOCONFIGURE" || { + echo "running configure $@" + "$srcdir/configure" "$@" +} diff --git a/src/Makefile.am b/src/Makefile.am index b34d94210..b62e7d0ab 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -134,7 +134,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = harfbuzz.pc EXTRA_DIST += harfbuzz.pc.in -FUZZING_CPPFLAGS= \ +FUZZING_CPPFLAGS = \ -DHB_NDEBUG \ -DHB_MAX_NESTING_LEVEL=3 \ -DHB_SANITIZE_MAX_EDITS=3 \ @@ -324,7 +324,6 @@ test_ot_tag_LDADD = libharfbuzz.la $(HBLIBS) TESTS = $(dist_check_SCRIPTS) $(check_PROGRAMS) TESTS_ENVIRONMENT = \ srcdir="$(srcdir)" \ - libs=".libs" \ MAKE="$(MAKE) $(AM_MAKEFLAGS)" \ HBSOURCES="$(HBSOURCES)" \ HBHEADERS="$(HBHEADERS) $(HBNODISTHEADERS)" \ diff --git a/src/check-defs.sh b/src/check-defs.sh index ee2cafed8..c7eac3551 100755 --- a/src/check-defs.sh +++ b/src/check-defs.sh @@ -4,7 +4,7 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. -test -z "$libs" && libs=. +test -z "$libs" && libs=.libs test -z "$MAKE" && MAKE=make stat=0 diff --git a/src/check-header-guards.sh b/src/check-header-guards.sh index 355d81b52..b67640fc1 100755 --- a/src/check-header-guards.sh +++ b/src/check-header-guards.sh @@ -6,7 +6,7 @@ export LC_ALL test -z "$srcdir" && srcdir=. stat=0 -test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h'` +test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h' ! -name 'hb-gobject-structs.h'` test "x$HBSOURCES" = x && HBSOURCES=`cd "$srcdir"; find . -maxdepth 1 -name 'hb-*.cc' -or -name 'hb-*.hh'` for x in $HBHEADERS $HBSOURCES; do diff --git a/src/check-libstdc++.sh b/src/check-libstdc++.sh index 9d73814e1..4295180c4 100755 --- a/src/check-libstdc++.sh +++ b/src/check-libstdc++.sh @@ -4,7 +4,7 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. -test -z "$libs" && libs=. +test -z "$libs" && libs=.libs stat=0 diff --git a/src/check-static-inits.sh b/src/check-static-inits.sh index aa1b129d1..71551cbd4 100755 --- a/src/check-static-inits.sh +++ b/src/check-static-inits.sh @@ -4,7 +4,7 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. -test -z "$libs" && libs=. +test -z "$libs" && libs=.libs stat=0 diff --git a/src/check-symbols.sh b/src/check-symbols.sh index f1bba470e..3adf65f87 100755 --- a/src/check-symbols.sh +++ b/src/check-symbols.sh @@ -4,7 +4,7 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. -test -z "$libs" && libs=. +test -z "$libs" && libs=.libs stat=0 diff --git a/test/fuzzing/CMakeLists.txt b/test/fuzzing/CMakeLists.txt index 06355991b..e31c74427 100644 --- a/test/fuzzing/CMakeLists.txt +++ b/test/fuzzing/CMakeLists.txt @@ -1,8 +1,17 @@ -if (HB_HAVE_GLIB) +if (HB_CHECK) file (READ "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am" MAKEFILEAM) extract_make_variable (hb_fuzzer_SOURCES ${MAKEFILEAM}) + + # TODO: enable these two + #extract_make_variable (FUZZING_CPPFLAGS ${MAKEFILEAM}) # extracting regex fail + #add_executable (hb-fuzzer # it should be run only after ragel execution + # ${project_sources} ${project_extra_sources} ${project_headers} + # ${hb_fuzzer_SOURCES}) + add_executable (hb-fuzzer ${hb_fuzzer_SOURCES}) target_link_libraries (hb-fuzzer harfbuzz) + + target_compile_definitions(hb-fuzzer PUBLIC ${FUZZING_CPPFLAGS}) add_test (NAME hb-fuzzer COMMAND python run-fuzzer-tests.py $ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})