Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
afeixing77
Paddle
提交
224f8b06
P
Paddle
项目概览
afeixing77
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
224f8b06
编写于
8月 30, 2017
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support building for multiple architecures at one time.
上级
d2435ba8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
58 deletion
+42
-58
CMakeLists.txt
CMakeLists.txt
+8
-26
cmake/cross_compiling/ios.cmake
cmake/cross_compiling/ios.cmake
+7
-1
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+17
-6
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+10
-8
ios_run.sh
ios_run.sh
+0
-17
未找到文件。
CMakeLists.txt
浏览文件 @
224f8b06
...
...
@@ -63,38 +63,23 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE
)
endif
()
if
(
IOS
)
set
(
WITH_GPU OFF CACHE STRING
"Disable GPU when cross-compiling for Android"
FORCE
)
set
(
WITH_AVX OFF CACHE STRING
"Disable AVX when cross-compiling for Android"
FORCE
)
set
(
WITH_PYTHON OFF CACHE STRING
"Disable PYTHON when cross-compiling for Android"
FORCE
)
set
(
WITH_RDMA OFF CACHE STRING
"Disable RDMA when cross-compiling for Android"
FORCE
)
set
(
WITH_MKLDNN OFF CACHE STRING
"Disable MKLDNN when cross-compiling for Android"
FORCE
)
set
(
WITH_MKLML OFF CACHE STRING
"Disable MKLML package when cross-compiling for Android"
FORCE
)
endif
(
IOS
)
if
(
ANDROID
)
if
(
${
CMAKE_SYSTEM_VERSION
}
VERSION_LESS
"21"
)
if
(
ANDROID OR IOS
)
if
(
ANDROID AND
${
CMAKE_SYSTEM_VERSION
}
VERSION_LESS
"21"
)
message
(
FATAL_ERROR
"Unsupport standalone toolchains with Android API level lower than 21"
)
endif
()
set
(
WITH_GPU OFF CACHE STRING
"Disable GPU when cross-compiling for Android"
FORCE
)
"Disable GPU when cross-compiling for Android
and iOS
"
FORCE
)
set
(
WITH_AVX OFF CACHE STRING
"Disable AVX when cross-compiling for Android"
FORCE
)
"Disable AVX when cross-compiling for Android
and iOS
"
FORCE
)
set
(
WITH_PYTHON OFF CACHE STRING
"Disable PYTHON when cross-compiling for Android"
FORCE
)
"Disable PYTHON when cross-compiling for Android
and iOS
"
FORCE
)
set
(
WITH_RDMA OFF CACHE STRING
"Disable RDMA when cross-compiling for Android"
FORCE
)
"Disable RDMA when cross-compiling for Android
and iOS
"
FORCE
)
set
(
WITH_MKLDNN OFF CACHE STRING
"Disable MKLDNN when cross-compiling for Android"
FORCE
)
"Disable MKLDNN when cross-compiling for Android
and iOS
"
FORCE
)
set
(
WITH_MKLML OFF CACHE STRING
"Disable MKLML package when cross-compiling for Android"
FORCE
)
"Disable MKLML package when cross-compiling for Android
and iOS
"
FORCE
)
endif
(
ANDROID
)
set
(
THIRD_PARTY_PATH
"
${
CMAKE_BINARY_DIR
}
/third_party"
CACHE STRING
...
...
@@ -167,9 +152,6 @@ if(USE_NNPACK)
list
(
APPEND EXTERNAL_LIBS
${
NNPACK_LIBS
}
)
endif
(
USE_NNPACK
)
message
(
STATUS
"CMAKE_C_FLAGS:
${
CMAKE_C_FLAGS
}
"
)
message
(
STATUS
"CMAKE_CXX_FLAGS:
${
CMAKE_CXX_FLAGS
}
"
)
add_subdirectory
(
proto
)
if
(
NOT ANDROID AND NOT IOS
)
...
...
cmake/cross_compiling/ios.cmake
浏览文件 @
224f8b06
...
...
@@ -160,7 +160,7 @@ if(NOT DEFINED IOS_SDK_ROOT)
endif
(
IOS_SDK_LISTS
)
endif
()
if
(
EXISTS
${
IOS_SDK_ROOT
}
)
set
(
CMAKE_IOS_SDK_ROOT
${
CMAKE_
IOS_SDK_ROOT
}
CACHE PATH
"Location of the selected iOS SDK"
)
set
(
IOS_SDK_ROOT
${
IOS_SDK_ROOT
}
CACHE PATH
"Location of the selected iOS SDK"
)
message
(
STATUS
"iOS toolchain:
${
IOS_SDK_ROOT
}
"
)
else
()
message
(
FATAL_ERROR
"Invalid IOS_SDK_ROOT:
${
IOS_SDK_ROOT
}
does not exist."
)
...
...
@@ -292,6 +292,12 @@ message(STATUS "iOS: Targeting iOS '${CMAKE_SYSTEM_VERSION}', "
message
(
STATUS
"System CMAKE_C_FLAGS:
${
CMAKE_C_FLAGS
}
"
)
message
(
STATUS
"System CMAKE_CXX_FLAGS:
${
CMAKE_CXX_FLAGS
}
"
)
# Used in ExternalProject command
string
(
REPLACE
";"
"
\\
$<SEMICOLON>"
EXTERNAL_IOS_ARCHITECTURES
"
${
CMAKE_OSX_ARCHITECTURES
}
"
)
set
(
EXTERNAL_OPTIONAL_ARGS
-DCMAKE_OSX_SYSROOT=
${
CMAKE_OSX_SYSROOT
}
-DCMAKE_OSX_ARCHITECTURES=
${
EXTERNAL_IOS_ARCHITECTURES
}
)
# This little macro lets you set any XCode specific property
macro
(
set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE
)
set_property
(
TARGET
${
TARGET
}
PROPERTY XCODE_ATTRIBUTE_
${
XCODE_PROPERTY
}
${
XCODE_VALUE
}
)
...
...
cmake/external/openblas.cmake
浏览文件 @
224f8b06
...
...
@@ -25,23 +25,32 @@ IF(NOT ${CBLAS_FOUND})
"
${
CBLAS_INSTALL_DIR
}
/lib/
${
CMAKE_STATIC_LIBRARY_PREFIX
}
openblas
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
"
CACHE FILEPATH
"openblas library."
FORCE
)
SET
(
COMMON_ARGS CC=
${
CMAKE_C_COMPILER
}
NO_SHARED=1 NO_LAPACK=1 libs
)
SET
(
OPENBLAS_CC
"
${
CMAKE_C_COMPILER
}
"
)
IF
(
CMAKE_CROSSCOMPILING
)
SET
(
OPTIONAL_ARGS HOSTCC=
${
HOST_C_COMPILER
}
)
IF
(
ANDROID
)
# arm_soft_fp_abi branch of OpenBLAS to support softfp
# https://github.com/xianyi/OpenBLAS/tree/arm_soft_fp_abi
SET
(
OPENBLAS_COMMIT
"b5c96fcfcdc82945502a2303116a64d89985daf5"
)
IF
(
ANDROID_ABI MATCHES
"^armeabi(-v7a)?$"
)
SET
(
TARGET
"ARMV7"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV7 ARM_SOFTFP_ABI=1 USE_THREAD=0
)
ELSEIF
(
ANDROID_ABI STREQUAL
"arm64-v8a"
)
SET
(
TARGET
"ARMV8"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV8 BINARY=64 USE_THREAD=0
)
ENDIF
()
ELSEIF
(
IOS
)
# FIXME: support multiple architectures
SET
(
OPENBLAS_COMMIT
"b5c96fcfcdc82945502a2303116a64d89985daf5"
)
IF
(
CMAKE_OSX_ARCHITECTURES MATCHES
"armv7"
)
SET
(
OPENBLAS_CC
"
${
OPENBLAS_CC
}
-isysroot
${
CMAKE_OSX_SYSROOT
}
-arch armv7"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV7 ARM_SOFTFP_ABI=1 USE_THREAD=0
)
ELSEIF
(
CMAKE_OSX_ARCHITECTURES MATCHES
"arm64"
)
SET
(
OPENBLAS_CC
"
${
OPENBLAS_CC
}
-isysroot
${
CMAKE_OSX_SYSROOT
}
-arch arm64"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV8 BINARY=64 USE_THREAD=0
)
ENDIF
()
SET
(
OPTIONAL_ARGS HOSTCC=
${
HOST_C_COMPILER
}
TARGET=
${
TARGET
}
ARM_SOFTFP_ABI=1 USE_THREAD=0
)
ELSEIF
(
RPI
)
# use hardfp
SET
(
OPENBLAS_COMMIT
"v0.2.19"
)
SET
(
OPTIONAL_ARGS
HOSTCC=
${
HOST_C_COMPILER
}
TARGET=ARMV7 USE_THREAD=0
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV7 USE_THREAD=0
)
ENDIF
()
ELSE
()
SET
(
OPENBLAS_COMMIT
"v0.2.19"
)
...
...
@@ -51,6 +60,8 @@ IF(NOT ${CBLAS_FOUND})
ENDIF
()
ENDIF
()
SET
(
COMMON_ARGS CC=
${
OPENBLAS_CC
}
NO_SHARED=1 NO_LAPACK=1 libs
)
ExternalProject_Add
(
extern_openblas
${
EXTERNAL_PROJECT_LOG_ARGS
}
...
...
cmake/external/zlib.cmake
浏览文件 @
224f8b06
...
...
@@ -27,6 +27,7 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
ExternalProject_Add
(
zlib
${
EXTERNAL_PROJECT_LOG_ARGS
}
...
...
@@ -34,15 +35,16 @@ ExternalProject_Add(
GIT_TAG
"v1.2.8"
PREFIX
${
ZLIB_SOURCES_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
CMAKE_ARGS -DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
CMAKE_ARGS -DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
CMAKE_ARGS -DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
ZLIB_INSTALL_DIR
}
CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
CMAKE_ARGS -DCMAKE_MACOSX_RPATH=ON
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-DCMAKE_INSTALL_PREFIX=
${
ZLIB_INSTALL_DIR
}
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_MACOSX_RPATH=ON
-DCMAKE_BUILD_TYPE=Release
${
EXTERNAL_OPTIONAL_ARGS
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
ZLIB_INSTALL_DIR
}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=Release
...
...
ios_run.sh
已删除
100644 → 0
浏览文件 @
d2435ba8
#!/bin/bash
set
-xe
mkdir
-p
./ios_build
cd
./ios_build
cmake
-DCMAKE_SYSTEM_NAME
=
Darwin
\
-DWITH_C_API
=
ON
\
-DWITH_TESTING
=
OFF
\
-DWITH_SWIG_PY
=
OFF
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_INSTALL_PREFIX
=
/Users/xingzhaolong/cross_compile/ios
\
..
# -DIOS_PLATFORM=SIMULATOR \
#-DCMAKE_Go_COMPILER=/usr/local/bin \
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录