Skip to content
Permalink
Browse files
Merge pull request #411 from apache/feature/conan_find_module_unifica…
…tion

Unify conan autogenerated find modules with Celix's own find modules.
  • Loading branch information
PengZheng committed Apr 9, 2022
2 parents 91fff32 + a7412f9 commit 878791aff932b6b0ec55f3b8dbd691664bffa458
Showing 24 changed files with 98 additions and 136 deletions.
@@ -29,11 +29,11 @@ include(cmake/cmake_celix/UseCelix.cmake)

#find required packages
find_package(ZLIB REQUIRED) #framework
find_package(UUID REQUIRED) #framework
find_package(libuuid REQUIRED) #framework
find_package(CURL REQUIRED) #framework, etcdlib
find_package(LIBZIP REQUIRED) #framework, etcdlib
find_package(libzip REQUIRED) #framework, etcdlib
find_package(jansson REQUIRED) #etcdlib, dfi
find_package(FFI REQUIRED) #dfi
find_package(libffi REQUIRED) #dfi
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

@@ -20,7 +20,7 @@ if (DEPLOYMENT_ADMIN)
message(WARNING "Celix::deployment_admin is considered unstable, because develop of this bundle has been dormant for a while")

find_package(CURL REQUIRED)
find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)
find_package(ZLIB REQUIRED)

add_library(deployment_admin_api INTERFACE)
@@ -46,7 +46,7 @@ if (DEPLOYMENT_ADMIN)
)

target_compile_definitions(deployment_admin PRIVATE -DUSE_FILE32API)
target_link_libraries(deployment_admin PRIVATE CURL::libcurl UUID::lib ZLIB::ZLIB deployment_admin_api)
target_link_libraries(deployment_admin PRIVATE CURL::libcurl libuuid::libuuid ZLIB::ZLIB deployment_admin_api)

install(TARGETS deployment_admin_api EXPORT celix COMPONENT deployment_admin
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/deployment_admin)
@@ -24,6 +24,7 @@
* \copyright Apache License, Version 2.0
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

@@ -187,29 +188,30 @@ static celix_status_t refiningDriver_registerDevice(refining_driver_pt driver, r
}

celix_status_t refiningDriver_attach(void * driverHandler, service_reference_pt reference, char **result) {
printf("REFINING_DRIVER: attached called\n");
celix_status_t status = CELIX_SUCCESS;
refining_driver_pt driver = driverHandler;
(*result) = NULL;
base_driver_device_service_pt device_service = NULL;
status = bundleContext_getService(driver->context, reference, (void **)&device_service);
if (status == CELIX_SUCCESS) {
refining_driver_device_pt refiningDevice = NULL;
status = refiningDriver_createDevice(driver, reference, device_service, &refiningDevice);
if (status == CELIX_SUCCESS) {
driver->deviceCount+=1;
char serial[5];
sprintf(serial, "%4i", driver->deviceCount);
status = refiningDriver_registerDevice(driver, refiningDevice, serial);
}
}
return status;
printf("REFINING_DRIVER: attached called\n");
celix_status_t status = CELIX_SUCCESS;
refining_driver_pt driver = driverHandler;
(*result) = NULL;
base_driver_device_service_pt device_service = NULL;
status = bundleContext_getService(driver->context, reference, (void **)&device_service);
if (status == CELIX_SUCCESS) {
refining_driver_device_pt refiningDevice = NULL;
status = refiningDriver_createDevice(driver, reference, device_service, &refiningDevice);
if (status == CELIX_SUCCESS) {
driver->deviceCount+=1;
char *serial;
asprintf(&serial, "%4i", driver->deviceCount);
status = refiningDriver_registerDevice(driver, refiningDevice, serial);
free(serial);
}
}
return status;
}

