Skip to content

Commit

Permalink
Merge pull request #26 from tribal-tec/master
Browse files Browse the repository at this point in the history
Visibility not needed for static build
  • Loading branch information
Amanieu authored Apr 19, 2018
2 parents 56fa647 + 945d3a1 commit c636502
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(Async++ PUBLIC Threads::Threads)

# Minimize the set of symbols exported by libraries
set_target_properties(Async++ PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)

# Set up preprocessor definitions
target_include_directories(Async++ PRIVATE ${PROJECT_SOURCE_DIR}/include)
set_target_properties(Async++ PROPERTIES DEFINE_SYMBOL LIBASYNC_BUILD)
if (NOT BUILD_SHARED_LIBS)
if (BUILD_SHARED_LIBS)
# Minimize the set of symbols exported by libraries
set_target_properties(Async++ PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)
else()
target_compile_definitions(Async++ PUBLIC LIBASYNC_STATIC)
endif()

Expand Down
4 changes: 4 additions & 0 deletions include/async++.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@
#endif

// Force symbol visibility to hidden unless explicity exported
#ifndef LIBASYNC_STATIC
#if defined(__GNUC__) && !defined(_WIN32)
# pragma GCC visibility push(hidden)
#endif
#endif

// Some forward declarations
namespace async {
Expand Down Expand Up @@ -147,8 +149,10 @@ class event_task;
#include "async++/parallel_for.h"
#include "async++/parallel_reduce.h"

#ifndef LIBASYNC_STATIC
#if defined(__GNUC__) && !defined(_WIN32)
# pragma GCC visibility pop
#endif
#endif

#endif
2 changes: 2 additions & 0 deletions src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@
#endif

// Force symbol visibility to hidden unless explicity exported
#ifndef LIBASYNC_STATIC
#if defined(__GNUC__) && !defined(_WIN32)
# pragma GCC visibility push(hidden)
#endif
#endif

// Include other internal headers
#include "singleton.h"
Expand Down
2 changes: 2 additions & 0 deletions src/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ wait_handler set_thread_wait_handler(wait_handler handler) LIBASYNC_NOEXCEPT

} // namespace async

#ifndef LIBASYNC_STATIC
#if defined(__GNUC__) && !defined(_WIN32)
# pragma GCC visibility pop
#endif
#endif
2 changes: 2 additions & 0 deletions src/threadpool_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ void threadpool_scheduler::schedule(task_run_handle t)

} // namespace async

#ifndef LIBASYNC_STATIC
#if defined(__GNUC__) && !defined(_WIN32)
# pragma GCC visibility pop
#endif
#endif

0 comments on commit c636502

Please sign in to comment.