diff options
author | Mauro Sardara <msardara@cisco.com> | 2019-03-25 16:47:47 +0100 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2019-03-27 15:05:44 +0100 |
commit | e7af5711a05311ac92d0f8c59986fea4032937c9 (patch) | |
tree | f6773cd84634f4404fb8b192a50ee84f8ef65162 | |
parent | 558581790763815071e9c77e06047e689faf752f (diff) |
[HICN-149] Build packages for applications.
Change-Id: Ia13bc4d2711b9897c0afb9b9b43cd04667e41bac
Signed-off-by: Mauro Sardara <msardara@cisco.com>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | apps/CMakeLists.txt | 20 | ||||
-rw-r--r-- | apps/cmake/Modules/Packaging.cmake | 4 | ||||
-rw-r--r-- | apps/higet/CMakeLists.txt | 4 | ||||
-rw-r--r-- | apps/http-proxy/CMakeLists.txt | 17 | ||||
-rw-r--r-- | apps/http-server/CMakeLists.txt | 16 | ||||
-rw-r--r-- | scripts/build-packages.sh | 9 | ||||
-rw-r--r-- | utils/CMakeLists.txt | 9 |
8 files changed, 44 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a4136e3e..63c438fd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,8 +79,6 @@ if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") ) set(LIBTRANSPORT ${LIBTRANSPORT}-memif) - set(HICN_UTILS ${HICN_UTILS}-memif) - set(HICN_APPS ${HICN_APPS}-memif) endif() ## Shared targets diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 766c9c7e5..5fed15380 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -25,8 +25,6 @@ set(CMAKE_MODULE_PATH include(BuildMacros) include(WindowsMacros) -find_package(Asio REQUIRED) - if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) find_package(Libtransport REQUIRED) include_directories(${LIBTRANSPORT_INCLUDE_DIRS}) @@ -38,20 +36,28 @@ else() ) endif() +set(SUFFIX "") +if (${LIBTRANSPORT_LIBRARIES} MATCHES ".*-memif.*") + set(SUFFIX "-memif") +endif() + +set(HICN_APPS "${HICN_APPS}${SUFFIX}") + list(APPEND LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -include(Packaging) - -set(COMPILER_DEFINITIONS "") - - if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4200 /wd4996") endif () +include(Packaging) + +set(HIGET higet) +set(HTTP_SERVER hicn-http-sever) +set(HTTP_PROXY hicn-http-proxy) + add_subdirectory(http-server) add_subdirectory(http-proxy) add_subdirectory(higet)
\ No newline at end of file diff --git a/apps/cmake/Modules/Packaging.cmake b/apps/cmake/Modules/Packaging.cmake index 6a6e34777..fb5043e46 100644 --- a/apps/cmake/Modules/Packaging.cmake +++ b/apps/cmake/Modules/Packaging.cmake @@ -18,11 +18,11 @@ useful for testing and debugging within a hicn network." ) set(${HICN_APPS}_DEB_DEPENDENCIES - "lib${LIBTRANSPORT} (>= stable_version)" + "lib${LIBTRANSPORT} (>= stable_version), libcurl4" CACHE STRING "Dependencies for deb/rpm package." ) set(${HICN_APPS}_RPM_DEPENDENCIES - "lib${LIBTRANSPORT} >= stable_version" + "lib${LIBTRANSPORT} >= stable_version, libcurl" CACHE STRING "Dependencies for deb/rpm package." )
\ No newline at end of file diff --git a/apps/higet/CMakeLists.txt b/apps/higet/CMakeLists.txt index 5dcae66b2..8c7188c49 100644 --- a/apps/higet/CMakeLists.txt +++ b/apps/higet/CMakeLists.txt @@ -26,10 +26,10 @@ list(APPEND APPS_SRC higet.cc ) -build_executable(higet +build_executable(${HIGET} SOURCES ${APPS_SRC} LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY} DEPENDS ${LIBTRANSPORT} - COMPONENT higet + COMPONENT ${HICN_APPS} DEFINITIONS ${COMPILER_DEFINITIONS} ) diff --git a/apps/http-proxy/CMakeLists.txt b/apps/http-proxy/CMakeLists.txt index 3d6b9c672..010a2c2b6 100644 --- a/apps/http-proxy/CMakeLists.txt +++ b/apps/http-proxy/CMakeLists.txt @@ -14,11 +14,6 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) set(CMAKE_CXX_STANDARD 14) -if (NOT CMAKE_BUILD_TYPE) - message(STATUS "No build type selected, default to Release") - set(CMAKE_BUILD_TYPE "Release") -endif() - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/" @@ -49,7 +44,9 @@ set(APP_SOURCE_FILES main.cc ) -build_library(httpproxylib +set(LIBHTTP_PROXY hicnhttpproxy) + +build_library(${LIBHTTP_PROXY} STATIC SOURCES ${LIB_SOURCE_FILES} LINK_LIBRARIES ${LIBRARIES} @@ -57,10 +54,10 @@ build_library(httpproxylib INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} ) -build_executable(hicn-http-proxy +build_executable(${HTTP_PROXY} SOURCES ${APP_SOURCE_FILES} - LINK_LIBRARIES httpproxylib - DEPENDS httpproxylib - COMPONENT hicn-http-proxy + LINK_LIBRARIES ${LIBHTTP_PROXY} + DEPENDS ${LIBHTTP_PROXY} + COMPONENT ${HICN_APPS} DEFINITIONS ${COMPILER_DEFINITIONS} )
\ No newline at end of file diff --git a/apps/http-server/CMakeLists.txt b/apps/http-server/CMakeLists.txt index 94aa9d43a..bedb6afc1 100644 --- a/apps/http-server/CMakeLists.txt +++ b/apps/http-server/CMakeLists.txt @@ -58,27 +58,25 @@ set(APP_SOURCE_FILES ) include_directories( - ${CMAKE_BINARY_DIR}/apps/http-server http-server http-client ) -build_library(hicn-httpserver +set(LIBHTTP_SERVER hicnhttpserver) + +build_library(${LIBHTTP_SERVER} STATIC - SOURCES ${LIB_SOURCE_FILES} ${LIB_SERVER_HEADER_FILES} ${LIB_CLIENT_HEADER_FILES} - INSTALL_HEADERS ${HEADER_FILES} + SOURCES ${LIB_SOURCE_FILES} LINK_LIBRARIES ${LIBRARIES} DEPENDS ${DEPENDENCIES} - COMPONENT lib${LIBTRANSPORT} INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} - INSTALL_ROOT_DIR hicn/transport DEFINITIONS ${COMPILER_DEFINITIONS} ) -build_executable(hicn-http-server +build_executable(${HTTP_SERVER} SOURCES ${APP_SOURCE_FILES} - LINK_LIBRARIES hicn-httpserver ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY} - DEPENDS hicn-httpserver + LINK_LIBRARIES ${LIBHTTP_SERVER} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY} + DEPENDS ${LIBHTTP_SERVER} COMPONENT ${HICN_APPS} DEFINITIONS ${COMPILER_DEFINITIONS} ) diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh index ed8a95a55..70c41d1e1 100644 --- a/scripts/build-packages.sh +++ b/scripts/build-packages.sh @@ -144,14 +144,15 @@ build_package() { mkdir -p build && pushd build rm -rf * - cmake -DCMAKE_INSTALL_PREFIX=/usr ${SCRIPT_PATH}/.. + cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_APPS=ON ${SCRIPT_PATH}/.. make package rm -rf libtransport - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DBUILD_HICNPLUGIN=ON \ - -DBUILD_LIBTRANSPORT=ON \ + cmake -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_HICNPLUGIN=ON \ + -DBUILD_LIBTRANSPORT=ON \ + -DBUILD_APPS=ON \ -DLIBMEMIF_HOME=${MEMIF_HOME} \ ${SCRIPT_PATH}/.. diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 9d3a77863..b1993e740 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -32,7 +32,12 @@ else() set(LIBTRANSPORT_LIBRARIES ${LIBTRANSPORT_SHARED}) endif() -include(Packaging) +set(SUFFIX "") +if (${LIBTRANSPORT_LIBRARIES} MATCHES ".*-memif.*") + set(SUFFIX "-memif") +endif() + +set(HICN_UTILS "${HICN_UTILS}${SUFFIX}") set (COMPILER_DEFINITIONS "") @@ -40,6 +45,8 @@ if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4200 /wd4996") endif () +include(Packaging) + build_executable(hiperf SOURCES src/hiperf.cc LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY} |