diff options
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/BuildMacros.cmake | 21 | ||||
-rw-r--r-- | cmake/Modules/FindConfig.cmake | 56 | ||||
-rw-r--r-- | cmake/Modules/FindLibFec.cmake | 24 | ||||
-rw-r--r-- | cmake/Modules/FindLibRely.cmake | 24 | ||||
-rw-r--r-- | cmake/Modules/FindLibconfig++.cmake | 1 | ||||
-rw-r--r-- | cmake/Modules/Packager.cmake | 90 |
6 files changed, 67 insertions, 149 deletions
diff --git a/cmake/Modules/BuildMacros.cmake b/cmake/Modules/BuildMacros.cmake index c57aaa73c..2c301db5c 100644 --- a/cmake/Modules/BuildMacros.cmake +++ b/cmake/Modules/BuildMacros.cmake @@ -33,6 +33,7 @@ macro(build_executable exec) PROPERTIES OUTPUT_NAME ${exec} INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" + BUILD_RPATH "${BUILD_ROOT}/lib" INSTALL_RPATH_USE_LINK_PATH TRUE ARCHIVE_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" LIBRARY_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" @@ -49,7 +50,7 @@ macro(build_executable exec) endif() if (ARG_COMPILE_OPTIONS) - target_compile_options(${exec}-bin ${ARG_COMPILE_OPTIONS}) + target_compile_options(${exec}-bin PRIVATE -Wall -Werror ${ARG_COMPILE_OPTIONS}) endif() if(ARG_DEFINITIONS) @@ -77,7 +78,7 @@ macro(build_library lib) cmake_parse_arguments(ARG "SHARED;STATIC;NO_DEV" "COMPONENT;" - "SOURCES;LINK_LIBRARIES;INSTALL_HEADERS;DEPENDS;INCLUDE_DIRS;DEFINITIONS;HEADER_ROOT_DIR;LIBRARY_ROOT_DIR;INSTALL_FULL_PATH_DIR;EMPTY_PREFIX;COMPILE_OPTIONS;VERSION" + "SOURCES;LINK_LIBRARIES;OBJECT_LIBRARIES;LINK_FLAGS;INSTALL_HEADERS;DEPENDS;INCLUDE_DIRS;DEFINITIONS;HEADER_ROOT_DIR;LIBRARY_ROOT_DIR;INSTALL_FULL_PATH_DIR;EMPTY_PREFIX;COMPILE_OPTIONS;VERSION" ${ARGN} ) @@ -90,14 +91,14 @@ macro(build_library lib) list(APPEND TARGET_LIBS ${lib}.shared ) - add_library(${lib}.shared SHARED ${ARG_SOURCES}) + add_library(${lib}.shared SHARED ${ARG_SOURCES} ${ARG_OBJECT_LIBRARIES}) endif() if(ARG_STATIC) list(APPEND TARGET_LIBS ${lib}.static ) - add_library(${lib}.static STATIC ${ARG_SOURCES}) + add_library(${lib}.static STATIC ${ARG_SOURCES} ${ARG_OBJECT_LIBRARIES}) endif() if(NOT ARG_COMPONENT) @@ -119,20 +120,24 @@ macro(build_library lib) set_target_properties(${library} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" + BUILD_RPATH "${BUILD_ROOT}/lib" INSTALL_RPATH_USE_LINK_PATH TRUE PREFIX "" ARCHIVE_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" LIBRARY_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" RUNTIME_OUTPUT_DIRECTORY "${BUILD_ROOT}/bin" + LINK_FLAGS "${ARG_LINK_FLAGS}" ) else () set_target_properties(${library} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" + BUILD_RPATH "${BUILD_ROOT}/lib" INSTALL_RPATH_USE_LINK_PATH TRUE ARCHIVE_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" LIBRARY_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" RUNTIME_OUTPUT_DIRECTORY "${BUILD_ROOT}/bin" + LINK_FLAGS "${ARG_LINK_FLAGS}" ) endif() @@ -143,7 +148,9 @@ macro(build_library lib) WINDOWS_EXPORT_ALL_SYMBOLS TRUE ) else () - target_compile_options(${library} PRIVATE -Wall ${ARG_COMPILE_OPTIONS}) + target_compile_options(${library} + PRIVATE -Wall -Werror ${ARG_COMPILE_OPTIONS} + ) set_target_properties(${library} PROPERTIES OUTPUT_NAME ${lib} @@ -152,7 +159,7 @@ macro(build_library lib) # library deps if(ARG_LINK_LIBRARIES) - target_link_libraries(${library} ${ARG_LINK_LIBRARIES}) + target_link_libraries(${library} PUBLIC ${ARG_LINK_LIBRARIES}) endif() if(ARG_DEFINITIONS) @@ -249,7 +256,7 @@ macro (build_module module) LINK_LIBRARIES ${ARG_LINK_LIBRARIES} INSTALL_HEADERS ${ARG_INSTALL_HEADERS} DEPENDS ${ARG_DEPENDS} - COMPONENT lib${LIBTRANSPORT} + COMPONENT ${ARG_COMPONENT} INCLUDE_DIRS ${ARG_INCLUDE_DIRS} HEADER_ROOT_DIR ${ARG_HEADER_ROOT_DIR} LIBRARY_ROOT_DIR ${ARG_LIBRARY_ROOT_DIR} diff --git a/cmake/Modules/FindConfig.cmake b/cmake/Modules/FindConfig.cmake deleted file mode 100644 index 11e764d21..000000000 --- a/cmake/Modules/FindConfig.cmake +++ /dev/null @@ -1,56 +0,0 @@ -set(LIBCONFIG_SEARCH_PATH_LIST - ${LIBCONFIG_HOME} - $ENV{LIBCONFIG_HOME} - /usr/local - /opt - /usr -) - -find_path(CONFIG_INCLUDE_DIR libconfig.h - HINTS ${LIBCONFIG_SEARCH_PATH_LIST} - PATH_SUFFIXES include - DOC "Find the libconfig include" -) - -if (WIN32) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - find_library(CONFIG_LIBRARY NAMES libconfig.lib - HINTS ${LIBCONFIG_SEARCH_PATH_LIST} - PATH_SUFFIXES lib/x64 - DOC "Find the libconfig libraries" - ) - elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - find_library(CONFIG_LIBRARY NAMES libconfig.lib - HINTS ${LIBCONFIG_SEARCH_PATH_LIST} - PATH_SUFFIXES lib/x32 - DOC "Find the libconfig libraries" - ) - endif() -else() - find_library(CONFIG_LIBRARY NAMES config - HINTS ${LIBCONFIG_SEARCH_PATH_LIST} - PATH_SUFFIXES lib - DOC "Find the libconfig libraries" - ) -endif() - - -IF (CONFIG_INCLUDE_DIR AND CONFIG_LIBRARY) - SET(CONFIG_FOUND TRUE) -ENDIF ( CONFIG_INCLUDE_DIR AND CONFIG_LIBRARY) - -IF (CONFIG_FOUND) - IF (NOT CONFIG_FIND_QUIETLY) - MESSAGE(STATUS "Found Config: ${CONFIG_LIBRARY}") - ENDIF (NOT CONFIG_FIND_QUIETLY) -ELSE(CONFIG_FOUND) - IF (Config_FIND_REQUIRED) - IF(NOT CONFIG_INCLUDE_DIR) - MESSAGE(FATAL_ERROR "Could not find LibConfig header file!") - ENDIF(NOT CONFIG_INCLUDE_DIR) - - IF(NOT CONFIG_LIBRARY) - MESSAGE(FATAL_ERROR "Could not find LibConfig library file!") - ENDIF(NOT CONFIG_LIBRARY) - ENDIF (Config_FIND_REQUIRED) -ENDIF (CONFIG_FOUND)
\ No newline at end of file diff --git a/cmake/Modules/FindLibFec.cmake b/cmake/Modules/FindLibFec.cmake deleted file mode 100644 index f8b33ad6b..000000000 --- a/cmake/Modules/FindLibFec.cmake +++ /dev/null @@ -1,24 +0,0 @@ -set(LIBFEC_SEARCH_PATH_LIST - ${LIBFEC_HOME} - $ENV{DEPENDENCIES} - $ENV{LIBFEC_HOME} - /usr/local - /opt - /usr - ) - -find_path(LIBFEC_INCLUDE_DIR fec/version.h - HINTS ${LIBFEC_SEARCH_PATH_LIST} - PATH_SUFFIXES include - DOC "Find the LibFec includes" ) - -find_library(LIBFEC_LIBRARY NAMES fec - HINTS ${LIBFEC_SEARCH_PATH_LIST} - PATH_SUFFIXES lib - DOC "Find the LibFec libraries" ) - -set(LIBFEC_LIBRARIES ${LIBFEC_LIBRARY}) -set(LIBFEC_INCLUDE_DIRS ${LIBFEC_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LibFec DEFAULT_MSG LIBFEC_LIBRARY LIBFEC_INCLUDE_DIR)
\ No newline at end of file diff --git a/cmake/Modules/FindLibRely.cmake b/cmake/Modules/FindLibRely.cmake deleted file mode 100644 index 4b8960041..000000000 --- a/cmake/Modules/FindLibRely.cmake +++ /dev/null @@ -1,24 +0,0 @@ -set(LIBRELY_SEARCH_PATH_LIST - ${LIBRELY_HOME} - $ENV{DEPENDENCIES} - $ENV{LIBRELY_HOME} - /usr/local - /opt - /usr - ) - -find_path(LIBRELY_INCLUDE_DIR rely/version.hpp - HINTS ${LIBRELY_SEARCH_PATH_LIST} - PATH_SUFFIXES include - DOC "Find the LibRely includes" ) - -find_library(LIBRELY_LIBRARY NAMES rely - HINTS ${LIBRELY_SEARCH_PATH_LIST} - PATH_SUFFIXES lib - DOC "Find the LibRely libraries" ) - -set(LIBRELY_LIBRARIES ${LIBRELY_LIBRARY}) -set(LIBRELY_INCLUDE_DIRS ${LIBRELY_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LibRely DEFAULT_MSG LIBRELY_LIBRARY LIBRELY_INCLUDE_DIR)
\ No newline at end of file diff --git a/cmake/Modules/FindLibconfig++.cmake b/cmake/Modules/FindLibconfig++.cmake index 8dfc5fbe8..1636ae96a 100644 --- a/cmake/Modules/FindLibconfig++.cmake +++ b/cmake/Modules/FindLibconfig++.cmake @@ -40,5 +40,4 @@ set(LIBCONFIG_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Libconfig++ LIBCONFIG_CPP_LIBRARIES LIBCONFIG_INCLUDE_DIRS) - mark_as_advanced(LIBCONFIG_CPP_LIBRARIES LIBCONFIG_INCLUDE_DIRS) diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake index f27479188..105952662 100644 --- a/cmake/Modules/Packager.cmake +++ b/cmake/Modules/Packager.cmake @@ -227,8 +227,11 @@ function(make_packages) set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_INSTALL_RPATH /opt/hicn) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CPACK_SET_DESTDIR true) + set(CMAKE_INSTALL_RPATH "\${CPACK_INSTALL_PREFIX}") set(CMAKE_SKIP_INSTALL_RPATH FALSE) set(HICN_DEPENDECIES_INSTALLER "${LIBTRANSPORT_LIBRARIES_LIST};${FACEMGR_LIBRARY_LIST};${APPS_LIBRARY_LIST}") @@ -248,72 +251,85 @@ function(make_packages) set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_REVISION}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "hICN Components") + set(CPACK_COMPONENTS_ALL dependencies ${HICN_UTILS} ${HICN_LIGHT} ${HICN_APPS} ${FACEMGR} lib${LIBTRANSPORT} ${LIBTRANSPORT}-dev lib${LIBHICN} ${LIBHICN}-dev ${HICN_UTILS}-dev ${HICN_LIGHT}-dev ${HICN_APPS}-dev ${FACEMGR}-dev) set(CPACK_COMPONENT_DEPENDENCIES_DISPLAY_NAME "Dependencies") - if (HICN_UTILS) + if (NOT "${HICN_UTILS}" STREQUAL "") string(TOUPPER ${HICN_UTILS} HICN_UTILS_UPPERCASE) + string(TOUPPER ${HICN_UTILS}-dev HICN_UTILS_DEV_UPPERCASE) set(CPACK_COMPONENT_${HICN_UTILS_UPPERCASE}_DISPLAY_NAME "hICN utils") + set(CPACK_COMPONENT_${HICN_UTILS_DEV_UPPERCASE}_DISPLAY_NAME "hicn utils headers") set(CPACK_COMPONENT_${HICN_UTILS_UPPERCASE}_GROUP "Executables") + set(CPACK_COMPONENT_${HICN_UTILS_DEV_UPPERCASE}_GROUP "Headers") set(CPACK_COMPONENT_${HICN_UTILS_UPPERCASE}_INSTALL_TYPES Full) - set(CPACK_COMPONENT_${HICN_APPS_DEV_UPPERCASE}_DISPLAY_NAME "hicn-apps headers") - endif() - string(TOUPPER ${HICN_LIGHT} HICN_LIGHT_UPPERCASE) - if (HICN_APPS) + set(CPACK_COMPONENT_${HICN_UTILS_DEV_UPPERCASE}_INSTALL_TYPES Full) + endif () + + if (NOT "${HICN_LIGHT}" STREQUAL "") + string(TOUPPER ${HICN_LIGHT} HICN_LIGHT_UPPERCASE) + string(TOUPPER ${HICN_LIGHT}-dev HICN_LIGHT_DEV_UPPERCASE) + set(CPACK_COMPONENT_${HICN_LIGHT_UPPERCASE}_DISPLAY_NAME "hICN light apps") + set(CPACK_COMPONENT_${HICN_LIGHT_DEV_UPPERCASE}_DISPLAY_NAME "hicn-light headers") + set(CPACK_COMPONENT_${HICN_LIGHT_UPPERCASE}_GROUP "Executables") + set(CPACK_COMPONENT_${HICN_LIGHT_DEV_UPPERCASE}_GROUP "Headers") + set(CPACK_COMPONENT_${HICN_LIGHT_UPPERCASE}_INSTALL_TYPES Full) + set(CPACK_COMPONENT_${HICN_LIGHT_DEV_UPPERCASE}_INSTALL_TYPES Full) + endif () + + if (NOT "${HICN_APPS}" STREQUAL "") string(TOUPPER ${HICN_APPS} HICN_APPS_UPPERCASE) string(TOUPPER ${HICN_APPS}-dev HICN_APPS_DEV_UPPERCASE) set(CPACK_COMPONENT_${HICN_APPS_UPPERCASE}_DISPLAY_NAME "hICN apps") + set(CPACK_COMPONENT_${HICN_APPS_DEV_UPPERCASE}_DISPLAY_NAME "hicn-apps headers") + set(CPACK_COMPONENT_${HICN_APPS_UPPERCASE}_GROUP "Executables") set(CPACK_COMPONENT_${HICN_APPS_DEV_UPPERCASE}_GROUP "Headers") set(CPACK_COMPONENT_${HICN_APPS_UPPERCASE}_INSTALL_TYPES Full) set(CPACK_COMPONENT_${HICN_APPS_DEV_UPPERCASE}_INSTALL_TYPES Full) - endif() - if (FACEMGR) + endif () + + if (NOT "${FACEMGR}" STREQUAL "") string(TOUPPER ${FACEMGR} FACEMGR_UPPERCASE) string(TOUPPER ${FACEMGR}-dev FACEMGR_DEV_UPPERCASE) - set(CPACK_COMPONENT_${FACEMGR_DEV_UPPERCASE}_DISPLAY_NAME "facemgr headers") set(CPACK_COMPONENT_${FACEMGR_UPPERCASE}_DISPLAY_NAME "facemgr") + set(CPACK_COMPONENT_${FACEMGR_DEV_UPPERCASE}_DISPLAY_NAME "facemgr headers") set(CPACK_COMPONENT_${FACEMGR_UPPERCASE}_GROUP "Executables") set(CPACK_COMPONENT_${FACEMGR_DEV_UPPERCASE}_GROUP "Headers") set(CPACK_COMPONENT_${FACEMGR_UPPERCASE}_INSTALL_TYPES Full) set(CPACK_COMPONENT_${FACEMGR_DEV_UPPERCASE}_INSTALL_TYPES Full) - endif() - string(TOUPPER lib${LIBTRANSPORT} LIBTRANSPORT_UPPERCASE) - string(TOUPPER ${LIBTRANSPORT}-dev LIBTRANSPORT_DEV_UPPERCASE) - string(TOUPPER lib${LIBHICN} LIBHICN_UPPERCASE) - string(TOUPPER ${LIBHICN}-dev LIBHICN_DEV_UPPERCASE) - string(TOUPPER ${HICN_UTILS}-dev HICN_UTILS_DEV_UPPERCASE) - string(TOUPPER ${HICN_LIGHT}-dev HICN_LIGHT_DEV_UPPERCASE) - set(CPACK_COMPONENT_${HICN_LIGHT_UPPERCASE}_DISPLAY_NAME "hICN light apps") - set(CPACK_COMPONENT_${LIBTRANSPORT_UPPERCASE}_DISPLAY_NAME "libtransport libs") - set(CPACK_COMPONENT_${LIBHICN_UPPERCASE}_DISPLAY_NAME "hicn libs") - set(CPACK_COMPONENT_${LIBTRANSPORT_DEV_UPPERCASE}_DISPLAY_NAME "libtransport headers") - set(CPACK_COMPONENT_${LIBHICN_DEV_UPPERCASE}_DISPLAY_NAME "hicn headers") - set(CPACK_COMPONENT_${HICN_UTILS_DEV_UPPERCASE}_DISPLAY_NAME "hicn utils headers") - set(CPACK_COMPONENT_${HICN_LIGHT_DEV_UPPERCASE}_DISPLAY_NAME "hicn-light headers") + endif () + + if (NOT "${LIBTRANSPORT}" STREQUAL "") + string(TOUPPER lib${LIBTRANSPORT} LIBTRANSPORT_UPPERCASE) + string(TOUPPER ${LIBTRANSPORT}-dev LIBTRANSPORT_DEV_UPPERCASE) + set(CPACK_COMPONENT_${LIBTRANSPORT_UPPERCASE}_DISPLAY_NAME "libtransport libs") + set(CPACK_COMPONENT_${LIBTRANSPORT_DEV_UPPERCASE}_DISPLAY_NAME "libtransport headers") + set(CPACK_COMPONENT_${LIBTRANSPORT_UPPERCASE}_GROUP "Libraries") + set(CPACK_COMPONENT_${LIBTRANSPORT_DEV_UPPERCASE}_GROUP "Headers") + set(CPACK_COMPONENT_${LIBTRANSPORT_UPPERCASE}_INSTALL_TYPES Full) + set(CPACK_COMPONENT_${LIBTRANSPORT_DEV_UPPERCASE}_INSTALL_TYPES Full) + endif () + + if (NOT "${LIBHICN}" STREQUAL "") + string(TOUPPER lib${LIBHICN} LIBHICN_UPPERCASE) + string(TOUPPER ${LIBHICN}-dev LIBHICN_DEV_UPPERCASE) + set(CPACK_COMPONENT_${LIBHICN_UPPERCASE}_DISPLAY_NAME "hicn libs") + set(CPACK_COMPONENT_${LIBHICN_DEV_UPPERCASE}_DISPLAY_NAME "hicn headers") + set(CPACK_COMPONENT_${LIBHICN_UPPERCASE}_GROUP "Libraries") + set(CPACK_COMPONENT_${LIBHICN_DEV_UPPERCASE}_GROUP "Headers") + set(CPACK_COMPONENT_${LIBHICN_UPPERCASE}_INSTALL_TYPES Full) + set(CPACK_COMPONENT_${LIBHICN_DEV_UPPERCASE}_INSTALL_TYPES Full) + endif () + set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/cmake/Modules/License.txt") set(CPACK_COMPONENT_DEPENDENCIES_DESCRIPTION "All dependency libreries") - set(CPACK_COMPONENT_${HICN_LIGHT_UPPERCASE}_GROUP "Executables") - set(CPACK_COMPONENT_${HICN_APPS_UPPERCASE}_GROUP "Executables") - set(CPACK_COMPONENT_${LIBTRANSPORT_UPPERCASE}_GROUP "Libraries") - set(CPACK_COMPONENT_${LIBHICN_UPPERCASE}_GROUP "Libraries") - set(CPACK_COMPONENT_${LIBTRANSPORT_DEV_UPPERCASE}_GROUP "Headers") - set(CPACK_COMPONENT_${LIBHICN_DEV_UPPERCASE}_GROUP "Headers") - set(CPACK_COMPONENT_${HICN_UTILS_DEV_UPPERCASE}_GROUP "Headers") - set(CPACK_COMPONENT_${HICN_LIGHT_DEV_UPPERCASE}_GROUP "Headers") set(CPACK_COMPONENT_DEPENDENCIES_GROUP "Dependencies") set(CPACK_COMPONENT_GROUP_DEVELOPMENT_EXPANDED ON) set(CPACK_COMPONENT_GROUP_DEPENDENCIES_DESCRIPTION "All dependency libreries") set(CPACK_ALL_INSTALL_TYPES Full Developer) set(CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything") - set(CPACK_COMPONENT_${HICN_LIGHT_UPPERCASE}_INSTALL_TYPES Full) - set(CPACK_COMPONENT_${LIBTRANSPORT_UPPERCASE}_INSTALL_TYPES Full) - set(CPACK_COMPONENT_${LIBHICN_UPPERCASE}_INSTALL_TYPES Full) - set(CPACK_COMPONENT_${LIBTRANSPORT_DEV_UPPERCASE}_INSTALL_TYPES Full) - set(CPACK_COMPONENT_${LIBHICN_DEV_UPPERCASE}_INSTALL_TYPES Full) - set(CPACK_COMPONENT_${HICN_UTILS_DEV_UPPERCASE}_INSTALL_TYPES Full) - set(CPACK_COMPONENT_${HICN_LIGHT_DEV_UPPERCASE}_INSTALL_TYPES Full) if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CMAKE_INSTALL_RPATH /opt/hicn) |