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

Allow using prebuilt libkvscproducer through pkg-config (#1193) #1217

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ option(BUILD_JNI "Build C++ wrapper for JNI to expose the functionality to Java/
option(BUILD_STATIC "Build with static linkage" OFF)
option(ADD_MUCLIBC "Add -muclibc c flag" OFF)
option(BUILD_DEPENDENCIES "Whether or not to build depending libraries from source" ON)
option(BUILD_PRODUCER_C "Whether or not to build KVS Producer C library from source" ON)
option(BUILD_OPENSSL_PLATFORM "If buildng OpenSSL what is the target platform" OFF)
option(BUILD_LOG4CPLUS_HOST "Specify host-name for log4cplus for cross-compilation" OFF)

Expand Down Expand Up @@ -94,18 +95,25 @@ set(BUILD_COMMON_LWS
set(BUILD_COMMON_CURL
TRUE
CACHE BOOL "Build ProducerC with CURL Support" FORCE)
set(DEPENDENCY_DOWNLOAD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dependency)
if(NOT EXISTS ${DEPENDENCY_DOWNLOAD_PATH})
file(MAKE_DIRECTORY ${DEPENDENCY_DOWNLOAD_PATH})
endif()
fetch_repo(kvscproducer)
add_subdirectory(${DEPENDENCY_DOWNLOAD_PATH}/libkvscproducer/kvscproducer-src EXCLUDE_FROM_ALL)

############# find dependent libraries ############

find_package(Threads)
find_package(PkgConfig REQUIRED)

if (BUILD_PRODUCER_C)
set(DEPENDENCY_DOWNLOAD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dependency)
if(NOT EXISTS ${DEPENDENCY_DOWNLOAD_PATH})
file(MAKE_DIRECTORY ${DEPENDENCY_DOWNLOAD_PATH})
endif()
fetch_repo(kvscproducer)
add_subdirectory(${DEPENDENCY_DOWNLOAD_PATH}/libkvscproducer/kvscproducer-src EXCLUDE_FROM_ALL)
else()
pkg_check_modules(KVSCPRODUCER REQUIRED libcproducer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if you can add a new job to the CI that does this to make sure it doesn't get broken in the future?

include_directories(${KVSCPRODUCER_INCLUDE_DIRS})
link_directories(${KVSCPRODUCER_LIBRARY_DIRS})
endif()

if (OPEN_SRC_INSTALL_PREFIX)
find_package(CURL REQUIRED PATHS ${OPEN_SRC_INSTALL_PREFIX})
else()
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ You can pass the following options to `cmake ..`.
* `-DBUILD_GSTREAMER_PLUGIN` -- Build kvssink GStreamer plugin
* `-DBUILD_JNI` -- Build C++ wrapper for JNI to expose the functionality to Java/Android
* `-DBUILD_DEPENDENCIES` -- Build depending libraries from source
* `-DBUILD_PRODUCER_C` -- Build KVS Producer C library from source. Default is ON.
* `-DBUILD_TEST=TRUE` -- Build unit/integration tests, may be useful for confirm support for your device. `./tst/producerTest`
* `-DCODE_COVERAGE` -- Enable coverage reporting
* `-DCOMPILER_WARNINGS` -- Enable all compiler warnings
Expand Down
Loading