From e7af5711a05311ac92d0f8c59986fea4032937c9 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Mon, 25 Mar 2019 16:47:47 +0100 Subject: [HICN-149] Build packages for applications. Change-Id: Ia13bc4d2711b9897c0afb9b9b43cd04667e41bac Signed-off-by: Mauro Sardara --- apps/CMakeLists.txt | 20 +++++++++++++------- apps/cmake/Modules/Packaging.cmake | 4 ++-- apps/higet/CMakeLists.txt | 4 ++-- apps/http-proxy/CMakeLists.txt | 17 +++++++---------- apps/http-server/CMakeLists.txt | 16 +++++++--------- 5 files changed, 31 insertions(+), 30 deletions(-) (limited to 'apps') 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} ) -- cgit 1.2.3-korg