celix_status_t refiningDriver_match(void *driverHandler, service_reference_pt reference, int *value) {
printf("REFINING_DRIVER: match called\n");
int match = 0;
celix_status_t status = CELIX_SUCCESS;
printf("REFINING_DRIVER: match called\n");
int match = 0;
celix_status_t status = CELIX_SUCCESS;

const char* category = NULL;
status = serviceReference_getProperty(reference, OSGI_DEVICEACCESS_DEVICE_CATEGORY, &category);
@@ -219,8 +221,8 @@ celix_status_t refiningDriver_match(void *driverHandler, service_reference_pt re
}
}

(*value) = match;
return status;
(*value) = match;
return status;
}

celix_status_t refiningDriverDevice_createService(refining_driver_device_pt device, refining_driver_device_service_pt *service) {
@@ -17,7 +17,7 @@

celix_subproject(PUBSUB_PSA_TCP "Build TCP PubSub Admin" ON)
if (PUBSUB_PSA_TCP)
find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)

add_celix_bundle(celix_pubsub_admin_tcp
BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_tcp"
@@ -38,7 +38,7 @@ if (PUBSUB_PSA_TCP)
target_include_directories(celix_pubsub_admin_tcp PRIVATE src)
# cmake find package UUID set the wrong include dir for OSX, does Conan solve this?
if (NOT APPLE)
target_link_libraries(celix_pubsub_admin_tcp PRIVATE UUID::lib)
target_link_libraries(celix_pubsub_admin_tcp PRIVATE libuuid::libuuid)
endif()

install_celix_bundle(celix_pubsub_admin_tcp EXPORT celix COMPONENT pubsub)
@@ -18,7 +18,7 @@
celix_subproject(PUBSUB_PSA_WS "Build WebSocket PubSub Admin" ON DEPS HTTP_ADMIN)
if (PUBSUB_PSA_WS)
find_package(jansson REQUIRED)
find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)

add_celix_bundle(celix_pubsub_admin_websocket
BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_websocket"
@@ -19,7 +19,7 @@ celix_subproject(PUBSUB_PSA_ZMQ "Build ZeroMQ PubSub Admin (LGPL License)" ON)
if (PUBSUB_PSA_ZMQ)
find_package(ZeroMQ REQUIRED)
find_package(czmq REQUIRED)
find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)

set(OPTIONAL_OPENSSL_LIB )
# FIXME: ZMQ_SECURITY doesn't compile now
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)

add_library(pubsub_spi STATIC
src/pubsub_endpoint.c
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)

add_celix_bundle(celix_pubsub_topology_manager
BUNDLE_SYMBOLICNAME "apache_celix_pubsub_topology_manager"
@@ -28,7 +28,7 @@ add_celix_bundle(celix_pubsub_topology_manager
)
target_link_libraries(celix_pubsub_topology_manager PRIVATE Celix::framework Celix::log_helper Celix::shell_api)
target_link_libraries(celix_pubsub_topology_manager PRIVATE Celix::pubsub_spi Celix::pubsub_utils )
target_link_libraries(celix_pubsub_topology_manager PRIVATE UUID::lib)
target_link_libraries(celix_pubsub_topology_manager PRIVATE libuuid::libuuid)

install_celix_bundle(celix_pubsub_topology_manager EXPORT celix COMPONENT pubsub)

@@ -19,7 +19,7 @@ celix_subproject(RSA_REMOTE_SERVICE_ADMIN_DFI "Option to enable building the Rem
if (RSA_REMOTE_SERVICE_ADMIN_DFI)
find_package(CURL REQUIRED)
find_package(jansson REQUIRED)
find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)

add_celix_bundle(rsa_dfi
VERSION 0.9.0
@@ -17,7 +17,7 @@
celix_subproject(RSA_REMOTE_SERVICE_ADMIN_SHM "Option to enable building the Remote Service Admin Service SHM bundle" OFF)
if (RSA_REMOTE_SERVICE_ADMIN_SHM)

find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)


link_directories("/opt/local/lib")
@@ -77,11 +77,11 @@ set(CELIX_SHELL_TUI_BUNDLE ${CELIX_BUNDLES_DIR}/shell_tui.zip)
include(CMakeFindDependencyMacro)

find_dependency(ZLIB) #Needed by framework
find_dependency(UUID) #Needed by framework
find_dependency(libuuid) #Needed by framework
find_dependency(CURL) #Needed by framework (used for curl initialization)
find_dependency(LIBZIP) #Needed by utils
find_dependency(Jansson) #Needed by dfi, etcdlib, remote services, pubsub
find_dependency(FFI) #Needed by dfi
find_dependency(libzip) #Needed by utils
find_dependency(jansson) #Needed by dfi, etcdlib, remote services, pubsub
find_dependency(libffi) #Needed by dfi
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_dependency(Threads)

@@ -112,8 +112,8 @@ if (TARGET Celix::rsa_discovery_common OR TARGET Celix::bonjour_shell)
find_dependency(LibXml2)
endif ()
if (TARGET Celix::celix_pubsub_admin_zmq OR TARGET Celix::celix_pubsub_admin_zmq_v2)
find_dependency(ZMQ)
find_dependency(CZMQ)
find_dependency(ZeroMQ)
find_dependency(czmq)
endif ()
if (TARGET Celix::pubsub_admin_nanomsg)
find_dependency(NanoMsg)
@@ -41,7 +41,7 @@ INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CppUTest DEFAULT_MSG CppUTest_LIBRARY CppUTest_INCLUDE_DIR)


