Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
ec0ea4c5
P
Paddle
项目概览
机器未来
/
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看板
未验证
提交
ec0ea4c5
编写于
7月 14, 2021
作者:
T
tianshuo78520a
提交者:
GitHub
7月 14, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support Mac M1 build (#34071)
* Support Mac M1 make * cmake version check
上级
171ed2cf
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
28 addition
and
5 deletion
+28
-5
CMakeLists.txt
CMakeLists.txt
+15
-3
cmake/external/cryptopp.cmake
cmake/external/cryptopp.cmake
+4
-0
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+4
-0
cmake/flags.cmake
cmake/flags.cmake
+5
-2
未找到文件。
CMakeLists.txt
浏览文件 @
ec0ea4c5
...
@@ -12,8 +12,14 @@
...
@@ -12,8 +12,14 @@
# 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
cmake_minimum_required
(
VERSION 3.10
)
if
(
APPLE AND WITH_ARM
)
cmake_policy
(
VERSION 3.10
)
# cmake 3.19.2 version starts to support M1
cmake_minimum_required
(
VERSION 3.19.2
)
cmake_policy
(
VERSION 3.19.2
)
else
(
APPLE AND WITH_ARM
)
cmake_minimum_required
(
VERSION 3.10
)
cmake_policy
(
VERSION 3.10
)
endif
(
APPLE AND WITH_ARM
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
set
(
PADDLE_SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
PADDLE_SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
PADDLE_BINARY_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
)
set
(
PADDLE_BINARY_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
)
...
@@ -73,6 +79,11 @@ if(WITH_MUSL)
...
@@ -73,6 +79,11 @@ if(WITH_MUSL)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-error=deprecated-declarations -Wno-deprecated-declarations -Wno-error=pessimizing-move -Wno-error=deprecated-copy"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-error=deprecated-declarations -Wno-deprecated-declarations -Wno-error=pessimizing-move -Wno-error=deprecated-copy"
)
endif
()
endif
()
if
(
APPLE AND WITH_ARM
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-target arm64-apple-darwin"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_C_FLAGS
}
-target arm64-apple-darwin"
)
endif
()
if
(
WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11
)
if
(
WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
)
endif
()
endif
()
...
@@ -332,8 +343,9 @@ endif()
...
@@ -332,8 +343,9 @@ endif()
if
(
WITH_ARM
)
if
(
WITH_ARM
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-fPIC"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-fPIC"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fPIC"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fPIC"
)
set
(
WITH_XBYAK OFF CACHE STRING
"Disable XBYAK when compiling WITH_ARM=ON"
FORCE
)
set
(
WITH_XBYAK OFF CACHE STRING
"Disable XBYAK when compiling WITH_ARM=ON
.
"
FORCE
)
set
(
WITH_MKL OFF CACHE STRING
"Disable MKL when compiling WITH_ARM=ON."
FORCE
)
set
(
WITH_MKL OFF CACHE STRING
"Disable MKL when compiling WITH_ARM=ON."
FORCE
)
set
(
WITH_AVX OFF CACHE STRING
"Disable AVX when compiling WITH_AVX=OFF."
FORCE
)
add_definitions
(
-DPADDLE_WITH_ARM
)
add_definitions
(
-DPADDLE_WITH_ARM
)
endif
()
endif
()
...
...
cmake/external/cryptopp.cmake
浏览文件 @
ec0ea4c5
...
@@ -33,6 +33,10 @@ ELSE(WIN32)
...
@@ -33,6 +33,10 @@ ELSE(WIN32)
SET
(
CRYPTOPP_LIBRARIES
"
${
CRYPTOPP_INSTALL_DIR
}
/lib/libcryptopp.a"
CACHE FILEPATH
"cryptopp library."
FORCE
)
SET
(
CRYPTOPP_LIBRARIES
"
${
CRYPTOPP_INSTALL_DIR
}
/lib/libcryptopp.a"
CACHE FILEPATH
"cryptopp library."
FORCE
)
ENDIF
(
WIN32
)
ENDIF
(
WIN32
)
IF
(
APPLE AND WITH_ARM
)
SET
(
CMAKE_CXX_FLAGS
"-DCRYPTOPP_ARM_CRC32_AVAILABLE=0"
)
ENDIF
()
set
(
CRYPTOPP_CMAKE_ARGS
${
COMMON_CMAKE_ARGS
}
set
(
CRYPTOPP_CMAKE_ARGS
${
COMMON_CMAKE_ARGS
}
-DBUILD_SHARED=ON
-DBUILD_SHARED=ON
-DBUILD_STATIC=ON
-DBUILD_STATIC=ON
...
...
cmake/external/openblas.cmake
浏览文件 @
ec0ea4c5
...
@@ -19,6 +19,10 @@ SET(CBLAS_SOURCE_DIR ${THIRD_PARTY_PATH}/openblas/src/extern_openblas)
...
@@ -19,6 +19,10 @@ SET(CBLAS_SOURCE_DIR ${THIRD_PARTY_PATH}/openblas/src/extern_openblas)
SET
(
CBLAS_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/openblas
)
SET
(
CBLAS_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/openblas
)
SET
(
CBLAS_REPOSITORY
${
GIT_URL
}
/xianyi/OpenBLAS.git
)
SET
(
CBLAS_REPOSITORY
${
GIT_URL
}
/xianyi/OpenBLAS.git
)
SET
(
CBLAS_TAG v0.3.7
)
SET
(
CBLAS_TAG v0.3.7
)
if
(
APPLE AND WITH_ARM
)
SET
(
CBLAS_TAG v0.3.13
)
endif
()
if
(
WITH_MIPS
)
if
(
WITH_MIPS
)
SET
(
CBLAS_TAG v0.3.13
)
SET
(
CBLAS_TAG v0.3.13
)
endif
()
endif
()
...
...
cmake/flags.cmake
浏览文件 @
ec0ea4c5
...
@@ -186,8 +186,11 @@ endif()
...
@@ -186,8 +186,11 @@ endif()
endif
(
NOT WIN32
)
endif
(
NOT WIN32
)
if
(
APPLE
)
if
(
APPLE
)
# On Mac OS X build fat binaries with x86_64 architectures by default.
if
(
WITH_ARM
)
set
(
CMAKE_OSX_ARCHITECTURES
"arm64"
CACHE STRING
"Build architectures for OSX"
FORCE
)
else
(
WITH_ARM
)
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
(
WITH_ARM
)
# On Mac OS X register class specifier is deprecated and will cause warning error on latest clang 10.0
# On Mac OS X register class specifier is deprecated and will cause warning error on latest clang 10.0
set
(
COMMON_FLAGS -Wno-deprecated-register
)
set
(
COMMON_FLAGS -Wno-deprecated-register
)
endif
(
APPLE
)
endif
(
APPLE
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录