forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom dyld linker for iOS mach-o executable files (apache#7875)
* [IOS-RPC] Fix compilation iOS_PRC app Signed-off-by: Alexander Peskov <peskovnn@gmail.com>
- Loading branch information
Showing
9 changed files
with
252 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
include(ExternalProject) | ||
|
||
# Check if xcodebuild tool is available and configured. | ||
# Otherwise will skip all iOS specific targets. | ||
execute_process(COMMAND xcodebuild -version | ||
RESULT_VARIABLE XCBUILD_AVAILABLE | ||
OUTPUT_QUIET | ||
ERROR_QUIET | ||
) | ||
|
||
if (NOT XCBUILD_AVAILABLE EQUAL 0) | ||
message(WARNING | ||
"The build tool xcodebuild is not properly configured. Please install Xcode app and specify " | ||
"path to it via DEVELOPER_DIR env var or \"sudo xcode-select -switch <path-to-xcode-dev-dir>\".\n" | ||
"iOS RPC application target is switched off." | ||
) | ||
return() | ||
endif() | ||
|
||
|
||
# External project with custom mach-o dynamic loader | ||
# It is required to load unsigned shared modules on real iOS devices | ||
ExternalProject_Add(custom_dso_loader | ||
GIT_REPOSITORY https://github.com/octoml/macho-dyld.git | ||
GIT_TAG 48d1e8b5c40c7f5b744cb089634af17dd86125b2 | ||
PREFIX custom_dso_loader | ||
LOG_DOWNLOAD TRUE | ||
LOG_CONFIGURE TRUE | ||
CMAKE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> # to install into local build dir | ||
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | ||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} | ||
-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION} | ||
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} | ||
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} | ||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} | ||
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=${CMAKE_BUILD_WITH_INSTALL_NAME_DIR} | ||
) | ||
|
||
# iOS RPC Xcode project wrapper to integrate into Cmake | ||
ExternalProject_Add(ios_rpc | ||
PREFIX ios_rpc | ||
DEPENDS custom_dso_loader | ||
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} | ||
CONFIGURE_COMMAND "" | ||
INSTALL_COMMAND "" | ||
BUILD_COMMAND xcodebuild | ||
-scheme tvmrpc | ||
-configuration ${CMAKE_BUILD_TYPE} | ||
-project <SOURCE_DIR>/tvmrpc.xcodeproj | ||
-derivedDataPath <BINARY_DIR> | ||
-sdk ${CMAKE_OSX_SYSROOT} | ||
-arch ${CMAKE_OSX_ARCHITECTURES} | ||
-hideShellScriptEnvironment | ||
build | ||
IPHONEOS_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} | ||
DEVELOPMENT_TEAM=${CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM} | ||
TVM_BUILD_DIR=${CMAKE_BINARY_DIR} | ||
USE_CUSTOM_DSO_LOADER=YES | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.