diff --git a/.travis.yml b/.travis.yml index 806e8bd..faf1ee0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,14 +37,7 @@ matrix: - os: osx osx_image: xcode10.2 env: - - PLATFORM=OS USE_STRICT_COMPILER_CHECKS=1 - - os: osx - osx_image: xcode10.2 - env: - - PLATFORM=OS BUILD_LIBRESSL=1 - allow_failures: - - env: PLATFORM=OS BUILD_LIBRESSL=1 - - env: PLATFORM=OS USE_STRICT_COMPILER_CHECKS=1 + - PLATFORM=OS64COMBINED BUILD_CURL=1 USE_XCODE=1 install: true diff --git a/.travis/build.sh b/.travis/build.sh index c445325..943fdde 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -7,7 +7,7 @@ is-variable-set() { PLATFORM=${PLATFORM:-OS} # Default to "OS" platform BUILD_SHARED=${BUILD_SHARED:-0} USE_XCODE=${USE_XCODE:-0} -BUILD_LIBRESSL=${BUILD_LIBRESSL:-0} +BUILD_CURL=${BUILD_CURL:-0} USE_STRICT_COMPILER_CHECKS=${USE_STRICT_COMPILER_CHECKS:-0} SHARED_EXT="" @@ -25,9 +25,9 @@ if [[ ${USE_STRICT_COMPILER_CHECKS} -eq 1 ]]; then USE_STRICT_COMPILER_CHECKS_EXT="-DENABLE_STRICT_TRY_COMPILE=1" fi -if [[ ${BUILD_LIBRESSL} -eq 1 ]]; then - mkdir -p example/example-libressl/build - pushd example/example-libressl/build +if [[ ${BUILD_CURL} -eq 1 ]]; then + mkdir -p example/example-curl/build + pushd example/example-curl/build cmake .. \ ${GENERATOR_EXT} -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake \ -DPLATFORM=${PLATFORM} ${USE_STRICT_COMPILER_CHECKS_EXT} || exit 1 @@ -42,4 +42,4 @@ else || exit 1 cmake --build . --config Release --target install || exit 1 popd -fi \ No newline at end of file +fi diff --git a/example/example-curl/CMakeLists.txt b/example/example-curl/CMakeLists.txt new file mode 100644 index 0000000..5d20fc2 --- /dev/null +++ b/example/example-curl/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.1) + +project(external-curl) +include(ExternalProject) + +set(CURL_VERSION 7.65.3) +string(REPLACE "." "_" CURL_VERSION_USCORE ${CURL_VERSION}) + +list(APPEND CMAKE_ARGS + "-DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}" + "-DBUILD_SHARED_LIBS=OFF" + "-DCMAKE_USE_OPENSSL=OFF" + "-DBUILD_CURL_EXE=OFF" + "-DBUILD_TESTING=FALSE" + "-DHAVE_LIBIDN2=FALSE" + "-DCURL_CA_PATH=none" + "-DCURL_DISABLE_FTP=ON" + "-DCURL_DISABLE_LDAP=ON" + "-DCURL_DISABLE_LDAPS=ON" + "-DCURL_DISABLE_TELNET=ON" + "-DCURL_DISABLE_DICT=ON" + "-DCURL_DISABLE_FILE=ON" + "-DCURL_DISABLE_TFTP=ON" + "-DCURL_DISABLE_RTSP=ON" + "-DCURL_DISABLE_POP3=ON" + "-DCURL_DISABLE_IMAP=ON" + "-DCURL_DISABLE_SMTP=ON" + "-DCURL_DISABLE_GOPHER=ON" +) + +if(IOS) + list(APPEND CMAKE_ARGS + "-DPLATFORM=${PLATFORM}" + ) +endif() + +message(STATUS "Preparing external project \"curl\" with args:") +foreach(CMAKE_ARG ${CMAKE_ARGS}) + message(STATUS "-- ${CMAKE_ARG}") +endforeach() + +ExternalProject_add( + curl + URL https://github.com/curl/curl/releases/download/curl-${CURL_VERSION_USCORE}/curl-${CURL_VERSION}.tar.gz + PREFIX curl + CMAKE_ARGS "${CMAKE_ARGS}" + ) diff --git a/example/example-libressl/CMakeLists.txt b/example/example-libressl/CMakeLists.txt deleted file mode 100644 index ecc0d76..0000000 --- a/example/example-libressl/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 3.1) - -project(external-libressl) -include(ExternalProject) - -set(LIBRESSL_VERSION 2.9.2) - -list(APPEND CMAKE_ARGS - "-DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}" - "-DBUILD_SHARED_LIBS=OFF" - "-DLIBRESSL_APPS=OFF" - "-DLIBRESSL_TESTS=OFF" - ) - -if(IOS) - list(APPEND CMAKE_ARGS - "-DPLATFORM=${PLATFORM}" - "-DCMAKE_C_FLAGS=-Wno-implicit-function-declaration" - ) -endif() - -message(STATUS "Preparing external project \"libressl\" with args:") -foreach(CMAKE_ARG ${CMAKE_ARGS}) - message(STATUS "-- ${CMAKE_ARG}") -endforeach() - -ExternalProject_add( - libressl - URL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz - PREFIX libressl - CMAKE_ARGS "${CMAKE_ARGS}" - ) diff --git a/ios.toolchain.cmake b/ios.toolchain.cmake index 58bd509..170f1fb 100644 --- a/ios.toolchain.cmake +++ b/ios.toolchain.cmake @@ -376,12 +376,11 @@ endif() set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols (-fvisibility=hidden)" ${FORCE_CACHE}) # Set strict compiler checks or not if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE) - # Unless specified, disable symbols visibility by default + # Unless specified, disable strict try_compile() set(ENABLE_STRICT_TRY_COMPILE FALSE) message(STATUS "Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!") endif() -set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler -checks" ${FORCE_CACHE}) +set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler checks" ${FORCE_CACHE}) # Get the SDK version information. execute_process(COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion OUTPUT_VARIABLE SDK_VERSION @@ -429,6 +428,15 @@ set(CMAKE_C_CREATE_STATIC_LIBRARY "${BUILD_LIBTOOL} -static -o ") set(CMAKE_CXX_CREATE_STATIC_LIBRARY "${BUILD_LIBTOOL} -static -o ") +# Find the toolchain's provided install_name_tool if none is found on the host +if(NOT CMAKE_INSTALL_NAME_TOOL) + execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find install_name_tool + OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE STRING "" ${FORCE_CACHE}) + message(STATUS "Using install_name_tool: ${CMAKE_INSTALL_NAME_TOOL}") +endif() # Get the version of Darwin (OS X) of the host. execute_process(COMMAND uname -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION @@ -446,8 +454,8 @@ if(MODERN_CMAKE) # Provide flags for a combined FAT library build on newer CMake versions if(PLATFORM_INT MATCHES ".*COMBINED") - set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO CACHE INTERNAL "") - set(CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "") + set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO CACHE INTERNAL "" ${FORCE_CACHE}) + set(CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "" ${FORCE_CACHE}) message(STATUS "Will combine built (static) artifacts into FAT lib...") endif() else() @@ -608,40 +616,29 @@ set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a") set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") -# Hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old -# build tree (where install_name_tool was hardcoded) and where -# CMAKE_INSTALL_NAME_TOOL isn't in the cache and still cmake didn't fail in -# CMakeFindBinUtils.cmake (because it isn't rerun) hardcode -# CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did -# before, Alex. -if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) - find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool) -endif(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) - # Set the find root to the iOS developer roots and to user defined paths. -set(CMAKE_FIND_ROOT_PATH ${CMAKE_DEVELOPER_ROOT} ${CMAKE_OSX_SYSROOT_INT} - ${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended to all search paths") +set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT_INT} ${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended + to all search paths") # Default to searching for frameworks first. set(CMAKE_FIND_FRAMEWORK FIRST) # Set up the default search directories for frameworks. set(CMAKE_FRAMEWORK_PATH - ${CMAKE_DEVELOPER_ROOT}/Library/Frameworks ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks - ${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths") + ${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths" ${FORCE_CACHE}) # By default, search both the specified iOS SDK and the remainder of the host filesystem. if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE STRING "" ${FORCE_CACHE}) endif() if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE STRING "" ${FORCE_CACHE}) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "" ${FORCE_CACHE}) endif() if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE STRING "" ${FORCE_CACHE}) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "" ${FORCE_CACHE}) endif() if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE STRING "" ${FORCE_CACHE}) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "" ${FORCE_CACHE}) endif() #