diff --git a/CMakeLists.txt b/CMakeLists.txt index 2357609902d865b6405ffe5e0d2e15b24782f429..24ccb6fce65b047b0956ca6eebfd18af7ceb2470 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 2.8.0) project(harfbuzz) +enable_testing() ## Limit framework build to Xcode generator if (BUILD_FRAMEWORK) @@ -683,3 +684,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) endif () endif () endif () + +# Needs to come last so that variables defined above are passed to +# subdirectories. +add_subdirectory(test) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..53d257b04ea6ffc4b663736b9d8bd559dc341222 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(api) diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e786ba6bc2e9c7e5c8052a7e9924550a9ff89fd --- /dev/null +++ b/test/api/CMakeLists.txt @@ -0,0 +1,39 @@ +macro (_add_tests) + foreach(test_name ${ARGV}) + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.c) + add_executable (${test_name} ${test_name}.c) + elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.cc) + add_executable (${test_name} ${test_name}.cc) + else () + message(FATAL_ERROR "No source file found for test ${test_name}") + endif () + target_link_libraries (${test_name} harfbuzz) + add_test (${test_name} ${test_name}) + endforeach () + set_tests_properties (${ARGV} PROPERTIES ENVIRONMENT + "G_TEST_SRCDIR=${CMAKE_CURRENT_SOURCE_DIR};G_TEST_BUILDDIR=${CMAKE_CURRENT_BINARY_DIR}" + ) +endmacro () + +if (HB_HAVE_GLIB) + _add_tests ( + test-blob + test-buffer + test-common + test-font + test-object + test-set + test-shape + test-unicode + test-version + test-ot-tag + test-c + test-cplusplus + ) + + if (HB_HAVE_FREETYPE) + _add_tests ( + test-ot-math + ) + endif (HB_HAVE_FREETYPE) +endif (HB_HAVE_GLIB) diff --git a/test/api/hb-test.h b/test/api/hb-test.h index 4d41218bf46304a79865f0ff3bb52256fd1fe166..040f0c2170785592b3dcac44421a854feccfab3f 100644 --- a/test/api/hb-test.h +++ b/test/api/hb-test.h @@ -27,7 +27,9 @@ #ifndef HB_TEST_H #define HB_TEST_H +#ifdef HAVE_CONFIG_H #include +#endif #include diff --git a/test/api/test-c.c b/test/api/test-c.c index 6e8602f7848ee26be3f6cf158c50e77c6c18a4c1..4b43b83797044443c9cb03430c66eab6b59741a8 100644 --- a/test/api/test-c.c +++ b/test/api/test-c.c @@ -27,7 +27,9 @@ /* This file tests that all headers can be included from .c files */ +#ifdef HAVE_CONFIG_H #include +#endif #include