Skip to content

Commit 29668db

Browse files
author
Alexander Widerberg
committed
Fixes build. Added cURL example with combined build support.
1 parent 40bdb4c commit 29668db

File tree

5 files changed

+72
-67
lines changed

5 files changed

+72
-67
lines changed

.travis.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ matrix:
3737
- os: osx
3838
osx_image: xcode10.2
3939
env:
40-
- PLATFORM=OS USE_STRICT_COMPILER_CHECKS=1
41-
- os: osx
42-
osx_image: xcode10.2
43-
env:
44-
- PLATFORM=OS BUILD_LIBRESSL=1
45-
allow_failures:
46-
- env: PLATFORM=OS BUILD_LIBRESSL=1
47-
- env: PLATFORM=OS USE_STRICT_COMPILER_CHECKS=1
40+
- PLATFORM=OS64COMBINED BUILD_CURL=1 USE_XCODE=1
4841

4942
install: true
5043

.travis/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ is-variable-set() {
77
PLATFORM=${PLATFORM:-OS} # Default to "OS" platform
88
BUILD_SHARED=${BUILD_SHARED:-0}
99
USE_XCODE=${USE_XCODE:-0}
10-
BUILD_LIBRESSL=${BUILD_LIBRESSL:-0}
10+
BUILD_CURL=${BUILD_CURL:-0}
1111
USE_STRICT_COMPILER_CHECKS=${USE_STRICT_COMPILER_CHECKS:-0}
1212

1313
SHARED_EXT=""
@@ -25,9 +25,9 @@ if [[ ${USE_STRICT_COMPILER_CHECKS} -eq 1 ]]; then
2525
USE_STRICT_COMPILER_CHECKS_EXT="-DENABLE_STRICT_TRY_COMPILE=1"
2626
fi
2727

28-
if [[ ${BUILD_LIBRESSL} -eq 1 ]]; then
29-
mkdir -p example/example-libressl/build
30-
pushd example/example-libressl/build
28+
if [[ ${BUILD_CURL} -eq 1 ]]; then
29+
mkdir -p example/example-curl/build
30+
pushd example/example-curl/build
3131
cmake .. \
3232
${GENERATOR_EXT} -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake \
3333
-DPLATFORM=${PLATFORM} ${USE_STRICT_COMPILER_CHECKS_EXT} || exit 1
@@ -42,4 +42,4 @@ else
4242
|| exit 1
4343
cmake --build . --config Release --target install || exit 1
4444
popd
45-
fi
45+
fi
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
3+
project(external-curl)
4+
include(ExternalProject)
5+
6+
set(CURL_VERSION 7.65.3)
7+
string(REPLACE "." "_" CURL_VERSION_USCORE ${CURL_VERSION})
8+
9+
list(APPEND CMAKE_ARGS
10+
"-DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}"
11+
"-DBUILD_SHARED_LIBS=OFF"
12+
"-DCMAKE_USE_OPENSSL=OFF"
13+
"-DBUILD_CURL_EXE=OFF"
14+
"-DBUILD_TESTING=FALSE"
15+
"-DHAVE_LIBIDN2=FALSE"
16+
"-DCURL_CA_PATH=none"
17+
"-DCURL_DISABLE_FTP=ON"
18+
"-DCURL_DISABLE_LDAP=ON"
19+
"-DCURL_DISABLE_LDAPS=ON"
20+
"-DCURL_DISABLE_TELNET=ON"
21+
"-DCURL_DISABLE_DICT=ON"
22+
"-DCURL_DISABLE_FILE=ON"
23+
"-DCURL_DISABLE_TFTP=ON"
24+
"-DCURL_DISABLE_RTSP=ON"
25+
"-DCURL_DISABLE_POP3=ON"
26+
"-DCURL_DISABLE_IMAP=ON"
27+
"-DCURL_DISABLE_SMTP=ON"
28+
"-DCURL_DISABLE_GOPHER=ON"
29+
)
30+
31+
if(IOS)
32+
list(APPEND CMAKE_ARGS
33+
"-DPLATFORM=${PLATFORM}"
34+
)
35+
endif()
36+
37+
message(STATUS "Preparing external project \"curl\" with args:")
38+
foreach(CMAKE_ARG ${CMAKE_ARGS})
39+
message(STATUS "-- ${CMAKE_ARG}")
40+
endforeach()
41+
42+
ExternalProject_add(
43+
curl
44+
URL https://github.com/curl/curl/releases/download/curl-${CURL_VERSION_USCORE}/curl-${CURL_VERSION}.tar.gz
45+
PREFIX curl
46+
CMAKE_ARGS "${CMAKE_ARGS}"
47+
)

example/example-libressl/CMakeLists.txt

Lines changed: 0 additions & 32 deletions
This file was deleted.

ios.toolchain.cmake

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,11 @@ endif()
376376
set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols (-fvisibility=hidden)" ${FORCE_CACHE})
377377
# Set strict compiler checks or not
378378
if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE)
379-
# Unless specified, disable symbols visibility by default
379+
# Unless specified, disable strict try_compile()
380380
set(ENABLE_STRICT_TRY_COMPILE FALSE)
381381
message(STATUS "Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!")
382382
endif()
383-
set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler
384-
checks" ${FORCE_CACHE})
383+
set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler checks" ${FORCE_CACHE})
385384
# Get the SDK version information.
386385
execute_process(COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion
387386
OUTPUT_VARIABLE SDK_VERSION
@@ -429,6 +428,15 @@ set(CMAKE_C_CREATE_STATIC_LIBRARY
429428
"${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
430429
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
431430
"${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
431+
# Find the toolchain's provided install_name_tool if none is found on the host
432+
if(NOT CMAKE_INSTALL_NAME_TOOL)
433+
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find install_name_tool
434+
OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT
435+
ERROR_QUIET
436+
OUTPUT_STRIP_TRAILING_WHITESPACE)
437+
set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE STRING "" ${FORCE_CACHE})
438+
message(STATUS "Using install_name_tool: ${CMAKE_INSTALL_NAME_TOOL}")
439+
endif()
432440
# Get the version of Darwin (OS X) of the host.
433441
execute_process(COMMAND uname -r
434442
OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION
@@ -446,8 +454,8 @@ if(MODERN_CMAKE)
446454

447455
# Provide flags for a combined FAT library build on newer CMake versions
448456
if(PLATFORM_INT MATCHES ".*COMBINED")
449-
set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO CACHE INTERNAL "")
450-
set(CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "")
457+
set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO CACHE INTERNAL "" ${FORCE_CACHE})
458+
set(CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "" ${FORCE_CACHE})
451459
message(STATUS "Will combine built (static) artifacts into FAT lib...")
452460
endif()
453461
else()
@@ -608,40 +616,29 @@ set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
608616
set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
609617
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
610618

