[cmake] Fix symbols visibility and enable check-symbols.sh test (#705)

This commit is contained in:
Ebrahim Byagowi 2018-01-16 14:18:09 +03:30 committed by GitHub
parent 60f84ef014
commit c97a7eca7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View File

@ -44,7 +44,7 @@ jobs:
steps: steps:
- checkout - 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: apt update && apt install -y pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
- run: cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_ICU=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja - run: cmake -DHB_CHECK=ON -Bbuild -H. -GNinja
- run: ninja -Cbuild - run: ninja -Cbuild
- run: CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test - run: CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test
- run: ninja -Cbuild install - run: ninja -Cbuild install

View File

@ -5,7 +5,8 @@ enable_testing()
## Limit framework build to Xcode generator ## Limit framework build to Xcode generator
if (BUILD_FRAMEWORK) if (BUILD_FRAMEWORK)
# for a framework on macOS, use `cmake .. -DBUILD_FRAMEWORK:BOOL=true -G Xcode` # for a framework build on macOS, use:
# cmake -DBUILD_FRAMEWORK=ON -Bbuild -H. -GXcode && cmake --build build
if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode") if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
message(FATAL_ERROR message(FATAL_ERROR
"You should use Xcode generator with BUILD_FRAMEWORK enabled") "You should use Xcode generator with BUILD_FRAMEWORK enabled")
@ -121,8 +122,14 @@ if (MSVC)
add_definitions(-wd4244 -wd4267 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) add_definitions(-wd4244 -wd4267 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
endif () endif ()
if (WIN32 AND NOT MINGW AND BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
add_definitions("-DHB_EXTERN=__declspec(dllexport) extern") if (WIN32 AND NOT MINGW)
add_definitions("-DHB_EXTERN=__declspec(dllexport) extern")
else ()
set (CMAKE_CXX_FLAGS "-fvisibility=hidden ${CMAKE_CXX_FLAGS}")
set (CMAKE_C_FLAGS "-fvisibility=hidden ${CMAKE_CXX_FLAGS}")
add_definitions("-DHB_EXTERN=__attribute__((visibility(\"default\"))) extern")
endif ()
endif () endif ()
@ -764,12 +771,11 @@ if (UNIX)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
# does some "make" stuff inside # does some "make" stuff inside
#add_test(NAME check-defs.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-defs.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) #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=.") #set_tests_properties(check-defs.sh check-libstdc++.sh PROPERTIES ENVIRONMENT "libs=.")
add_test(NAME check-symbols.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-symbols.sh)
set_tests_properties(check-symbols.sh PROPERTIES ENVIRONMENT "libs=.")
if (NOT APPLE) if (NOT APPLE)
add_test(NAME check-static-inits.sh add_test(NAME check-static-inits.sh