IF(CPPUTEST_FOUND)
IF(CppUTest_FOUND)
SET(CppUTest_LIBRARIES ${CppUTest_LIBRARY})
SET(CppUTest_INCLUDE_DIRS ${CppUTest_INCLUDE_DIR})
if(NOT TARGET CppUTest::CppUTest)
@@ -51,14 +51,13 @@ IF(CPPUTEST_FOUND)
INTERFACE_INCLUDE_DIRECTORIES "${CppUTest_INCLUDE_DIR}"
)
endif()
ENDIF(CPPUTEST_FOUND)

SET(CppUTest_EXT_LIBRARIES ${CppUTest_EXT_LIBRARY})
SET(CppUTest_EXT_INCLUDE_DIRS ${CppUTest_EXT_INCLUDE_DIR})
if(NOT TARGET CppUTest::CppUTestExt)
add_library(CppUTest::CppUTestExt STATIC IMPORTED)
set_target_properties(CppUTest::CppUTestExt PROPERTIES
IMPORTED_LOCATION "${CppUTest_EXT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CppUTest_EXT_INCLUDE_DIR}"
)
endif()
SET(CppUTest_EXT_LIBRARIES ${CppUTest_EXT_LIBRARY})
SET(CppUTest_EXT_INCLUDE_DIRS ${CppUTest_EXT_INCLUDE_DIR})
if(NOT TARGET CppUTest::CppUTestExt)
add_library(CppUTest::CppUTestExt STATIC IMPORTED)
set_target_properties(CppUTest::CppUTestExt PROPERTIES
IMPORTED_LOCATION "${CppUTest_EXT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CppUTest_EXT_INCLUDE_DIR}"
)
endif()
ENDIF(CppUTest_FOUND)

This file was deleted.

@@ -18,7 +18,7 @@

