aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara+fdio@cisco.com>2017-06-05 17:51:06 +0200
committerMauro Sardara <msardara+fdio@cisco.com>2017-06-05 17:51:06 +0200
commit4b109777e012d90e47660b07488201286cefc0c4 (patch)
tree77a14a253320a2a09ef32560d2adee536291781f
parent77323a5c646ad0c6919d0848d63b9791a745c90b (diff)
- Added support for differetn build types (DEBUG, RELEASE, RELEASE with debug symbols, RELEASE with min size executable)
- Added support for iOS Change-Id: Id9e5ccc4ba7b6c1b9aedae63bce3c47ea5cfd68b Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r--metis/.gitignore2
-rw-r--r--metis/CMakeLists.txt94
-rw-r--r--metis/ccnx/forwarder/metis/CMakeLists.txt9
-rw-r--r--metis/ccnx/forwarder/metis/command-line/metis_control/CMakeLists.txt8
-rw-r--r--metis/ccnx/forwarder/metis/command-line/metis_daemon/CMakeLists.txt8
5 files changed, 81 insertions, 40 deletions
diff --git a/metis/.gitignore b/metis/.gitignore
index b8c1f591..46faca23 100644
--- a/metis/.gitignore
+++ b/metis/.gitignore
@@ -14,7 +14,6 @@ lib
.DS_Store
*.lo
*.o
-*.lo
build/
conf.mk
*.dSYM
@@ -22,7 +21,6 @@ conf.mk
*.gcno
*.gcov
*.la
-conf.mk
.deps
config.log
config.h
diff --git a/metis/CMakeLists.txt b/metis/CMakeLists.txt
index aa209d49..36e2e6ce 100644
--- a/metis/CMakeLists.txt
+++ b/metis/CMakeLists.txt
@@ -7,6 +7,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
+if (NOT CMAKE_BUILD_TYPE)
+ message(STATUS "No build type selected, default to Release")
+ set(CMAKE_BUILD_TYPE "Release")
+endif ()
+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if( UNIX )
@@ -22,36 +27,67 @@ if(ANDROID_API)
message("############ This build will not include doxygen, tools, or tests")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -Wall")
else()
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()
+
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS}")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS}")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CMAKE_C_FLAGS}")
+set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${CMAKE_C_FLAGS}")
+
include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/ccnx/forwarder/metis)
include_directories($ENV{CCNX_DEPENDENCIES}/include)
set(OPENSSL_ROOT_DIR $ENV{CCNX_DEPENDENCIES})
-find_package( LongBow REQUIRED )
-include_directories(${LONGBOW_INCLUDE_DIRS})
+if(COMPILE_FOR_IOS)
+ include_directories(iOS)
+ find_host_package( LongBow REQUIRED )
+ include_directories(${LONGBOW_INCLUDE_DIRS})
+
+ find_host_package( LibEvent REQUIRED )
+ include_directories(${LIBEVENT_INCLUDE_DIRS})
+
+ find_host_package( Libparc REQUIRED )
+ include_directories(${LIBPARC_INCLUDE_DIRS})
+
+ find_host_package( CCNX_Common REQUIRED )
+ include_directories(${CCNX_COMMON_INCLUDE_DIRS})
+
+ find_host_package( CCNX_Transport_Rta REQUIRED )
+ include_directories(${CCNX_TRANSPORT_RTA_INCLUDE_DIRS})
-find_package( LibEvent REQUIRED )
-include_directories(${LIBEVENT_INCLUDE_DIRS})
+ find_host_package( CCNX_Portal REQUIRED )
+ include_directories(${CCNX_PORTAL_INCLUDE_DIRS})
-find_package( Libparc REQUIRED )
-include_directories(${LIBPARC_INCLUDE_DIRS})
+ find_host_package ( OpenSSL REQUIRED )
-find_package( CCNX_Common REQUIRED )
-include_directories(${CCNX_COMMON_INCLUDE_DIRS})
+ find_host_package( Doxygen )
+else()
+ find_package( LongBow REQUIRED )
+ include_directories(${LONGBOW_INCLUDE_DIRS})
+
+ find_package( LibEvent REQUIRED )
+ include_directories(${LIBEVENT_INCLUDE_DIRS})
-find_package( CCNX_Transport_Rta REQUIRED )
-include_directories(${CCNX_TRANSPORT_RTA_INCLUDE_DIRS})
+ find_package( Libparc REQUIRED )
+ include_directories(${LIBPARC_INCLUDE_DIRS})
-find_package( CCNX_Portal REQUIRED )
-include_directories(${CCNX_PORTAL_INCLUDE_DIRS})
+ find_package( CCNX_Common REQUIRED )
+ include_directories(${CCNX_COMMON_INCLUDE_DIRS})
-find_package ( Threads REQUIRED )
+ find_package( CCNX_Transport_Rta REQUIRED )
+ include_directories(${CCNX_TRANSPORT_RTA_INCLUDE_DIRS})
-find_package ( OpenSSL REQUIRED )
+ find_package( CCNX_Portal REQUIRED )
+ include_directories(${CCNX_PORTAL_INCLUDE_DIRS})
-find_package( Doxygen )
+ find_package ( Threads REQUIRED )
+
+ find_package ( OpenSSL REQUIRED )
+
+ find_package( Doxygen )
+endif()
set(METIS_LINK_LIBRARIES
metis
@@ -71,6 +107,10 @@ if (ANDROID_API)
macro(AddTest testFile)
message("Android build: Skipping test ${ARGV0}")
endmacro(AddTest)
+elseif(COMPILE_FOR_IOS)
+ macro(AddTest testFile)
+ message("iOS build: Skipping test ${ARGV0}")
+ endmacro(AddTest)
else()
macro(AddTest testFile)
add_executable(${ARGV0} ${ARGV0}.c)
@@ -80,7 +120,7 @@ else()
endmacro(AddTest)
endif()
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR COMPILE_FOR_IOS )
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
message( "-- Set \"-undefined dynamic_lookup\" for shared libraries")
endif()
@@ -110,20 +150,20 @@ execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/version
string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
if(DEB_PACKAGE)
- SET(TYPE "DEBIAN")
- SET(GENERATOR "DEB")
- SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}")
+ set(TYPE "DEBIAN")
+ set(GENERATOR "DEB")
+ set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
- SET(CPACK_${TYPE}_PACKAGE_DEPENDS "longbow (>= 1.0), libparc (>= 1.0), libccnx-common (>= 1.0), libccnx-transport-rta (>= 1.0), libccnx-portal (>= 1.0)")
+ set(CPACK_${TYPE}_PACKAGE_DEPENDS "longbow (>= 1.0), libparc (>= 1.0), libccnx-common (>= 1.0), libccnx-transport-rta (>= 1.0), libccnx-portal (>= 1.0)")
elseif(RPM_PACKAGE)
- SET(TYPE "RPM")
- SET(GENERATOR "RPM")
- SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}")
- SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages" "/lib/systemd/system" "/lib" "/lib/systemd")
+ set(TYPE "RPM")
+ set(GENERATOR "RPM")
+ set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}")
+ set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages" "/lib/systemd/system" "/lib" "/lib/systemd")
set(CPACK_${TYPE}_PACKAGE_AUTOREQ ON)
- SET(CPACK_${TYPE}_PACKAGE_REQUIRES "longbow >= 1.0, libparc >= 1.0, libccnx-common >= 1.0, libccnx-transport-rta >= 1.0, libccnx-portal >= 1.0")
+ set(CPACK_${TYPE}_PACKAGE_REQUIRES "longbow >= 1.0, libparc >= 1.0, libccnx-common >= 1.0, libccnx-transport-rta >= 1.0, libccnx-portal >= 1.0")
else()
- RETURN()
+ return()
endif()
# Install also configuration files
diff --git a/metis/ccnx/forwarder/metis/CMakeLists.txt b/metis/ccnx/forwarder/metis/CMakeLists.txt
index ab8c8e27..24f278a0 100644
--- a/metis/ccnx/forwarder/metis/CMakeLists.txt
+++ b/metis/ccnx/forwarder/metis/CMakeLists.txt
@@ -333,9 +333,7 @@ foreach(lib ${metis_libraries})
set_property(TARGET ${lib} PROPERTY C_STANDARD 99)
endforeach()
-if(NOT ANDROID_API)
- add_subdirectory(command-line)
-else ()
+if (COMPILE_FOR_IOS OR ANDROID_API)
install(FILES ${METIS_BASE_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/forwarder/metis)
install(FILES ${METIS_CONFIG_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/forwarder/metis/config)
install(FILES ${METIS_CONTENT_STORE_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/forwarder/metis/content_store)
@@ -345,8 +343,9 @@ else ()
install(FILES ${METIS_PROCESSOR_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/forwarder/metis/processor)
install(FILES ${METIS_STRATEGIES_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/forwarder/metis/strategies)
install(FILES ${METIS_TLV_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/forwarder/metis/tlv)
- install(FILES ${CMAKE_INSTALL_PREFIX}/../build/sb-forwarder/metis/ccnx/forwarder/metis/config.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
-
+ install(FILES ${CMAKE_BINARY_DIR}/ccnx/forwarder/metis/config.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
+else()
+ add_subdirectory(command-line)
endif()
add_subdirectory(test)
diff --git a/metis/ccnx/forwarder/metis/command-line/metis_control/CMakeLists.txt b/metis/ccnx/forwarder/metis/command-line/metis_control/CMakeLists.txt
index e07d5f40..38e0cc94 100644
--- a/metis/ccnx/forwarder/metis/command-line/metis_control/CMakeLists.txt
+++ b/metis/ccnx/forwarder/metis/command-line/metis_control/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_executable(metis_control metisControl_main.c)
-target_link_libraries(metis_control ${METIS_LINK_LIBRARIES})
+if(NOT COMPILE_FOR_IOS)
+ add_executable(metis_control metisControl_main.c)
+ target_link_libraries(metis_control ${METIS_LINK_LIBRARIES})
-install(TARGETS metis_control RUNTIME DESTINATION bin)
+ install(TARGETS metis_control RUNTIME DESTINATION bin)
+endif() \ No newline at end of file
diff --git a/metis/ccnx/forwarder/metis/command-line/metis_daemon/CMakeLists.txt b/metis/ccnx/forwarder/metis/command-line/metis_daemon/CMakeLists.txt
index 957cab17..673d5063 100644
--- a/metis/ccnx/forwarder/metis/command-line/metis_daemon/CMakeLists.txt
+++ b/metis/ccnx/forwarder/metis/command-line/metis_daemon/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_executable(metis_daemon metis_daemon.c)
-target_link_libraries(metis_daemon ${METIS_LINK_LIBRARIES})
+if(NOT COMPILE_FOR_IOS)
+ add_executable(metis_daemon metis_daemon.c)
+ target_link_libraries(metis_daemon ${METIS_LINK_LIBRARIES})
-install(TARGETS metis_daemon RUNTIME DESTINATION bin)
+ install(TARGETS metis_daemon RUNTIME DESTINATION bin)
+endif()