Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Hide the interface of dependencies of GraphAr with PRIVATE link type #71

Merged
merged 9 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
mkdir build
pushd build
cmake .. -DBUILD_TESTS=ON
cmake .. -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON
popd

- name: Cpp Format and lint
Expand Down
55 changes: 42 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ endmacro()
# ------------------------------------------------------------------------------
find_package(Threads REQUIRED)
find_yaml_cpp()
find_package(OpenSSL QUIET)
if(OPENSSL_FOUND)
if(OPENSSL_VERSION LESS "1.1.0")
message(ERROR "The OpenSSL must be greater than or equal to 1.1.0, current version is ${OPENSSL_VERSION}")
endif()
endif()

include(apache-arrow)
build_arrow()
Expand All @@ -165,28 +171,23 @@ macro(build_gar)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/yaml-cpp/include>
)
target_link_libraries(gar Threads::Threads ${CMAKE_DL_LIBS})
target_link_libraries(gar PRIVATE Threads::Threads ${CMAKE_DL_LIBS})
if(APPLE)
target_link_libraries(gar -Wl,-force_load arrow_static
target_link_libraries(gar PRIVATE -Wl,-force_load arrow_static
"${PROJECT_BINARY_DIR}/thirdparty/yaml-cpp/libyaml-cpp.a"
"${PARQUET_STATIC_LIB}"
"${ARROW_BUNDLED_DEPS_STATIC_LIB}")
else()
target_link_libraries(gar -Wl,--exclude-libs,ALL -Wl,--whole-archive arrow_static
target_link_libraries(gar PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive arrow_static
"${PROJECT_BINARY_DIR}/thirdparty/yaml-cpp/libyaml-cpp.a"
"${PARQUET_STATIC_LIB}"
"${ARROW_BUNDLED_DEPS_STATIC_LIB}" -Wl,--no-whole-archive)
endif()

# if OpenSSL library exists, link the OpenSSL library.
# OpenSSL has to be linked after ARROW_BUNDLED_DEPS_STATIC_LIB
find_package(OpenSSL QUIET)
if(OPENSSL_FOUND)
message(STATUS "OpenSSL found with ${OPENSSL_VERSION} version")
if(OPENSSL_VERSION LESS "1.1.0")
message(ERROR "The OpenSSL must be greater than or equal to 1.1.0")
endif()
target_link_libraries(gar OpenSSL::SSL)
target_link_libraries(gar PRIVATE OpenSSL::SSL)
endif()
endmacro()

Expand All @@ -206,7 +207,22 @@ if (BUILD_EXAMPLES)
add_executable(${E_NAME} examples/${E_NAME}.cc)
target_include_directories(${E_NAME} PRIVATE examples ${PROJECT_SOURCE_DIR}/include $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/Catch2/single_include>)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
target_link_libraries(${E_NAME} PRIVATE gar ${Boost_LIBRARIES})
target_link_libraries(${E_NAME} PRIVATE gar ${Boost_LIBRARIES} Threads::Threads ${CMAKE_DL_LIBS})
if(APPLE)
target_link_libraries(${E_NAME} PRIVATE -Wl,-force_load arrow_static
"${PARQUET_STATIC_LIB}"
"${ARROW_BUNDLED_DEPS_STATIC_LIB}")
else()
target_link_libraries(${E_NAME} PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive arrow_static
"${PARQUET_STATIC_LIB}"
"${ARROW_BUNDLED_DEPS_STATIC_LIB}" -Wl,--no-whole-archive)
endif()

# if OpenSSL library exists, link the OpenSSL library.
# OpenSSL has to be linked after ARROW_BUNDLED_DEPS_STATIC_LIB
if(OPENSSL_FOUND)
target_link_libraries(${E_NAME} PRIVATE OpenSSL::SSL)
endif()
endforeach()
endif()

Expand Down Expand Up @@ -248,8 +264,6 @@ install(EXPORT gar-targets
# ------------------------------------------------------------------------------
if (BUILD_TESTS)
find_catch2()
add_compile_options(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
find_package(Boost REQUIRED COMPONENTS graph)

macro(add_test target)
set(options)
Expand All @@ -258,12 +272,27 @@ if (BUILD_TESTS)
cmake_parse_arguments(add_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
add_executable(${target} ${add_test_SRCS})
target_compile_features(${target} PRIVATE cxx_std_17)
target_link_libraries(${target} PRIVATE Catch2::Catch2 gar ${Boost_LIBRARIES})
target_link_libraries(${target} PRIVATE Catch2::Catch2 gar Threads::Threads ${CMAKE_DL_LIBS})
if(APPLE)
target_link_libraries(${target} PRIVATE -Wl,-force_load arrow_static
"${PARQUET_STATIC_LIB}"
"${ARROW_BUNDLED_DEPS_STATIC_LIB}")
else()
target_link_libraries(${target} PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive arrow_static
"${PARQUET_STATIC_LIB}"
"${ARROW_BUNDLED_DEPS_STATIC_LIB}" -Wl,--no-whole-archive)
endif()
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/include $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/Catch2/single_include>)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
include(CTest)
include(Catch)
catch_discover_tests(${target})

# if OpenSSL library exists, link the OpenSSL library.
# OpenSSL has to be linked after ARROW_BUNDLED_DEPS_STATIC_LIB
if(OPENSSL_FOUND)
target_link_libraries(${target} PRIVATE OpenSSL::SSL)
endif()
endmacro()

add_test(test_info SRCS test/test_info.cc)
Expand Down
8 changes: 4 additions & 4 deletions examples/construct_info_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include <cassert>

#include "gar/graph_info.h"


Expand All @@ -24,10 +26,8 @@ int main(int argc, char* argv[]) {
// validate
assert(graph_info.GetName() == name);
assert(graph_info.GetPrefix() == prefix);
const auto& vertex_infos = graph_info.GetVertexInfos();
const auto& edge_infos = graph_info.GetEdgeInfos();
assert(vertex_infos.size() == 0);
assert(edge_infos.size() == 0);
assert(graph_info.GetVertexInfos().size() == 0);
assert(graph_info.GetEdgeInfos().size() == 0);

/*------------------construct vertex info------------------*/
std::string vertex_label = "person", vertex_prefix = "vertex/person/";
Expand Down
1 change: 1 addition & 0 deletions include/gar/utils/file_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ limitations under the License.
*/

#include <map>
#include <stdexcept>
#include <string>

#include "gar/utils/macros.h"
Expand Down