diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-06-05 15:06:32 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-06-05 15:13:47 +0200 |
commit | c3cd37a462a2a2ae1fa3a98b10bb2a070a988af5 (patch) | |
tree | ef849770879c9381435dde8203874a67457bed55 /longbow | |
parent | 6ebe28e33cd0eadd6f707251194803cf34f5678e (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 'longbow')
-rw-r--r-- | longbow/.gitignore | 1 | ||||
-rw-r--r-- | longbow/CMakeLists.txt | 179 | ||||
-rw-r--r-- | longbow/src/LongBow/CMakeLists.txt | 84 |
3 files changed, 150 insertions, 114 deletions
diff --git a/longbow/.gitignore b/longbow/.gitignore index e1365556..2a963e9c 100644 --- a/longbow/.gitignore +++ b/longbow/.gitignore @@ -27,5 +27,4 @@ Makefile *.swp libtool *~ -*.pyc .idea diff --git a/longbow/CMakeLists.txt b/longbow/CMakeLists.txt index 07c743c7..20fc9c0b 100644 --- a/longbow/CMakeLists.txt +++ b/longbow/CMakeLists.txt @@ -8,6 +8,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) execute_process(COMMAND ${PROJECT_SOURCE_DIR}/cmake/get_version.sh ${PROJECT_SOURCE_DIR} @@ -55,8 +60,16 @@ if(ANDROID_API) endmacro(AddTest) add_subdirectory(src) +elseif(COMPILE_FOR_IOS) + message("############ Detected cross compile for ${CMAKE_SYSTEM_NAME}") + message("############ This build will not include doxygen, tools, or tests") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + macro(AddTest testFile) + message("IOS build: Skipping test ${ARGV0}") + endmacro(AddTest) + add_subdirectory(src) else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -D_GNU_SOURCE") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") macro(AddTest testFile) add_executable(${ARGV0} ${ARGV0}.c) target_link_libraries(${ARGV0} ${PARC_BIN_LIBRARIES}) @@ -66,84 +79,88 @@ else() add_subdirectory(src) add_subdirectory(documentation) +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_RELWITHDEBINFO} ${CMAKE_C_FLAGS}") + +# Generate DEB / RPM packages + +option(DEB_PACKAGE "Create deb package" OFF) +option(RPM_PACKAGE "Create deb package" OFF) + +set(VENDOR "Cisco Systems" CACHE STRING "Vendor") +set(CONTACT "msardara@cisco.com" CACHE STRING "Contact") +set(DISTRIBUTION "xenial" CACHE STRING "Distribution") +set(ARCHITECTURE "amd64" CACHE STRING "Architecture") +set(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer") +string(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME) +set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") +set(CPACK_PACKAGE_VENDOR ${VENDOR}) +set(CPACK_PACKAGE_CONTACT ${CONTACT}) +set(CPACK_COMPONENTS_ALL library headers documentation) + +# Get the version +execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/version + OUTPUT_VARIABLE PACKAGE_VERSION) + +if (PACKAGE_VERSION) + string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION) +else() + set(PACKAGE_VERSION 1.0) +endif() + +if(DEB_PACKAGE) + set(TYPE "DEBIAN") + set(GENERATOR "DEB") + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}") + set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-dev") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc") + + set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") + set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-dev_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") + set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") + + set(CPACK_DEBIAN_LIBRARY_PACKAGE_SHLIBDEPS ON) + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "python (>= 2.7.0)") + set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "longbow (>= 1.0)") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "") +elseif(RPM_PACKAGE) + set(TYPE "RPM") + set(GENERATOR "RPM") + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}") + set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-devel") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc") + + set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") + set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-devel-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") + set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_AUTOREQ ON) + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES "python >= 2.7.0") + set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "longbow >= 1.0") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "") + + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages") +else() + return() +endif() - # Generate DEB / RPM packages - - option(DEB_PACKAGE "Create deb package" OFF) - option(RPM_PACKAGE "Create deb package" OFF) - - set(VENDOR "Cisco Systems" CACHE STRING "Vendor") - set(CONTACT "msardara@cisco.com" CACHE STRING "Contact") - set(DISTRIBUTION "xenial" CACHE STRING "Distribution") - set(ARCHITECTURE "amd64" CACHE STRING "Architecture") - set(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer") - string(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME) - set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") - set(CPACK_PACKAGE_VENDOR ${VENDOR}) - set(CPACK_PACKAGE_CONTACT ${CONTACT}) - set(CPACK_COMPONENTS_ALL library headers documentation) - - # Get the version - execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/version - OUTPUT_VARIABLE PACKAGE_VERSION) - - if (PACKAGE_VERSION) - string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION) - else() - set(PACKAGE_VERSION 1.0) - endif() - - if(DEB_PACKAGE) - set(TYPE "DEBIAN") - set(GENERATOR "DEB") - - set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}") - set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-dev") - set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc") - - set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") - set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-dev_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") - set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") - - set(CPACK_DEBIAN_LIBRARY_PACKAGE_SHLIBDEPS ON) - - set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "python (>= 2.7.0)") - set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "longbow (>= 1.0)") - set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "") - elseif(RPM_PACKAGE) - set(TYPE "RPM") - set(GENERATOR "RPM") - - set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}") - set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-devel") - set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc") - - set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") - set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-devel-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") - set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") - - set(CPACK_${TYPE}_LIBRARY_PACKAGE_AUTOREQ ON) - - set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES "python >= 2.7.0") - set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "longbow >= 1.0") - set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "") - - set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages") - else() - return() - endif() - - set(CPACK_GENERATOR ${GENERATOR}) - set(CPACK_${GENERATOR}_COMPONENT_INSTALL ON) - set(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER}) - set(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME}) - set(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION}) - set(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE}) - set(CPACK_${TYPE}_PACKAGE_RELEASE 1) - set(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR}) - set(CPACK_${TYPE}_PACKAGE_DESCRIPTION "Runtime and testing framework for C applications.") - set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Cframework") - - include(CPack) - -endif()
\ No newline at end of file +set(CPACK_GENERATOR ${GENERATOR}) +set(CPACK_${GENERATOR}_COMPONENT_INSTALL ON) +set(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER}) +set(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME}) +set(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION}) +set(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE}) +set(CPACK_${TYPE}_PACKAGE_RELEASE 1) +set(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR}) +set(CPACK_${TYPE}_PACKAGE_DESCRIPTION "Runtime and testing framework for C applications.") +set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Cframework") + +include(CPack)
\ No newline at end of file diff --git a/longbow/src/LongBow/CMakeLists.txt b/longbow/src/LongBow/CMakeLists.txt index 27efc12c..f8054b8d 100644 --- a/longbow/src/LongBow/CMakeLists.txt +++ b/longbow/src/LongBow/CMakeLists.txt @@ -106,7 +106,7 @@ set(LIBLONGBOW_SOURCE_FILES longBow_SubProcess.c longBow_TestCase.c longBow_TestCaseClipBoard.c - longBow_TestCaseMetaData.c + longBow_TestCaseMetaData.c longBow_TestFixture.c longBow_TestFixtureConfig.c longBow_TestRunner.c @@ -115,50 +115,67 @@ set(LIBLONGBOW_SOURCE_FILES source_group(longbow FILES ${LIBLONGBOW_SOURCE_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() -add_library(longbow-ansiterm STATIC ${LONGBOW_REPORT_ANSI_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) -add_library(longbow-ansiterm.shared SHARED ${LONGBOW_REPORT_ANSI_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) +if(COMPILE_FOR_IOS OR ANDROID_API) + add_library(longbow-ansiterm STATIC ${LONGBOW_REPORT_ANSI_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) -set_target_properties(longbow-ansiterm.shared PROPERTIES - SOVERSION 1 - VERSION 1.0 - OUTPUT_NAME longbow-ansiterm) + add_library(longbow-textplain STATIC ${LONGBOW_REPORT_TEXT_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) + add_library(longbow STATIC ${LIBLONGBOW_SOURCE_FILES}) -add_library(longbow-textplain STATIC ${LONGBOW_REPORT_TEXT_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) -add_library(longbow-textplain.shared SHARED ${LONGBOW_REPORT_TEXT_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) + set(longbowLibraries + longbow + longbow-ansiterm + longbow-textplain + ) -set_target_properties(longbow-textplain.shared PROPERTIES - SOVERSION 1 - VERSION 1.0 - OUTPUT_NAME longbow-textplain) + foreach(lib ${longbowLibraries}) + install(TARGETS ${lib} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endforeach() +else() + add_library(longbow-ansiterm STATIC ${LONGBOW_REPORT_ANSI_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) + add_library(longbow-ansiterm.shared SHARED ${LONGBOW_REPORT_ANSI_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) -add_library(longbow STATIC ${LIBLONGBOW_SOURCE_FILES}) -add_library(longbow.shared SHARED ${LIBLONGBOW_SOURCE_FILES}) + set_target_properties(longbow-ansiterm.shared PROPERTIES + SOVERSION 1 + VERSION 1.0 + OUTPUT_NAME longbow-ansiterm) -set_target_properties(longbow.shared PROPERTIES - SOVERSION 1 - VERSION 1.0 - OUTPUT_NAME longbow) + add_library(longbow-textplain STATIC ${LONGBOW_REPORT_TEXT_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) + add_library(longbow-textplain.shared SHARED ${LONGBOW_REPORT_TEXT_SOURCE_FILES} ${LONGBOW_REPORT_BASE_SOURCE_FILES}) -add_executable(longbow-config ${LONGBOW_CONFIG_SOURCE_FILES}) + set_target_properties(longbow-textplain.shared PROPERTIES + SOVERSION 1 + VERSION 1.0 + OUTPUT_NAME longbow-textplain) + add_library(longbow STATIC ${LIBLONGBOW_SOURCE_FILES}) + add_library(longbow.shared SHARED ${LIBLONGBOW_SOURCE_FILES}) -set(longbowLibraries - longbow - longbow.shared - longbow-ansiterm - longbow-ansiterm.shared - longbow-textplain - longbow-textplain.shared - ) + set_target_properties(longbow.shared PROPERTIES + SOVERSION 1 + VERSION 1.0 + OUTPUT_NAME longbow) + + add_executable(longbow-config ${LONGBOW_CONFIG_SOURCE_FILES}) + + set(longbowLibraries + longbow + longbow.shared + longbow-ansiterm + longbow-ansiterm.shared + longbow-textplain + longbow-textplain.shared + ) -foreach(lib ${longbowLibraries}) - install(TARGETS ${lib} COMPONENT library LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -endforeach() + foreach(lib ${longbowLibraries}) + install(TARGETS ${lib} COMPONENT library LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endforeach() + +endif() install(FILES ${LIBLONGBOW_HEADER_FILES} DESTINATION include/LongBow COMPONENT headers) install(FILES ${LONGBOW_REPORT_HEADER_FILES} DESTINATION include/LongBow/Reporting COMPONENT headers) @@ -166,6 +183,9 @@ install(FILES ${LONGBOW_REPORT_HEADER_FILES} DESTINATION include/LongBow/Reporti if(ANDROID_API) message("############ Detected cross compile for ${CMAKE_SYSTEM_NAME}") message("############ This build will not include doxygen, tools, or tests") +elseif(COMPILE_FOR_IOS) + message("############ Detected cross compile for ${CMAKE_SYSTEM_NAME}") + message("############ This build will not include doxygen, tools, or tests") else() add_subdirectory(test) endif() |