611-
# Hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old
612-
# build tree (where install_name_tool was hardcoded) and where
613-
# CMAKE_INSTALL_NAME_TOOL isn't in the cache and still cmake didn't fail in
614-
# CMakeFindBinUtils.cmake (because it isn't rerun) hardcode
615-
# CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did
616-
# before, Alex.
617-
if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
618-
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
619-
endif(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
620-
621619
# Set the find root to the iOS developer roots and to user defined paths.
622-
set(CMAKE_FIND_ROOT_PATH ${CMAKE_DEVELOPER_ROOT} ${CMAKE_OSX_SYSROOT_INT}
623-
${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended to all search paths")
620+
set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT_INT} ${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended
621+
to all search paths")
624622
# Default to searching for frameworks first.
625623
set(CMAKE_FIND_FRAMEWORK FIRST)
626624
# Set up the default search directories for frameworks.
627625
set(CMAKE_FRAMEWORK_PATH
628-
${CMAKE_DEVELOPER_ROOT}/Library/Frameworks
629626
${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks
630627
${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks
631-
${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths")
628+
${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths" ${FORCE_CACHE})
632629

633630
# By default, search both the specified iOS SDK and the remainder of the host filesystem.
634631
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
635632
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE STRING "" ${FORCE_CACHE})
636633
endif()
637634
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
638-
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE STRING "" ${FORCE_CACHE})
635+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "" ${FORCE_CACHE})
639636
endif()
640637
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
641-
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE STRING "" ${FORCE_CACHE})
638+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "" ${FORCE_CACHE})
642639
endif()
643640
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
644-
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE STRING "" ${FORCE_CACHE})
641+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "" ${FORCE_CACHE})
645642
endif()
646643

647644
#

0 commit comments

Comments
 (0)