aboutsummaryrefslogtreecommitdiffstats
path: root/libparc
diff options
context:
space:
mode:
authorMauro Sardara <msardara+fdio@cisco.com>2017-06-05 15:06:32 +0200
committerMauro Sardara <msardara+fdio@cisco.com>2017-06-05 15:13:47 +0200
commitc3cd37a462a2a2ae1fa3a98b10bb2a070a988af5 (patch)
treeef849770879c9381435dde8203874a67457bed55 /libparc
parent6ebe28e33cd0eadd6f707251194803cf34f5678e (diff)
- Adding support for iOS
- Adding build type: DEBUG, RELEASE, RELEASE with debug symbols, RELEASE with min size executable Change-Id: I3a52af68445264824476eab3d9f39b6f23f634b4 Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'libparc')
-rw-r--r--libparc/.gitignore2
-rw-r--r--libparc/CMakeLists.txt42
-rw-r--r--libparc/parc/CMakeLists.txt57
3 files changed, 70 insertions, 31 deletions
diff --git a/libparc/.gitignore b/libparc/.gitignore
index 926b1a2c..9bdb2b73 100644
--- a/libparc/.gitignore
+++ b/libparc/.gitignore
@@ -61,7 +61,7 @@ parc/parcLibrary_About.c
parc/parcLibrary_About.h
parc/parc_About.c
parc/parc_About.h
-LDADD = ${INC_LFLAGS}
+LDADD = ${INC_LFLAGS}
libtool
*~
diff --git a/libparc/CMakeLists.txt b/libparc/CMakeLists.txt
index ca5c5e10..defa060a 100644
--- a/libparc/CMakeLists.txt
+++ b/libparc/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 )
@@ -18,28 +23,47 @@ if(ANDROID_API)
message("############ Detected cross compile for $ENV{CMAKE_SYSTEM_NAME}")
message("############ This build will not include doxygen, tools, or tests")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -Wall")
+elseif(COMPILE_FOR_IOS)
+ message("############ Detected cross compile for $ENV{CMAKE_SYSTEM_NAME}")
+ message("############ This build will not include doxygen, tools, or tests")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else()
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
# set(CMAKE_C_FLAGS_NOPANTS "${CMAKE_C_FLAGS_NOPANTS} -O3 -DNDEBUG -DPARCLibrary_DISABLE_VALIDATION")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -DNDEBUG -DPARCLibrary_DISABLE_VALIDATION")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
find_package( Doxygen )
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} -DPARCLibrary_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}")
+
include_directories($ENV{CCNX_DEPENDENCIES}/include)
set(OPENSSL_ROOT_DIR $ENV{CCNX_DEPENDENCIES})
include_directories(${PROJECT_BINARY_DIR}/parc ${PROJECT_SOURCE_DIR})
-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_package( LibEvent REQUIRED )
-include_directories(${LIBEVENT_INCLUDE_DIRS})
+ find_host_package ( OpenSSL REQUIRED )
+else()
+ find_package( LongBow REQUIRED )
+ include_directories(${LONGBOW_INCLUDE_DIRS})
+
+ find_package( LibEvent REQUIRED )
+ include_directories(${LIBEVENT_INCLUDE_DIRS})
-find_package ( Threads REQUIRED )
+ find_package ( Threads REQUIRED )
-find_package ( OpenSSL REQUIRED )
+ find_package ( OpenSSL REQUIRED )
+endif()
set(PARC_BIN_LIBRARIES
parc
@@ -59,6 +83,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/libparc/parc/CMakeLists.txt b/libparc/parc/CMakeLists.txt
index 04abfac9..09b73e17 100644
--- a/libparc/parc/CMakeLists.txt
+++ b/libparc/parc/CMakeLists.txt
@@ -352,25 +352,34 @@ source_group(testing FILES ${LIBPARC_TESTING_SOURCE_FILES} ${LIBPARC_TESTING_HEA
source_group(statistics FILES ${LIBPARC_STATISTICS_SOURCE_FILES} ${LIBPARC_STATISTICS_HEADER_FILES})
source_group(memory FILES ${LIBPARC_MEMORY_SOURCE_FILES} ${LIBPARC_MEMORY_HEADER_FILES})
-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()
+if(COMPILE_FOR_IOS OR ANDROID_API)
+ add_library(parc STATIC ${LIBPARC_SOURCE_FILES} ${LIBEVENT_LIBRARIES} ${OPENSSL_LIBRARIES})
+ target_link_libraries(parc ${LIBEVENT_LIBRARIES})
+ target_link_libraries(parc ${OPENSSL_LIBRARIES})
+ set(libparcLibraries
+ parc
+ )
+else()
+ add_library(parc STATIC ${LIBPARC_SOURCE_FILES})
+ add_library(parc.shared SHARED ${LIBPARC_SOURCE_FILES})
+ target_link_libraries(parc.shared ${LIBEVENT_LIBRARIES})
+ target_link_libraries(parc.shared ${OPENSSL_LIBRARIES})
+ set_target_properties(parc.shared PROPERTIES
+ C_STANDARD 99
+ SOVERSION 1
+ VERSION 1.0
+ OUTPUT_NAME parc )
+ set(libparcLibraries
+ parc
+ parc.shared
+ )
-add_library(parc STATIC ${LIBPARC_SOURCE_FILES})
-add_library(parc.shared SHARED ${LIBPARC_SOURCE_FILES})
-target_link_libraries(parc.shared ${LIBEVENT_LIBRARIES})
-target_link_libraries(parc.shared ${OPENSSL_LIBRARIES})
-set_target_properties(parc.shared PROPERTIES
- C_STANDARD 99
- SOVERSION 1
- VERSION 1.0
- OUTPUT_NAME parc )
+endif()
-set(libparcLibraries
- parc
- parc.shared
- )
foreach(lib ${libparcLibraries})
install(TARGETS ${lib} COMPONENT library LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
@@ -387,12 +396,14 @@ install(FILES ${LIBPARC_BASE_HEADER_FILES} DESTINATION include/parc COMPON
install(FILES ${LIBPARC_STATISTICS_HEADER_FILES} DESTINATION include/parc/statistics COMPONENT headers)
install(FILES ${LIBPARC_MEMORY_HEADER_FILES} DESTINATION include/parc/memory COMPONENT headers)
-add_subdirectory(security/command-line)
-add_subdirectory(algol/test)
-add_subdirectory(concurrent/test)
-add_subdirectory(developer/test)
-add_subdirectory(security/test)
-add_subdirectory(logging/test)
-add_subdirectory(testing/test)
-add_subdirectory(statistics/test)
-add_subdirectory(memory/test)
+if(NOT COMPILE_FOR_IOS)
+ add_subdirectory(security/command-line)
+ add_subdirectory(algol/test)
+ add_subdirectory(concurrent/test)
+ add_subdirectory(developer/test)
+ add_subdirectory(security/test)
+ add_subdirectory(logging/test)
+ add_subdirectory(testing/test)
+ add_subdirectory(statistics/test)
+ add_subdirectory(memory/test)
+endif()