未验证 提交 1d79f1f7 编写于 作者: A Allen Guo 提交者: GitHub

support build with Ninja on Linux (#44210)

* support ninja

* fix mkldnn on windows

* fix mkldnn on windows up1

* up2

* up3

* fix gflags

* BUILD_BYPRODUCTS_OPTION -> BUILD_BYPRODUCTS_ARGS

* use CMAKE_COMMAND

* up x
上级 24187fcb
......@@ -33,7 +33,7 @@ ExternalProject_Add(
URL_MD5 "94e6fa1bc97169d0e1aad44570fe3251"
PREFIX "${DGC_PREFIX_DIR}"
CONFIGURE_COMMAND ""
BUILD_COMMAND make -j $(nproc)
BUILD_COMMAND make -j${NPROC}
INSTALL_COMMAND
mkdir -p ${DGC_INSTALL_DIR}/lib/ ${DGC_INCLUDE_DIR}/dgc && cp
${DGC_SOURCES_DIR}/build/lib/libdgc.a ${DGC_LIBRARIES} && cp
......
......@@ -29,8 +29,8 @@ else()
set(GFLAGS_LIBRARIES
"${GFLAGS_INSTALL_DIR}/lib/libgflags.a"
CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
set(BUILD_COMMAND $(MAKE) --silent)
set(INSTALL_COMMAND $(MAKE) install)
set(BUILD_COMMAND ${CMAKE_COMMAND} --build .)
set(INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install)
endif()
include_directories(${GFLAGS_INCLUDE_DIR})
......
......@@ -61,6 +61,12 @@ else()
CACHE FILEPATH "mkldnn library." FORCE)
endif()
if(LINUX)
set(BUILD_BYPRODUCTS_ARGS ${MKLDNN_LIB})
else()
set(BUILD_BYPRODUCTS_ARGS "")
endif()
ExternalProject_Add(
${MKLDNN_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
......@@ -83,7 +89,8 @@ ExternalProject_Add(
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DDNNL_BUILD_TESTS=OFF
-DDNNL_BUILD_EXAMPLES=OFF
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${MKLDNN_INSTALL_DIR})
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${MKLDNN_INSTALL_DIR}
BUILD_BYPRODUCTS ${BUILD_BYPRODUCTS_ARGS})
message(STATUS "MKLDNN library: ${MKLDNN_LIB}")
add_definitions(-DPADDLE_WITH_MKLDNN)
......
......@@ -53,7 +53,7 @@ if(NOT WIN32)
PREFIX ${CBLAS_PREFIX_DIR}
INSTALL_DIR ${CBLAS_INSTALL_DIR}
BUILD_IN_SOURCE 1
BUILD_COMMAND make -j$(nproc) ${COMMON_ARGS} ${OPTIONAL_ARGS}
BUILD_COMMAND make -j${NPROC} ${COMMON_ARGS} ${OPTIONAL_ARGS}
INSTALL_COMMAND make install NO_SHARED=1 NO_LAPACK=1 PREFIX=<INSTALL_DIR>
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
......
......@@ -44,7 +44,8 @@ ExternalProject_Add(
${ROCKSDB_PREFIX_DIR}/src/extern_rocksdb/librocksdb.a ${ROCKSDB_LIBRARIES}
&& cp -r ${ROCKSDB_PREFIX_DIR}/src/extern_rocksdb/include
${ROCKSDB_INSTALL_DIR}/
BUILD_IN_SOURCE 1)
BUILD_IN_SOURCE 1
BYPRODUCTS ${ROCKSDB_LIBRARIES})
add_dependencies(extern_rocksdb snappy)
......
......@@ -27,6 +27,9 @@ set(THIRD_PARTY_CACHE_PATH
set(THIRD_PARTY_BUILD_TYPE Release)
set(third_party_deps)
include(ProcessorCount)
ProcessorCount(NPROC)
# cache funciton to avoid repeat download code of third_party.
# This function has 4 parameters, URL / REPOSITOR / TAG / DIR:
# 1. URL: specify download url of 3rd party
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册