Skip to content

Commit

Permalink
Fixes build. Added cURL example with combined build support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Widerberg committed Aug 14, 2019
1 parent 40bdb4c commit 29668db
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 67 deletions.
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions .travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand All @@ -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
Expand All @@ -42,4 +42,4 @@ else
|| exit 1
cmake --build . --config Release --target install || exit 1
popd
fi
fi
47 changes: 47 additions & 0 deletions example/example-curl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}"
)
32 changes: 0 additions & 32 deletions example/example-libressl/CMakeLists.txt

This file was deleted.

41 changes: 19 additions & 22 deletions ios.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -429,6 +428,15 @@ set(CMAKE_C_CREATE_STATIC_LIBRARY
"${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
"${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
# 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
Expand All @@ -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()
Expand Down Expand Up @@ -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()

#
Expand Down

0 comments on commit 29668db

Please sign in to comment.