mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 11:06:32 +00:00
Merge pull request #6862 from Kyle-Ye/optimize/ios
Add SecCopyErrorMessageString for iOS and update README for iOS
This commit is contained in:
10
.github/workflows/nightly.yml
vendored
10
.github/workflows/nightly.yml
vendored
@@ -74,6 +74,16 @@ jobs:
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
SKIP_SSH_TESTS: true
|
||||
SKIP_NEGOTIATE_TESTS: true
|
||||
- name: "iOS"
|
||||
id: ios
|
||||
os: macos-12
|
||||
setup-script: ios
|
||||
env:
|
||||
CC: clang
|
||||
CMAKE_OPTIONS: -DBUILD_TESTS=OFF -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64
|
||||
CMAKE_GENERATOR: Ninja
|
||||
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
|
||||
SKIP_TESTS: true # Cannot exec iOS app on macOS
|
||||
- name: "Windows (amd64, Visual Studio, Schannel)"
|
||||
id: windows-amd64-vs
|
||||
os: windows-2019
|
||||
|
||||
25
README.md
25
README.md
@@ -48,6 +48,7 @@ Table of Contents
|
||||
* [Advanced Usage](#advanced-usage)
|
||||
* [Compiler and linker options](#compiler-and-linker-options)
|
||||
* [macOS](#macos)
|
||||
* [iOS](#ios)
|
||||
* [Android](#android)
|
||||
* [MinGW](#mingw)
|
||||
* [Language Bindings](#language-bindings)
|
||||
@@ -329,6 +330,30 @@ If you'd like to work with Xcode, you can generate an Xcode project with "-G Xco
|
||||
> (10.4.4 ~ 10.6), CMake sets it all up for you if you use
|
||||
> `-DCMAKE_OSX_ARCHITECTURES="i386;x86_64"` when configuring.
|
||||
|
||||
iOS
|
||||
-------
|
||||
|
||||
1. Get an iOS cmake toolchain File:
|
||||
|
||||
You can use a pre-existing toolchain file like [ios-cmake](https://github.com/leetal/ios-cmake) or write your own.
|
||||
|
||||
2. Specify the toolchain and system Name:
|
||||
|
||||
- The CMAKE_TOOLCHAIN_FILE variable points to the toolchain file for iOS.
|
||||
- The CMAKE_SYSTEM_NAME should be set to iOS.
|
||||
|
||||
3. Example Command:
|
||||
|
||||
Assuming you're using the ios-cmake toolchain, the command might look like this:
|
||||
|
||||
```
|
||||
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=path/to/ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 ..
|
||||
```
|
||||
|
||||
4. Build the Project:
|
||||
|
||||
After generating the project, open the .xcodeproj file in Xcode, select your iOS device or simulator as the target, and build your project.
|
||||
|
||||
Android
|
||||
-------
|
||||
|
||||
|
||||
10
ci/setup-ios-build.sh
Executable file
10
ci/setup-ios-build.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
brew update
|
||||
brew install pkgconfig libssh2 ninja
|
||||
|
||||
ln -s /Applications/Xcode.app/Contents/Developer/usr/lib/libLeaksAtExit.dylib /usr/local/lib
|
||||
|
||||
curl -s -L https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake -o ios.toolchain.cmake
|
||||
@@ -15,6 +15,12 @@ find_path(ICONV_INCLUDE_DIR iconv.h)
|
||||
check_function_exists(iconv_open libc_has_iconv)
|
||||
find_library(iconv_lib NAMES iconv libiconv libiconv-2 c)
|
||||
|
||||
# workaround the iOS issue where iconv is provided by libc
|
||||
# We set it to false to force it add -liconv to the linker flags
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "iOS")
|
||||
set(libc_has_iconv FALSE)
|
||||
endif()
|
||||
|
||||
if(ICONV_INCLUDE_DIR AND libc_has_iconv)
|
||||
set(ICONV_FOUND TRUE)
|
||||
set(ICONV_LIBRARIES "")
|
||||
|
||||
@@ -2,7 +2,7 @@ include(SanitizeBool)
|
||||
|
||||
# We try to find any packages our backends might use
|
||||
find_package(GSSAPI)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "iOS")
|
||||
include(FindGSSFramework)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ include(SanitizeBool)
|
||||
# We try to find any packages our backends might use
|
||||
find_package(OpenSSL)
|
||||
find_package(mbedTLS)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "iOS")
|
||||
find_package(Security)
|
||||
find_package(CoreFoundation)
|
||||
endif()
|
||||
|
||||
@@ -5,7 +5,12 @@ if(REGEX_BACKEND STREQUAL "")
|
||||
check_symbol_exists(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
|
||||
|
||||
if(HAVE_REGCOMP_L)
|
||||
set(REGEX_BACKEND "regcomp_l")
|
||||
# 'regcomp_l' has been explicitly marked unavailable on iOS_SDK
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "iOS")
|
||||
set(REGEX_BACKEND "regcomp")
|
||||
else()
|
||||
set(REGEX_BACKEND "regcomp_l")
|
||||
endif()
|
||||
elseif(PCRE_FOUND)
|
||||
set(REGEX_BACKEND "pcre")
|
||||
else()
|
||||
|
||||
@@ -127,7 +127,8 @@ endif()
|
||||
# realtime support
|
||||
|
||||
check_library_exists(rt clock_gettime "time.h" NEED_LIBRT)
|
||||
if(NEED_LIBRT)
|
||||
|
||||
if(NEED_LIBRT AND NOT CMAKE_SYSTEM_NAME MATCHES "iOS")
|
||||
list(APPEND LIBGIT2_SYSTEM_LIBS rt)
|
||||
list(APPEND LIBGIT2_PC_LIBS "-lrt")
|
||||
endif()
|
||||
@@ -201,7 +202,7 @@ add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support")
|
||||
add_subdirectory(libgit2)
|
||||
add_subdirectory(util)
|
||||
|
||||
if(BUILD_CLI)
|
||||
if(BUILD_CLI AND NOT CMAKE_SYSTEM_NAME MATCHES "iOS")
|
||||
add_subdirectory(cli)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user