# - Try to find ZMQ
# Once done this will define
# ZEROMQ_FOUND - System has Zmq
# ZeroMQ_FOUND - System has Zmq
# ZEROMQ_INCLUDE_DIRS - The Zmq include directories
# ZEROMQ_LIBRARIES - The libraries needed to use Zmq
# ZEROMQ_DEFINITIONS - Compiler switches required for using Zmq
@@ -35,14 +35,14 @@ set(ZEROMQ_LIBRARIES ${ZEROMQ_LIBRARY} )
set(ZEROMQ_INCLUDE_DIRS ${ZEROMQ_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set ZEROMQ_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set ZeroMQ_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(ZeroMQ DEFAULT_MSG
ZEROMQ_LIBRARY ZEROMQ_INCLUDE_DIR)

mark_as_advanced(ZEROMQ_INCLUDE_DIR ZEROMQ_LIBRARY )

if (ZEROMQ_FOUND AND NOT TARGET ZeroMQ::ZeroMQ)
if (ZeroMQ_FOUND AND NOT TARGET ZeroMQ::ZeroMQ)
add_library(ZeroMQ::ZeroMQ SHARED IMPORTED)
set_target_properties(ZeroMQ::ZeroMQ PROPERTIES
IMPORTED_LOCATION "${ZEROMQ_LIBRARY}"
@@ -18,7 +18,7 @@

# - Try to find CZMQ
# Once done this will define
# CZMQ_FOUND - System has czmq
# czmq_FOUND - System has czmq
# CZMQ_INCLUDE_DIRS - The czmq include directories
# CZMQ_LIBRARIES - The libraries needed to use czmq
# CZMQ_DEFINITIONS - Compiler switches required for using czmq
@@ -35,14 +35,14 @@ set(CZMQ_LIBRARIES ${CZMQ_LIBRARY} )
set(CZMQ_INCLUDE_DIRS ${CZMQ_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set CZMQ_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set czmq_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(czmq DEFAULT_MSG
CZMQ_LIBRARY CZMQ_INCLUDE_DIR)

mark_as_advanced(CZMQ_INCLUDE_DIR CZMQ_LIBRARY)

if (CZMQ_FOUND AND NOT TARGET czmq::czmq)
if (czmq_FOUND AND NOT TARGET czmq::czmq)
add_library(czmq::czmq SHARED IMPORTED)
set_target_properties(czmq::czmq PROPERTIES
IMPORTED_LOCATION "${CZMQ_LIBRARY}"
@@ -18,7 +18,7 @@

# - Try to find Jansson
# Once done this will define
# JANSSON_FOUND - System has Jansson
# jansson_FOUND - System has Jansson
# JANSSON_INCLUDE_DIRS - The Jansson include directories
# JANSSON_LIBRARIES - The libraries needed to use Jansson
# jansson::jansson - Imported target for Jansson
@@ -34,14 +34,14 @@ set(JANSSON_LIBRARIES ${JANSSON_LIBRARY} )
set(JANSSON_INCLUDE_DIRS ${JANSSON_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set JANSSON_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set jansson_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(jansson DEFAULT_MSG
JANSSON_LIBRARY JANSSON_INCLUDE_DIR)

mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY)

if (JANSSON_FOUND AND NOT TARGET jansson::jansson)
if (jansson_FOUND AND NOT TARGET jansson::jansson)
add_library(jansson::jansson SHARED IMPORTED)
set_target_properties(jansson::jansson PROPERTIES
IMPORTED_LOCATION "${JANSSON_LIBRARY}"
@@ -18,8 +18,8 @@
# - Try to find libffi define the variables for the binaries/headers and include
#
# Once done this will define
# FFI_FOUND - System has libffi
# FFI::lib - Imported target for the libffi
# libffi_FOUND - System has libffi
# libffi::libffi - Imported target for the libffi

find_library(FFI_LIBRARY NAMES ffi libffi
PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr/local/opt/libffi /opt/local /usr /usr/local
@@ -34,19 +34,19 @@ find_path(FFI_INCLUDE_DIR ffi.h
)

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set FFI_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set libffi_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(FFI DEFAULT_MSG
find_package_handle_standard_args(libffi DEFAULT_MSG
FFI_LIBRARY FFI_INCLUDE_DIR)
mark_as_advanced(FFI_INCLUDE_DIR FFI_LIBRARY)

set(FFI_LIBRARIES ${FFI_LIBRARY})
set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR})


if(FFI_FOUND AND NOT TARGET FFI::lib)
add_library(FFI::lib SHARED IMPORTED)
set_target_properties(FFI::lib PROPERTIES
if(libffi_FOUND AND NOT TARGET libffi::libffi)
add_library(libffi::libffi SHARED IMPORTED)
set_target_properties(libffi::libffi PROPERTIES
IMPORTED_LOCATION "${FFI_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FFI_INCLUDE_DIR}"
)

0 comments on commit 878791a

Please sign in to comment.