Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
473161f9
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
473161f9
编写于
8月 30, 2017
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'ios_cross_compile' into build_ios
上级
0d9846f3
224f8b06
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
430 addition
and
79 deletion
+430
-79
CMakeLists.txt
CMakeLists.txt
+14
-12
cmake/cross_compiling/ios.cmake
cmake/cross_compiling/ios.cmake
+319
-0
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+17
-6
cmake/external/python.cmake
cmake/external/python.cmake
+10
-13
cmake/external/swig.cmake
cmake/external/swig.cmake
+4
-0
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+10
-8
cmake/flags.cmake
cmake/flags.cmake
+4
-2
cmake/system.cmake
cmake/system.cmake
+9
-5
paddle/CMakeLists.txt
paddle/CMakeLists.txt
+6
-2
paddle/capi/CMakeLists.txt
paddle/capi/CMakeLists.txt
+27
-29
paddle/utils/Excepts.h
paddle/utils/Excepts.h
+2
-1
paddle/utils/arch/linux/Locks.cpp
paddle/utils/arch/linux/Locks.cpp
+6
-0
paddle/utils/arch/osx/Excepts.cpp
paddle/utils/arch/osx/Excepts.cpp
+2
-1
未找到文件。
CMakeLists.txt
浏览文件 @
473161f9
...
@@ -27,7 +27,7 @@ if(NOT CMAKE_CROSSCOMPILING)
...
@@ -27,7 +27,7 @@ if(NOT CMAKE_CROSSCOMPILING)
endif
(
NOT CMAKE_CROSSCOMPILING
)
endif
(
NOT CMAKE_CROSSCOMPILING
)
find_package
(
Git REQUIRED
)
find_package
(
Git REQUIRED
)
find_package
(
Threads REQUIRED
)
find_package
(
Threads REQUIRED
)
if
(
NOT ANDROID
)
if
(
NOT ANDROID
AND NOT IOS
)
find_package
(
Boost QUIET
)
find_package
(
Boost QUIET
)
endif
()
endif
()
...
@@ -63,23 +63,23 @@ if(NOT CMAKE_BUILD_TYPE)
...
@@ -63,23 +63,23 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE
)
FORCE
)
endif
()
endif
()
if
(
ANDROID
)
if
(
ANDROID
OR IOS
)
if
(
${
CMAKE_SYSTEM_VERSION
}
VERSION_LESS
"21"
)
if
(
ANDROID AND
${
CMAKE_SYSTEM_VERSION
}
VERSION_LESS
"21"
)
message
(
FATAL_ERROR
"Unsupport standalone toolchains with Android API level lower than 21"
)
message
(
FATAL_ERROR
"Unsupport standalone toolchains with Android API level lower than 21"
)
endif
()
endif
()
set
(
WITH_GPU OFF CACHE STRING
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
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
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
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
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
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
)
endif
(
ANDROID
)
set
(
THIRD_PARTY_PATH
"
${
CMAKE_BINARY_DIR
}
/third_party"
CACHE STRING
set
(
THIRD_PARTY_PATH
"
${
CMAKE_BINARY_DIR
}
/third_party"
CACHE STRING
...
@@ -154,9 +154,11 @@ endif(USE_NNPACK)
...
@@ -154,9 +154,11 @@ endif(USE_NNPACK)
add_subdirectory
(
proto
)
add_subdirectory
(
proto
)
# "add_subdirectory(go)" should be placed after the following loine,
if
(
NOT ANDROID AND NOT IOS
)
# because it depends on paddle/optimizer.
# "add_subdirectory(go)" should be placed after the following loine,
add_subdirectory
(
paddle/optimizer
)
# because it depends on paddle/optimizer.
add_subdirectory
(
paddle/optimizer
)
endif
()
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
# placed after this block, because they depends on it.
# placed after this block, because they depends on it.
...
...
cmake/cross_compiling/ios.cmake
0 → 100644
浏览文件 @
473161f9
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed 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.
# This is a toolchain file for cross-compiling for iOS, and the
# configuration largely refers to public toolchain file:
# https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake
# and
# https://github.com/cristeab/ios-cmake
#
# Supports options:
# IOS_PLATFORM = OS (default) or SIMULATOR
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
# IOS_ARCH
# The archectures wanted to support, such "arm64", "armv7;arm64"
# IOS_DEPLOYMENT_TARGET
# The minimum iOS deployment version, such as "7.0"
# IOS_ENABLE_BITCODE = ON (default) or OFF
# IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
# If set manually, it will override the default location and force the user of a particular Developer Platform
# IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
# By default this location is automatcially chosen based on the IOS_DEVELOPER_ROOT value.
# In this case it will always be the most up-to-date SDK found in the IOS_DEVELOPER_ROOT path.
# If set manually, this will force the use of a specific SDK version
# Macros:
# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE)
# A convenience macro for setting xcode specific properties on targets
# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1")
# find_host_package (PROGRAM ARGS)
# A macro used to find executable programs on the host system, not within the iOS environment.
# Thanks to the android-cmake project for providing the command
if
(
NOT IOS
)
return
()
endif
()
set
(
CMAKE_SYSTEM_NAME Darwin
)
#set(UNIX ON)
#set(APPLE ON)
# Get the Xcode version being used.
execute_process
(
COMMAND xcodebuild -version
OUTPUT_VARIABLE XCODE_VERSION
RESULT_VARIABLE XCODE_VERSION_RESULT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
NOT
${
XCODE_VERSION_RESULT
}
)
string
(
REGEX MATCH
"Xcode [0-9
\\
.]+"
XCODE_VERSION
"
${
XCODE_VERSION
}
"
)
string
(
REGEX REPLACE
"Xcode ([0-9
\\
.]+)"
"
\\
1"
XCODE_VERSION
"
${
XCODE_VERSION
}
"
)
message
(
STATUS
"Building with Xcode version:
${
XCODE_VERSION
}
"
)
else
()
message
(
FATAL_ERROR
"Cannot execute xcodebuild, please check whether xcode is installed."
)
endif
()
# Required as of cmake 2.8.10
set
(
CMAKE_OSX_DEPLOYMENT_TARGET
""
CACHE STRING
"Force unset of the deployment target for iOS"
FORCE
)
set
(
CMAKE_AR ar CACHE FILEPATH
""
FORCE
)
set
(
CMAKE_RANLIB ranlib CACHE FILEPATH
""
FORCE
)
set
(
PKG_CONFIG_EXECUTABLE pkg-config CACHE FILEPATH
""
FORCE
)
# Setup iOS platform unless specified manually with IOS_PLATFORM
if
(
NOT DEFINED IOS_PLATFORM
)
set
(
IOS_PLATFORM
"OS"
)
endif
()
set
(
IOS_PLATFORM
${
IOS_PLATFORM
}
CACHE STRING
"Type of iOS Platform"
)
# Set the architecture for iOS
if
(
NOT DEFINED IOS_ARCH
)
if
(
IOS_PLATFORM STREQUAL
"OS"
)
set
(
IOS_ARCH
"armv7;armv7s;arm64"
)
elseif
(
IOS_PLATFORM STREQUAL
"SIMULATOR"
)
set
(
IOS_ARCH
"i386;x86_64"
)
elseif
(
IOS_PLATFORM STREQUAL
"WATCHOS"
)
set
(
IOS_ARCH armv7k
)
endif
()
endif
()
set
(
CMAKE_OSX_ARCHITECTURES
${
IOS_ARCH
}
CACHE string
"Build architecture for iOS"
)
# Specify minimum iOS deployment version
if
(
NOT DEFINED IOS_DEPLOYMENT_TARGET
)
set
(
IOS_DEPLOYMENT_TARGET
"7.0"
)
endif
()
set
(
IOS_DEPLOYMENT_TARGET
${
IOS_DEPLOYMENT_TARGET
}
CACHE STRING
"Minimum iOS version"
)
# Whether to enable bitcode
if
(
NOT DEFINED IOS_ENABLE_BITCODE
)
set
(
IOS_ENABLE_BITCODE ON
)
endif
()
set
(
IOS_ENABLE_BITCODE
${
IOS_ENABLE_BITCODE
}
CACHE BOOL
"Whether to enable bitcode"
)
# Check the platform selection and setup for developer root
if
(
${
IOS_PLATFORM
}
STREQUAL
"OS"
)
set
(
IOS_PLATFORM_LOCATION
"iPhoneOS.platform"
)
set
(
XCODE_IOS_PLATFORM iphoneos
)
# This causes the installers to properly locate the output libraries
set
(
CMAKE_XCODE_EFFECTIVE_PLATFORMS
"-iphoneos"
)
elseif
(
${
IOS_PLATFORM
}
STREQUAL
"SIMULATOR"
)
set
(
IOS_PLATFORM_LOCATION
"iPhoneSimulator.platform"
)
set
(
XCODE_IOS_PLATFORM iphonesimulator
)
# This causes the installers to properly locate the output libraries
set
(
CMAKE_XCODE_EFFECTIVE_PLATFORMS
"-iphonesimulator"
)
elseif
(
${
IOS_PLATFORM
}
STREQUAL
"WATCHOS"
)
set
(
IOS_PLATFORM_LOCATION
"WatchOS.platform"
)
set
(
XCODE_IOS_PLATFORM watchos
)
# This causes the installers to properly locate the output libraries
set
(
CMAKE_XCODE_EFFECTIVE_PLATFORMS
"-watchos"
)
else
(
${
IOS_PLATFORM
}
STREQUAL
"OS"
)
message
(
FATAL_ERROR
"Unsupported IOS_PLATFORM value selected. Please set to
\n
"
"
\t
OS, SIMULATOR, or WATCHOS."
)
endif
()
# Check iOS developer toolchain
if
(
NOT DEFINED IOS_DEVELOPER_ROOT
)
# Setup iOS developer location
execute_process
(
COMMAND xcode-select -print-path
OUTPUT_VARIABLE XCODE_DEVELOPER_DIR
RESULT_VARIABLE XCODE_DEVELOPER_DIR_RESULT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Xcode 4.3 changed the installation location, choose the most recent one available
if
(
${
XCODE_VERSION
}
VERSION_LESS
"4.3.0"
)
set
(
IOS_DEVELOPER_ROOT
"/Developer/Platforms/
${
IOS_PLATFORM_LOCATION
}
/Developer"
)
else
()
set
(
IOS_DEVELOPER_ROOT
"
${
XCODE_DEVELOPER_DIR
}
/Platforms/
${
IOS_PLATFORM_LOCATION
}
/Developer"
)
endif
()
endif
()
if
(
EXISTS
${
IOS_DEVELOPER_ROOT
}
)
set
(
IOS_DEVELOPER_ROOT
${
IOS_DEVELOPER_ROOT
}
CACHE PATH
"Location of iOS Platform"
)
else
()
message
(
FATAL_ERROR
"Invalid IOS_DEVELOPER_ROOT:
${
IOS_DEVELOPER_ROOT
}
does not exist."
)
endif
()
# Check iOS SDK
if
(
NOT DEFINED IOS_SDK_ROOT
)
# Find and use the most recent iOS sdk
file
(
GLOB IOS_SDK_LISTS
"
${
IOS_DEVELOPER_ROOT
}
/SDKs/*"
)
if
(
IOS_SDK_LISTS
)
list
(
SORT IOS_SDK_LISTS
)
list
(
REVERSE IOS_SDK_LISTS
)
list
(
GET IOS_SDK_LISTS 0 IOS_SDK_ROOT
)
else
(
IOS_SDK_LISTS
)
message
(
FATAL_ERROR
"No iOS SDK's found in default search path
${
IOS_DEVELOPER_ROOT
}
."
" Please manually set IOS_SDK_ROOT or install the iOS SDK."
)
endif
(
IOS_SDK_LISTS
)
endif
()
if
(
EXISTS
${
IOS_SDK_ROOT
}
)
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."
)
endif
()
# Set the sysroot default to the most recent SDK
set
(
CMAKE_OSX_SYSROOT
${
IOS_SDK_ROOT
}
CACHE PATH
"Sysroot used for iOS support"
)
# Get version of iOS SDK
execute_process
(
COMMAND xcodebuild -sdk
${
CMAKE_OSX_SYSROOT
}
-version SDKVersion
OUTPUT_VARIABLE IOS_SDK_VERSION
RESULT_VARIABLE IOS_SDK_VERSION_RESULT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
${
IOS_SDK_VERSION_RESULT
}
)
string
(
REGEX MATCH
"(([0-9]+)
\\
.)+([0-9]+)"
IOS_SDK_VERSION
"
${
IOS_SDK_ROOT
}
"
)
endif
()
if
(
NOT IOS_SDK_VERSION
)
message
(
WARNING
"Cannot get SDK's version."
)
set
(
IOS_SDK_VERSION 1
)
endif
()
set
(
CMAKE_SYSTEM_VERSION
${
IOS_SDK_VERSION
}
)
# Find the C & C++ compilers for the specified SDK.
if
(
NOT CMAKE_C_COMPILER
)
# Default to use clang
execute_process
(
COMMAND xcrun -sdk
${
CMAKE_OSX_SYSROOT
}
-find clang
OUTPUT_VARIABLE IOS_C_COMPILER
RESULT_VARIABLE IOS_C_COMPILER_RESULT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
${
IOS_C_COMPILER_RESULT
}
)
get_filename_component
(
IOS_C_COMPILER clang PROGRAM
)
endif
()
else
(
NOT CMAKE_C_COMPILER
)
# User can set it in cmake command
get_filename_component
(
IOS_C_COMPILER
${
CMAKE_C_COMPILER
}
PROGRAM
)
endif
(
NOT CMAKE_C_COMPILER
)
if
(
NOT EXISTS
${
IOS_C_COMPILER
}
)
message
(
FATAL_ERROR
"Cannot find C compiler:
${
IOS_C_COMPILER
}
"
)
endif
()
if
(
NOT CMAKE_CXX_COMPILER
)
# Default to use clang++
execute_process
(
COMMAND xcrun -sdk
${
CMAKE_OSX_SYSROOT
}
-find clang++
OUTPUT_VARIABLE IOS_CXX_COMPILER
RESULT_VARIABLE IOS_CXX_COMPILER_RESULT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
${
IOS_CXX_COMPILER_RESULT
}
)
get_filename_component
(
IOS_CXX_COMPILER clang++ PROGRAM
)
endif
()
else
(
NOT CMAKE_CXX_COMPILER
)
# User can set it in cmake command
get_filename_component
(
IOS_CXX_COMPILER
${
CMAKE_CXX_COMPILER
}
PROGRAM
)
endif
(
NOT CMAKE_CXX_COMPILER
)
if
(
NOT EXISTS
${
IOS_CXX_COMPILER
}
)
message
(
FATAL_ERROR
"Cannot find CXX compiler:
${
IOS_CXX_COMPILER
}
"
)
endif
()
set
(
CMAKE_C_COMPILER
${
IOS_C_COMPILER
}
CACHE PATH
"C compiler"
FORCE
)
set
(
CMAKE_CXX_COMPILER
${
IOS_CXX_COMPILER
}
CACHE PATH
"CXX compiler"
FORCE
)
set
(
CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG
"-compatibility_version "
)
set
(
CMAKE_C_OSX_CURRENT_VERSION_FLAG
"-current_version "
)
set
(
CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG
"
${
CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG
}
"
)
set
(
CMAKE_CXX_OSX_CURRENT_VERSION_FLAG
"
${
CMAKE_C_OSX_CURRENT_VERSION_FLAG
}
"
)
# Set iOS specific C/C++ flags
if
(
IOS_PLATFORM STREQUAL
"OS"
)
if
(
XCODE_VERSION VERSION_LESS
"7.0"
)
set
(
XCODE_IOS_PLATFORM_VERSION_FLAGS
"-mios-version-min=
${
IOS_DEPLOYMENT_TARGET
}
"
)
else
()
# Xcode 7.0+ uses flags we can build directly from XCODE_IOS_PLATFORM.
set
(
XCODE_IOS_PLATFORM_VERSION_FLAGS
"-m
${
XCODE_IOS_PLATFORM
}
-version-min=
${
IOS_DEPLOYMENT_TARGET
}
"
)
endif
()
else
()
set
(
XCODE_IOS_FLATFORM_VERSION_FLAGS
"-mios-simulator-version-min=
${
IOS_DEPLOYMENT_TARGET
}
"
)
endif
()
if
(
IOS_ENABLE_BITCODE
)
set
(
XCODE_IOS_BITCODE_FLAGS
"
${
IOS_COMPILER_FLAGS
}
-fembed-bitcode"
)
else
()
set
(
XCODE_IOS_BITCODE_FLAGS
""
)
endif
()
set
(
IOS_COMPILER_FLAGS
"
${
XCODE_IOS_PLATFORM_VERSION_FLAGS
}
${
XCODE_IOS_BITCODE_FLAGS
}
"
)
# Hidden visibilty is required for cxx on iOS
set
(
CMAKE_C_FLAGS
"
${
IOS_COMPILER_FLAGS
}
${
CMAKE_C_FLAGS
}
"
CACHE STRING
"C flags"
)
set
(
CMAKE_CXX_FLAGS
"
${
IOS_COMPILER_FLAGS
}
-fvisibility-inlines-hidden
${
CMAKE_CXX_FLAGS
}
"
CACHE STRING
"CXX flags"
)
set
(
CMAKE_C_LINK_FLAGS
"
${
XCODE_IOS_PLATFORM_VERSION_FLAGS
}
-Wl,-search_paths_first
${
CMAKE_C_LINK_FLAGS
}
"
)
set
(
CMAKE_CXX_LINK_FLAGS
"
${
XCODE_IOS_PLATFORM_VERSION_FLAGS
}
-Wl,-search_paths_first
${
CMAKE_CXX_LINK_FLAGS
}
"
)
set
(
CMAKE_PLATFORM_HAS_INSTALLNAME 1
)
set
(
CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS
"-dynamiclib -headerpad_max_install_names"
)
set
(
CMAKE_SHARED_MODULE_CREATE_C_FLAGS
"-bundle -headerpad_max_install_names"
)
set
(
CMAKE_SHARED_MODULE_LOADER_C_FLAG
"-Wl,-bundle_loader,"
)
set
(
CMAKE_SHARED_MODULE_LOADER_CXX_FLAG
"-Wl,-bundle_loader,"
)
set
(
CMAKE_FIND_LIBRARY_SUFFIXES
".dylib"
".so"
".a"
)
# 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
()
# Set the find root to the iOS developer roots and to user defined paths
set
(
CMAKE_FIND_ROOT_PATH
${
IOS_DEVELOPER_ROOT
}
${
IOS_SDK_ROOT
}
${
CMAKE_PREFIX_PATH
}
CACHE string
"iOS find search path root"
)
# default to searching for frameworks first
set
(
CMAKE_FIND_FRAMEWORK FIRST
)
# set up the default search directories for frameworks
set
(
CMAKE_SYSTEM_FRAMEWORK_PATH
${
IOS_SDK_ROOT
}
/System/Library/Frameworks
${
IOS_SDK_ROOT
}
/System/Library/PrivateFrameworks
${
IOS_SDK_ROOT
}
/Developer/Library/Frameworks
)
# only search the iOS sdks, not the remainder of the host filesystem
set
(
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY
)
message
(
STATUS
"iOS: Targeting iOS '
${
CMAKE_SYSTEM_VERSION
}
', "
"building for '
${
IOS_PLATFORM
}
' platform, with architecture '
${
CMAKE_OSX_ARCHITECTURES
}
'"
)
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
}
)
endmacro
(
set_xcode_property
)
# This macro lets you find executable programs on the host system
macro
(
find_host_package
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER
)
set
(
IOS FALSE
)
find_package
(
${
ARGN
}
)
set
(
IOS TRUE
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY
)
set
(
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY
)
endmacro
(
find_host_package
)
cmake/external/openblas.cmake
浏览文件 @
473161f9
...
@@ -25,23 +25,32 @@ IF(NOT ${CBLAS_FOUND})
...
@@ -25,23 +25,32 @@ IF(NOT ${CBLAS_FOUND})
"
${
CBLAS_INSTALL_DIR
}
/lib/
${
CMAKE_STATIC_LIBRARY_PREFIX
}
openblas
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
"
"
${
CBLAS_INSTALL_DIR
}
/lib/
${
CMAKE_STATIC_LIBRARY_PREFIX
}
openblas
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
"
CACHE FILEPATH
"openblas library."
FORCE
)
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
)
IF
(
CMAKE_CROSSCOMPILING
)
SET
(
OPTIONAL_ARGS HOSTCC=
${
HOST_C_COMPILER
}
)
IF
(
ANDROID
)
IF
(
ANDROID
)
# arm_soft_fp_abi branch of OpenBLAS to support softfp
# arm_soft_fp_abi branch of OpenBLAS to support softfp
# https://github.com/xianyi/OpenBLAS/tree/arm_soft_fp_abi
# https://github.com/xianyi/OpenBLAS/tree/arm_soft_fp_abi
SET
(
OPENBLAS_COMMIT
"b5c96fcfcdc82945502a2303116a64d89985daf5"
)
SET
(
OPENBLAS_COMMIT
"b5c96fcfcdc82945502a2303116a64d89985daf5"
)
IF
(
ANDROID_ABI MATCHES
"^armeabi(-v7a)?$"
)
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"
)
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
()
ENDIF
()
SET
(
OPTIONAL_ARGS HOSTCC=
${
HOST_C_COMPILER
}
TARGET=
${
TARGET
}
ARM_SOFTFP_ABI=1 USE_THREAD=0
)
ELSEIF
(
RPI
)
ELSEIF
(
RPI
)
# use hardfp
# use hardfp
SET
(
OPENBLAS_COMMIT
"v0.2.19"
)
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
()
ENDIF
()
ELSE
()
ELSE
()
SET
(
OPENBLAS_COMMIT
"v0.2.19"
)
SET
(
OPENBLAS_COMMIT
"v0.2.19"
)
...
@@ -51,6 +60,8 @@ IF(NOT ${CBLAS_FOUND})
...
@@ -51,6 +60,8 @@ IF(NOT ${CBLAS_FOUND})
ENDIF
()
ENDIF
()
ENDIF
()
ENDIF
()
SET
(
COMMON_ARGS CC=
${
OPENBLAS_CC
}
NO_SHARED=1 NO_LAPACK=1 libs
)
ExternalProject_Add
(
ExternalProject_Add
(
extern_openblas
extern_openblas
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
...
...
cmake/external/python.cmake
浏览文件 @
473161f9
...
@@ -12,16 +12,17 @@
...
@@ -12,16 +12,17 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
INCLUDE
(
ExternalProject
)
IF
(
NOT WITH_PYTHON
)
return
()
ENDIF
()
INCLUDE
(
python_module
)
INCLUDE
(
python_module
)
FIND_PACKAGE
(
PythonInterp 2.7
)
FIND_PACKAGE
(
PythonInterp 2.7
)
IF
(
WITH_PYTHON
)
FIND_PACKAGE
(
PythonLibs 2.7
)
FIND_PACKAGE
(
PythonLibs 2.7
)
# Fixme: Maybe find a static library. Get SHARED/STATIC by FIND_PACKAGE.
# Fixme: Maybe find a static library. Get SHARED/STATIC by FIND_PACKAGE.
ADD_LIBRARY
(
python SHARED IMPORTED GLOBAL
)
ADD_LIBRARY
(
python SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET python PROPERTY IMPORTED_LOCATION
${
PYTHON_LIBRARIES
}
)
SET_PROPERTY
(
TARGET python PROPERTY IMPORTED_LOCATION
${
PYTHON_LIBRARIES
}
)
ENDIF
(
WITH_PYTHON
)
SET
(
py_env
""
)
SET
(
py_env
""
)
IF
(
PYTHONINTERP_FOUND
)
IF
(
PYTHONINTERP_FOUND
)
...
@@ -36,9 +37,5 @@ IF(PYTHONINTERP_FOUND)
...
@@ -36,9 +37,5 @@ IF(PYTHONINTERP_FOUND)
ENDIF
()
ENDIF
()
ENDIF
(
PYTHONINTERP_FOUND
)
ENDIF
(
PYTHONINTERP_FOUND
)
IF
(
WITH_PYTHON
)
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
PYTHON_NUMPY_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
PYTHON_NUMPY_INCLUDE_DIR
}
)
ELSE
()
SET
(
PYTHON_LIBRARIES
""
)
ENDIF
()
cmake/external/swig.cmake
浏览文件 @
473161f9
...
@@ -12,6 +12,10 @@
...
@@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
IF
(
NOT WITH_SWIG_PY
)
return
()
ENDIF
()
FIND_PACKAGE
(
SWIG
)
FIND_PACKAGE
(
SWIG
)
IF
(
NOT SWIG_FOUND
)
IF
(
NOT SWIG_FOUND
)
...
...
cmake/external/zlib.cmake
浏览文件 @
473161f9
...
@@ -27,6 +27,7 @@ ENDIF(WIN32)
...
@@ -27,6 +27,7 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
ExternalProject_Add
(
ExternalProject_Add
(
zlib
zlib
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
...
@@ -34,15 +35,16 @@ ExternalProject_Add(
...
@@ -34,15 +35,16 @@ ExternalProject_Add(
GIT_TAG
"v1.2.8"
GIT_TAG
"v1.2.8"
PREFIX
${
ZLIB_SOURCES_DIR
}
PREFIX
${
ZLIB_SOURCES_DIR
}
UPDATE_COMMAND
""
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
CMAKE_ARGS -DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
CMAKE_ARGS -DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
CMAKE_ARGS -DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
CMAKE_ARGS -DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
ZLIB_INSTALL_DIR
}
-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
-DCMAKE_INSTALL_PREFIX=
${
ZLIB_INSTALL_DIR
}
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DBUILD_SHARED_LIBS=OFF
CMAKE_ARGS -DCMAKE_MACOSX_RPATH=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
-DCMAKE_MACOSX_RPATH=ON
-DCMAKE_BUILD_TYPE=Release
${
EXTERNAL_OPTIONAL_ARGS
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
ZLIB_INSTALL_DIR
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
ZLIB_INSTALL_DIR
}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_BUILD_TYPE:STRING=Release
...
...
cmake/flags.cmake
浏览文件 @
473161f9
...
@@ -128,8 +128,10 @@ set(GPU_COMMON_FLAGS
...
@@ -128,8 +128,10 @@ set(GPU_COMMON_FLAGS
)
)
if
(
APPLE
)
if
(
APPLE
)
if
(
NOT CMAKE_CROSSCOMPILING
)
# On Mac OS X build fat binaries with x86_64 architectures by default.
# On Mac OS X build fat binaries with x86_64 architectures by default.
set
(
CMAKE_OSX_ARCHITECTURES
"x86_64"
CACHE STRING
"Build architectures for OSX"
FORCE
)
set
(
CMAKE_OSX_ARCHITECTURES
"x86_64"
CACHE STRING
"Build architectures for OSX"
FORCE
)
endif
()
else
()
else
()
set
(
GPU_COMMON_FLAGS
set
(
GPU_COMMON_FLAGS
-Wall
-Wall
...
...
cmake/system.cmake
浏览文件 @
473161f9
...
@@ -24,11 +24,10 @@ IF(WIN32)
...
@@ -24,11 +24,10 @@ IF(WIN32)
SET
(
HOST_SYSTEM
"win32"
)
SET
(
HOST_SYSTEM
"win32"
)
ELSE
(
WIN32
)
ELSE
(
WIN32
)
IF
(
APPLE
)
IF
(
APPLE
)
EXEC_PROGRAM
(
sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION
)
STRING
(
REGEX MATCH
"[0-9]+.[0-9]+"
VERSION
"
${
MACOSX_VERSION
}
"
)
SET
(
MACOS_VERSION
${
VERSION
}
)
SET
(
HOST_SYSTEM
"macosx"
)
SET
(
HOST_SYSTEM
"macosx"
)
IF
(
NOT DEFINED ENV{MACOSX_DEPLOYMENT_TARGET}
)
EXEC_PROGRAM
(
sw_vers ARGS -productVersion OUTPUT_VARIABLE HOST_SYSTEM_VERSION
)
STRING
(
REGEX MATCH
"[0-9]+.[0-9]+"
MACOS_VERSION
"
${
HOST_SYSTEM_VERSION
}
"
)
IF
(
NOT DEFINED $ENV{MACOSX_DEPLOYMENT_TARGET}
)
# Set cache variable - end user may change this during ccmake or cmake-gui configure.
# Set cache variable - end user may change this during ccmake or cmake-gui configure.
SET
(
CMAKE_OSX_DEPLOYMENT_TARGET
${
MACOS_VERSION
}
CACHE STRING
SET
(
CMAKE_OSX_DEPLOYMENT_TARGET
${
MACOS_VERSION
}
CACHE STRING
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value."
)
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value."
)
...
@@ -49,6 +48,8 @@ ELSE(WIN32)
...
@@ -49,6 +48,8 @@ ELSE(WIN32)
ELSEIF
(
LINUX_ISSUE MATCHES
"Fedora"
)
ELSEIF
(
LINUX_ISSUE MATCHES
"Fedora"
)
SET
(
HOST_SYSTEM
"fedora"
)
SET
(
HOST_SYSTEM
"fedora"
)
ENDIF
()
ENDIF
()
STRING
(
REGEX MATCH
"(([0-9]+)
\\
.)+([0-9]+)"
HOST_SYSTEM_VERSION
"
${
LINUX_ISSUE
}
"
)
ENDIF
(
EXISTS
"/etc/issue"
)
ENDIF
(
EXISTS
"/etc/issue"
)
IF
(
EXISTS
"/etc/redhat-release"
)
IF
(
EXISTS
"/etc/redhat-release"
)
...
@@ -70,7 +71,7 @@ CMAKE_HOST_SYSTEM_INFORMATION(RESULT CPU_CORES QUERY NUMBER_OF_LOGICAL_CORES)
...
@@ -70,7 +71,7 @@ CMAKE_HOST_SYSTEM_INFORMATION(RESULT CPU_CORES QUERY NUMBER_OF_LOGICAL_CORES)
MARK_AS_ADVANCED
(
HOST_SYSTEM CPU_CORES
)
MARK_AS_ADVANCED
(
HOST_SYSTEM CPU_CORES
)
MESSAGE
(
STATUS
"Found Paddle host system:
${
HOST_SYSTEM
}
"
)
MESSAGE
(
STATUS
"Found Paddle host system:
${
HOST_SYSTEM
}
, version:
${
HOST_SYSTEM_VERSION
}
"
)
MESSAGE
(
STATUS
"Found Paddle host system's CPU:
${
CPU_CORES
}
cores"
)
MESSAGE
(
STATUS
"Found Paddle host system's CPU:
${
CPU_CORES
}
cores"
)
# configuration for cross-compiling
# configuration for cross-compiling
...
@@ -82,6 +83,9 @@ IF(DEFINED CMAKE_SYSTEM_NAME)
...
@@ -82,6 +83,9 @@ IF(DEFINED CMAKE_SYSTEM_NAME)
ELSEIF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"RPi"
)
ELSEIF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"RPi"
)
SET
(
RPI TRUE
)
SET
(
RPI TRUE
)
INCLUDE
(
cross_compiling/raspberry_pi
)
INCLUDE
(
cross_compiling/raspberry_pi
)
ELSEIF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"iOS"
)
SET
(
IOS TRUE
)
INCLUDE
(
cross_compiling/ios
)
ENDIF
()
ENDIF
()
ENDIF
()
ENDIF
()
...
...
paddle/CMakeLists.txt
浏览文件 @
473161f9
...
@@ -5,8 +5,12 @@ add_subdirectory(testing)
...
@@ -5,8 +5,12 @@ add_subdirectory(testing)
add_subdirectory
(
math
)
add_subdirectory
(
math
)
add_subdirectory
(
parameter
)
add_subdirectory
(
parameter
)
add_subdirectory
(
gserver
)
add_subdirectory
(
gserver
)
add_subdirectory
(
pserver
)
add_subdirectory
(
trainer
)
if
(
NOT ANDROID AND NOT IOS
)
add_subdirectory
(
pserver
)
add_subdirectory
(
trainer
)
endif
()
add_subdirectory
(
scripts
)
add_subdirectory
(
scripts
)
add_subdirectory
(
string
)
add_subdirectory
(
string
)
...
...
paddle/capi/CMakeLists.txt
浏览文件 @
473161f9
...
@@ -31,42 +31,40 @@ add_dependencies(paddle_capi paddle_proto)
...
@@ -31,42 +31,40 @@ add_dependencies(paddle_capi paddle_proto)
# combine all paddle static libraries together, into libpaddle_capi_whole.a
# combine all paddle static libraries together, into libpaddle_capi_whole.a
# user should use PaddleCAPI as -lpaddle_capi_whole
# user should use PaddleCAPI as -lpaddle_capi_whole
set
(
capi_whole_library libpaddle_capi_whole.a
)
set
(
PADDLE_INFER_LIBS
add_custom_target
(
paddle_capi_whole ALL
paddle_utils
COMMAND mkdir -p o_files/capi && cd o_files/capi/ && ar -x $<TARGET_FILE:paddle_capi>
paddle_parameter
COMMAND mkdir -p o_files/utils && cd o_files/utils/ && ar -x $<TARGET_FILE:paddle_utils>
paddle_math
COMMAND mkdir -p o_files/parameter && cd o_files/parameter/ && ar -x $<TARGET_FILE:paddle_parameter>
paddle_cuda
COMMAND mkdir -p o_files/math && cd o_files/math/ && ar -x $<TARGET_FILE:paddle_math>
paddle_function
COMMAND mkdir -p o_files/cuda && cd o_files/cuda/ && ar -x $<TARGET_FILE:paddle_cuda>
paddle_gserver
COMMAND mkdir -p o_files/function && cd o_files/function/ && ar -x $<TARGET_FILE:paddle_function>
paddle_proto
COMMAND mkdir -p o_files/gserver && cd o_files/gserver/ && ar -x $<TARGET_FILE:paddle_gserver>
COMMAND mkdir -p o_files/proto && cd o_files/proto/ && ar -x $<TARGET_FILE:paddle_proto>
COMMAND mkdir -p o_files/network && cd o_files/network/ && ar -x $<TARGET_FILE:paddle_network>
COMMAND mkdir -p o_files/pserver && cd o_files/pserver/ && ar -x $<TARGET_FILE:paddle_pserver>
COMMAND ar crs
${
capi_whole_library
}
`find ./o_files -name '*.o'`
COMMAND rm -rf o_files
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
DEPENDS paddle_capi paddle_utils paddle_parameter paddle_math
paddle_cuda paddle_function paddle_gserver
paddle_proto paddle_pserver paddle_network
)
)
set_target_properties
(
paddle_capi_whole
PROPERTIES IMPORTED_LOCATION
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
)
add_library
(
paddle_capi_shared SHARED
${
CAPI_SOURCES
}
)
set
(
PADDLE_TRAIN_LIBS paddle_pserver paddle_network
)
target_include_directories
(
paddle_capi_shared PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
)
link_paddle_exe
(
paddle_capi_shared
)
cc_library
(
paddle_capi_whole DEPS paddle_capi
${
PADDLE_INFER_LIBS
}
)
# No shared library for iOS
if
(
NOT IOS
)
add_library
(
paddle_capi_shared SHARED
${
CAPI_SOURCES
}
)
target_include_directories
(
paddle_capi_shared PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
)
link_paddle_exe
(
paddle_capi_shared
)
endif
()
# install library & headers.
# install library & headers.
install
(
FILES
${
CAPI_HEADERS
}
DESTINATION include/paddle
)
install
(
FILES
${
CAPI_HEADERS
}
DESTINATION include/paddle
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h DESTINATION include/paddle
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h DESTINATION include/paddle
)
if
(
ANDROID
)
if
(
ANDROID
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
install
(
TARGETS paddle_capi_whole paddle_capi_shared
DESTINATION lib/
${
ANDROID_ABI
}
)
ARCHIVE DESTINATION lib/
${
ANDROID_ABI
}
install
(
TARGETS paddle_capi_shared
DESTINATION lib/
${
ANDROID_ABI
}
)
LIBRARY
DESTINATION lib/
${
ANDROID_ABI
}
)
else
(
ANDROID
)
else
(
ANDROID
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
DESTINATION lib
)
install
(
TARGETS paddle_capi_whole
ARCHIVE DESTINATION lib
)
if
(
NOT IOS
)
install
(
TARGETS paddle_capi_shared DESTINATION lib
)
install
(
TARGETS paddle_capi_shared DESTINATION lib
)
endif
()
endif
(
ANDROID
)
endif
(
ANDROID
)
# this variable used for unittest
# this variable used for unittest
...
...
paddle/utils/Excepts.h
浏览文件 @
473161f9
...
@@ -17,7 +17,8 @@ limitations under the License. */
...
@@ -17,7 +17,8 @@ limitations under the License. */
#include <fenv.h>
#include <fenv.h>
#if defined(__APPLE__) || defined(__OSX__)
#if (defined(__APPLE__) || defined(__OSX__)) && !defined(__arm__) && \
!defined(__aarch64__)
int
fegetexcept
(
void
);
int
fegetexcept
(
void
);
int
feenableexcept
(
unsigned
int
excepts
);
int
feenableexcept
(
unsigned
int
excepts
);
...
...
paddle/utils/arch/linux/Locks.cpp
浏览文件 @
473161f9
...
@@ -40,6 +40,8 @@ void Semaphore::wait() { sem_wait(&m->sem); }
...
@@ -40,6 +40,8 @@ void Semaphore::wait() { sem_wait(&m->sem); }
void
Semaphore
::
post
()
{
sem_post
(
&
m
->
sem
);
}
void
Semaphore
::
post
()
{
sem_post
(
&
m
->
sem
);
}
/// SpinLockPrivate
#ifdef PADDLE_USE_PTHREAD_SPINLOCK
#ifdef PADDLE_USE_PTHREAD_SPINLOCK
class
SpinLockPrivate
{
class
SpinLockPrivate
{
...
@@ -79,6 +81,8 @@ SpinLock::~SpinLock() { delete m; }
...
@@ -79,6 +81,8 @@ SpinLock::~SpinLock() { delete m; }
void
SpinLock
::
lock
()
{
m
->
lock
();
}
void
SpinLock
::
lock
()
{
m
->
lock
();
}
void
SpinLock
::
unlock
()
{
m
->
unlock
();
}
void
SpinLock
::
unlock
()
{
m
->
unlock
();
}
/// ThreadBarrierPrivate
#ifdef PADDLE_USE_PTHREAD_BARRIER
#ifdef PADDLE_USE_PTHREAD_BARRIER
class
ThreadBarrierPrivate
{
class
ThreadBarrierPrivate
{
...
@@ -136,6 +140,8 @@ public:
...
@@ -136,6 +140,8 @@ public:
#endif
#endif
/// ThreadBarrier
ThreadBarrier
::
ThreadBarrier
(
int
count
)
:
m
(
new
ThreadBarrierPrivate
(
count
))
{}
ThreadBarrier
::
ThreadBarrier
(
int
count
)
:
m
(
new
ThreadBarrierPrivate
(
count
))
{}
ThreadBarrier
::~
ThreadBarrier
()
{
delete
m
;
}
ThreadBarrier
::~
ThreadBarrier
()
{
delete
m
;
}
void
ThreadBarrier
::
wait
()
{
m
->
wait
();
}
void
ThreadBarrier
::
wait
()
{
m
->
wait
();
}
...
...
paddle/utils/arch/osx/Excepts.cpp
浏览文件 @
473161f9
...
@@ -14,7 +14,8 @@ limitations under the License. */
...
@@ -14,7 +14,8 @@ limitations under the License. */
#include "paddle/utils/Excepts.h"
#include "paddle/utils/Excepts.h"
#if defined(__APPLE__) || defined(__OSX__)
#if (defined(__APPLE__) || defined(__OSX__)) && !defined(__arm__) && \
!defined(__aarch64__)
int
fegetexcept
(
void
)
{
int
fegetexcept
(
void
)
{
static
fenv_t
fenv
;
static
fenv_t
fenv
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录