diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-06-05 15:45:33 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-06-05 16:46:09 +0200 |
commit | b9969fb070049f4c9319ab1465481a9709525e6e (patch) | |
tree | 12578cb76fc0db9d1fbad5ce64516dadd70a0aad /libccnx-common | |
parent | 5e7ad51c32a92b84e2e42741d96c68ec834e6f8b (diff) |
- Adding support for iOS
- Adding build type: DEBUG, RELEASE, RELEASE with debug symbols, RELEASE with min size executable
Change-Id: Idd76bc93af6a90e9e491c53373d845f49b6b3b45
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'libccnx-common')
-rw-r--r-- | libccnx-common/CMakeLists.txt | 49 | ||||
-rw-r--r-- | libccnx-common/ccnx/common/CMakeLists.txt | 37 |
2 files changed, 61 insertions, 25 deletions
diff --git a/libccnx-common/CMakeLists.txt b/libccnx-common/CMakeLists.txt index ea15ce2a..940dad9a 100644 --- a/libccnx-common/CMakeLists.txt +++ b/libccnx-common/CMakeLists.txt @@ -6,6 +6,11 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) 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 () + if( UNIX ) link_libraries(m) endif( UNIX ) @@ -20,9 +25,14 @@ if(ANDROID_API) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -Wall") else() # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -DNDEBUG -DLibccnx_DISABLE_VALIDATION") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 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} -DLibccnx_DISABLE_VALIDATION") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CMAKE_C_FLAGS}") +set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${CMAKE_C_FLAGS}") + #set(CMAKE_C_FLAGS_NOPANTS "${CMAKE_C_FLAGS_NOPANTS} -O3 -DNDEBUG -DLibccnx_DISABLE_VALIDATION") include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/ccnx/common) @@ -30,20 +40,35 @@ include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/ccnx/common) 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) + 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 ( OpenSSL REQUIRED ) -find_package( LibEvent REQUIRED ) -include_directories(${LIBEVENT_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( Libparc REQUIRED ) -include_directories(${LIBPARC_INCLUDE_DIRS}) + find_package( Libparc REQUIRED ) + include_directories(${LIBPARC_INCLUDE_DIRS}) -find_package ( Threads REQUIRED ) + find_package ( Threads REQUIRED ) -find_package ( OpenSSL REQUIRED ) + find_package ( OpenSSL REQUIRED ) -find_package( Doxygen ) + find_package( Doxygen ) +endif() add_custom_target(${PROJECT_NAME}_cleanup_profiling_data "find" "." "-name" "*.gcda" "-delete" @@ -54,6 +79,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) diff --git a/libccnx-common/ccnx/common/CMakeLists.txt b/libccnx-common/ccnx/common/CMakeLists.txt index 81a7054e..f333a4ea 100644 --- a/libccnx-common/ccnx/common/CMakeLists.txt +++ b/libccnx-common/ccnx/common/CMakeLists.txt @@ -232,25 +232,32 @@ set(PUBLIC_HDRS configure_file("config.h.in" "config.h" @ONLY) -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() -add_library(ccnx_common STATIC ${ALL_SRCS} ${ALL_HDRS}) -add_library(ccnx_common.shared SHARED ${ALL_SRCS}) - -target_link_libraries(ccnx_common.shared ${LIBPARC_LIBRARIES}) -set_target_properties(ccnx_common.shared PROPERTIES - C_STANDARD 99 - SOVERSION 1 - VERSION 1.0 - OUTPUT_NAME ccnx_common ) - -set(libccnx_commonLibraries - ccnx_common - ccnx_common.shared - ) +if(COMPILE_FOR_IOS OR ANDROID_API) + add_library(ccnx_common STATIC ${ALL_SRCS} ${ALL_HDRS}) + set(libccnx_commonLibraries + ccnx_common + ) +else() + add_library(ccnx_common STATIC ${ALL_SRCS} ${ALL_HDRS}) + add_library(ccnx_common.shared SHARED ${ALL_SRCS}) + + target_link_libraries(ccnx_common.shared ${LIBPARC_LIBRARIES}) + set_target_properties(ccnx_common.shared PROPERTIES + C_STANDARD 99 + SOVERSION 1 + VERSION 1.0 + OUTPUT_NAME ccnx_common ) + + set(libccnx_commonLibraries + ccnx_common + ccnx_common.shared + ) +endif() foreach(lib ${libccnx_commonLibraries}) install(TARGETS ${lib} COMPONENT library LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) |