Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clang as CUDA FE compiler in CI #6954

Merged
merged 62 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
a353ca7
update action use
jackalcooper Dec 6, 2021
df5cb03
refine
jackalcooper Dec 6, 2021
2c17780
refine
jackalcooper Dec 6, 2021
e052697
refine
jackalcooper Dec 6, 2021
3f45a80
refine
jackalcooper Dec 6, 2021
80dc22d
refine
jackalcooper Dec 6, 2021
45aef3b
refine
jackalcooper Dec 6, 2021
ca44659
refine
jackalcooper Dec 6, 2021
457791d
refine
jackalcooper Dec 6, 2021
bf91068
refine
jackalcooper Dec 6, 2021
f882242
refine
jackalcooper Dec 6, 2021
cda1cf2
refine
jackalcooper Dec 6, 2021
6fc565f
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Dec 6, 2021
0ebe97e
refine
jackalcooper Dec 6, 2021
dbd6b45
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Dec 6, 2021
7fc1f20
fix
jackalcooper Dec 6, 2021
9ed4ae6
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Dec 6, 2021
881ba47
add 80 and 86
jackalcooper Dec 6, 2021
a276647
refine
jackalcooper Dec 6, 2021
521fea9
refine
jackalcooper Dec 6, 2021
48e0a85
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Dec 6, 2021
835dd8b
add CUDA_NVCC_THREADS_NUMBER
jackalcooper Dec 7, 2021
283752f
refine
jackalcooper Dec 7, 2021
336a90b
address review
jackalcooper Dec 7, 2021
4a827f6
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Dec 7, 2021
32a9d72
set CUDA_NVCC_THREADS_NUMBER 8
jackalcooper Dec 7, 2021
e356cfe
fix
jackalcooper Dec 7, 2021
9d0f099
fix clang in init cmake
jackalcooper Dec 7, 2021
b46c2b5
add script
jackalcooper Dec 7, 2021
b2b8bfd
refine
jackalcooper Dec 7, 2021
4ce4a20
refine
jackalcooper Dec 7, 2021
916ca48
refine
jackalcooper Dec 7, 2021
1639957
refine
jackalcooper Dec 7, 2021
c54fc67
refine
jackalcooper Dec 7, 2021
479e878
refien
jackalcooper Dec 7, 2021
1d73ce2
refine
jackalcooper Dec 7, 2021
b50a455
add flags to skip zlib
jackalcooper Dec 8, 2021
59d1ba7
refine
jackalcooper Dec 8, 2021
34d4a27
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Dec 8, 2021
7df7416
refine
jackalcooper Dec 8, 2021
921c9ca
refine
jackalcooper Dec 8, 2021
863c6ce
refine
jackalcooper Dec 8, 2021
706c7c1
refine
jackalcooper Dec 8, 2021
247a611
refine
jackalcooper Dec 9, 2021
e090209
refine
jackalcooper Dec 9, 2021
e899797
refine
jackalcooper Dec 9, 2021
e49f730
refine
jackalcooper Dec 9, 2021
6ab3fd9
refine
jackalcooper Dec 9, 2021
7070ed2
Merge branch 'master' into add_clang_as_cuda_compiler_ci
jackalcooper Dec 9, 2021
4b15902
refine
jackalcooper Dec 9, 2021
fe61cb9
Merge branch 'add_clang_as_cuda_compiler_ci' of https://github.com/On…
jackalcooper Dec 9, 2021
5430043
refine
jackalcooper Dec 9, 2021
54038d7
refine
jackalcooper Dec 9, 2021
85ff7b8
refine
jackalcooper Dec 9, 2021
e8d04f8
refine
jackalcooper Dec 9, 2021
1547a6f
refine
jackalcooper Dec 9, 2021
d94021a
Merge branch 'master' into add_clang_as_cuda_compiler_ci
oneflow-ci-bot Dec 10, 2021
2c181af
fix clang error
jackalcooper Dec 10, 2021
d09a3b5
Merge branch 'master' into add_clang_as_cuda_compiler_ci
oneflow-ci-bot Dec 10, 2021
78194fb
Merge branch 'master' into add_clang_as_cuda_compiler_ci
oneflow-ci-bot Dec 10, 2021
8e1bf68
Merge branch 'master' into add_clang_as_cuda_compiler_ci
oneflow-ci-bot Dec 10, 2021
583913d
Merge branch 'master' into add_clang_as_cuda_compiler_ci
oneflow-ci-bot Dec 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- master
- add-canary-release
- add-support-clang-12
workflow_dispatch:
inputs:
oneflow-ref:
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Checkout Oneflow-Inc/oneflow
if: ${{ github.event.inputs.oneflow-ref == '' }}
uses: actions/checkout@v2
- uses: Oneflow-Inc/get-oneflow@canary-release
- uses: Oneflow-Inc/get-oneflow@support-clang-12
name: Build manylinux
id: build-cuda
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
repository: Oneflow-Inc/conda-env
ref: 30a7f00eb48ee9009d85a848e720823e5054c66b
path: conda-env
- uses: Oneflow-Inc/get-oneflow@canary-release
- uses: Oneflow-Inc/get-oneflow@support-clang-12
name: Build with gcc7
if: ${{ matrix.build-type == 'gcc7'}}
with:
Expand All @@ -256,7 +256,7 @@ jobs:
oneflow-build-env: conda
conda-env-file: conda-env/dev/gcc7/environment-v2.yml
conda-env-name: oneflow-dev-gcc7-v2
- uses: Oneflow-Inc/get-oneflow@canary-release
- uses: Oneflow-Inc/get-oneflow@support-clang-12
name: Build with clang10
if: ${{ matrix.build-type == 'clang10'}}
with:
Expand Down
62 changes: 34 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: Oneflow-Inc/get-oneflow/cache-complete/matrix/build@canary-release
- uses: Oneflow-Inc/get-oneflow/cache-complete/matrix/build@support-clang-12
name: find cache
id: find-cache
timeout-minutes: 5
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: Oneflow-Inc/get-oneflow/cache-complete@canary-release
- uses: Oneflow-Inc/get-oneflow/cache-complete@support-clang-12
name: Save cache if successful
id: save-cache
timeout-minutes: 5
Expand All @@ -242,7 +242,7 @@ jobs:
run: |
echo "::error file=test.yml,line=204,col=10::steps.save-cache.outputs.cache-hit != matrix.cache-hit"
exit 1
- uses: Oneflow-Inc/get-oneflow@canary-release
- uses: Oneflow-Inc/get-oneflow@support-clang-12
name: Build manylinux cpu only
id: build-cpu
if: ${{ matrix.entry =='cpu' && !matrix.cache-hit }}
Expand All @@ -263,7 +263,7 @@ jobs:
python-versions: |
3.6
3.7
- uses: Oneflow-Inc/get-oneflow@canary-release
- uses: Oneflow-Inc/get-oneflow@support-clang-12
name: Build manylinux cu102
id: build-cuda
if: ${{ matrix.entry =='cu102' && !matrix.cache-hit }}
Expand All @@ -284,7 +284,7 @@ jobs:
python-versions: |
3.6
3.7
- uses: Oneflow-Inc/get-oneflow@canary-release
- uses: Oneflow-Inc/get-oneflow@support-clang-12
name: Build manylinux cu101_xla
id: build-xla
if: ${{ matrix.entry =='cu101_xla' && !matrix.cache-hit && needs.changed_files.outputs.should_run_single_client_tests == '1' }}
Expand All @@ -306,7 +306,7 @@ jobs:
3.6
- name: Upload bin
if: ${{ !fromJson(matrix.cache-hit) && contains(matrix.runs-on, 'self-hosted') && (steps.build-cpu.outcome == 'success' || steps.build-cuda.outcome == 'success' || steps.build-xla.outcome == 'success') }}
uses: Oneflow-Inc/get-oneflow/digest/upload@canary-release
uses: Oneflow-Inc/get-oneflow/digest/upload@support-clang-12
timeout-minutes: 10
with:
digest: ${{ steps.save-cache.outputs.build-digest }}
Expand All @@ -317,7 +317,7 @@ jobs:
dst-dir: bin
- name: Upload whl
if: ${{ !fromJson(matrix.cache-hit) && contains(matrix.runs-on, 'self-hosted') && (steps.build-cpu.outcome == 'success' || steps.build-cuda.outcome == 'success' || steps.build-xla.outcome == 'success') }}
uses: Oneflow-Inc/get-oneflow/digest/upload@canary-release
uses: Oneflow-Inc/get-oneflow/digest/upload@support-clang-12
timeout-minutes: 10
with:
digest: ${{ steps.save-cache.outputs.build-digest }}
Expand All @@ -331,14 +331,19 @@ jobs:
name: Build with clang
if: github.event.pull_request.draft == false && github.base_ref == 'master' && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot')
runs-on: [self-hosted, linux, build]
env:
ONEFLOW_SRC: .
MANYLINUX_CACHE_DIR: ~/manylinux-cache-dir/clang13
CUDA_VERSION: "10.1"
WHEELHOUSE_DIR: ./wheelhouse
steps:
- name: Fix permissions
run: |
set -x
docker run --rm -v $PWD:$PWD -w $PWD busybox rm -rf *
- name: Checkout Oneflow-Inc/oneflow
uses: actions/checkout@v2
- uses: Oneflow-Inc/get-oneflow/cache-complete@canary-release
- uses: Oneflow-Inc/get-oneflow/cache-complete@support-clang-12
name: Save cache if successful
id: save-cache
timeout-minutes: 5
Expand All @@ -347,25 +352,26 @@ jobs:
entry: build-with-clang
digest-type: build
mark-as-completed: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
- name: Checkout Oneflow-Inc/conda-env
if: ${{ !fromJSON(steps.save-cache.outputs.cache-hit) }}
uses: actions/checkout@v2
with:
repository: Oneflow-Inc/conda-env
ref: 30a7f00eb48ee9009d85a848e720823e5054c66b
path: conda-env
- uses: Oneflow-Inc/get-oneflow@canary-release
- name: Build with Clang
uses: Oneflow-Inc/get-oneflow@support-clang-12
if: ${{ !fromJSON(steps.save-cache.outputs.cache-hit) }}
name: Build with clang10
with:
cmake-init-cache: cmake/caches/ci/gh-hosted/cpu-clang.cmake
oneflow-src: .
oneflow-build-env: conda
conda-env-file: conda-env/dev/clang10/environment-v2.yml
conda-env-name: oneflow-dev-clang10-v2
conda-installer-url: https://oneflow-static.oss-cn-beijing.aliyuncs.com/downloads/conda-installers/Miniconda3-py39_4.10.3-Linux-x86_64.sh
conda-prefix: ~/miniconda3-prefixes/py39_4.10.3
cmake-init-cache: ${{ env.ONEFLOW_SRC }}/cmake/caches/ci/llvm/cuda-75-clang.cmake
build-script: ${{ env.ONEFLOW_SRC }}/ci/clang/build-llvm.sh
oneflow-src: ${{ env.ONEFLOW_SRC }}
oneflow-build-env: llvm
wheelhouse-dir: ${{ env.WHEELHOUSE_DIR }}
clear-wheelhouse-dir: true
self-hosted: true
cuda-version: ${{ env.CUDA_VERSION }}
manylinux-cache-dir: ${{ env.MANYLINUX_CACHE_DIR }}
docker-run-use-system-http-proxy: false
docker-run-use-lld: false
retry-failed-build: true
clean-ccache: ${{ contains(github.event.pull_request.labels.*.name, 'need-clean-ccache') }}
wheel-audit: false
python-versions: |
3.8

find-test-cache:
name: "Find test cache"
Expand All @@ -382,7 +388,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: Oneflow-Inc/get-oneflow/cache-complete/matrix/test@canary-release
- uses: Oneflow-Inc/get-oneflow/cache-complete/matrix/test@support-clang-12
name: find cache
id: find-cache
timeout-minutes: 5
Expand Down Expand Up @@ -424,7 +430,7 @@ jobs:
if: ${{ contains(matrix.runs-on, 'self-hosted') }}
run: |
docker rm -f ${{ env.TEST_CONTAINER_NAME }} || true
- uses: Oneflow-Inc/get-oneflow/cache-complete@canary-release
- uses: Oneflow-Inc/get-oneflow/cache-complete@support-clang-12
name: Save cache if successful
id: save-cache
timeout-minutes: 5
Expand All @@ -440,7 +446,7 @@ jobs:
exit 1
- name: Download wheel and binary
if: ${{ !fromJson(matrix.cache-hit) && contains(matrix.runs-on, 'self-hosted') && (!fromJson(matrix.is-xla) || (fromJson(matrix.is-xla) && needs.changed_files.outputs.should_run_single_client_tests == '1')) }}
uses: Oneflow-Inc/get-oneflow/digest/download@canary-release
uses: Oneflow-Inc/get-oneflow/digest/download@support-clang-12
id: download-digest
timeout-minutes: 10
with:
Expand Down Expand Up @@ -744,7 +750,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
- uses: Oneflow-Inc/get-oneflow/cache-complete@canary-release
- uses: Oneflow-Inc/get-oneflow/cache-complete@support-clang-12
name: Save cache if successful
id: save-cache
timeout-minutes: 5
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ option(WITH_OPENVINO "Option to build with OpenVINO" OFF)
option(WITH_MLIR "" OFF)
option(WITH_MLIR_CUDA_CODEGEN "" OFF)
option(WITH_COCOAPI "Option to build with COCO API" ON)
option(WITH_ZLIB "" ON)
option(BUILD_GIT_VERSION "" ON)
option(BUILD_PROFILER "" OFF)
option(OF_SOFTMAX_USE_FAST_MATH "" ON)
Expand Down
28 changes: 28 additions & 0 deletions ci/clang/build-llvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set -ex
export PATH=/usr/lib/llvm-12/bin:/usr/lib/llvm-13/bin:/usr/lib64/ccache:/root/.local/bin:$PATH

# clean python dir
cd ${ONEFLOW_CI_SRC_DIR}
${ONEFLOW_CI_PYTHON_EXE} -m pip install -i https://mirrors.aliyun.com/pypi/simple --user -r ci/fixed-dev-requirements.txt
cd python
git clean -nXd -e \!dist -e \!dist/**
git clean -fXd -e \!dist -e \!dist/**

# cmake config
mkdir -p ${ONEFLOW_CI_BUILD_DIR}
cd ${ONEFLOW_CI_BUILD_DIR}
find ${ONEFLOW_CI_BUILD_DIR} -name CMakeCache.txt
find ${ONEFLOW_CI_BUILD_DIR} -name CMakeCache.txt -delete
if [ ! -f "$ONEFLOW_CI_CMAKE_INIT_CACHE" ]; then
echo "$ONEFLOW_CI_CMAKE_INIT_CACHE does not exist."
exit 1
fi
cmake -S ${ONEFLOW_CI_SRC_DIR} -C ${ONEFLOW_CI_CMAKE_INIT_CACHE} -DPython3_EXECUTABLE=${ONEFLOW_CI_PYTHON_EXE}
# cmake build
cd ${ONEFLOW_CI_BUILD_DIR}
cmake --build . -j $(nproc)

# build pip
cd ${ONEFLOW_CI_SRC_DIR}
cd python
${ONEFLOW_CI_PYTHON_EXE} setup.py bdist_wheel
22 changes: 22 additions & 0 deletions cmake/caches/ci/llvm/cuda-75-clang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set(CMAKE_C_COMPILER "clang" CACHE STRING "")
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "")
set(CMAKE_CUDA_COMPILER "clang++" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
set(BUILD_SHARED_LIBS YES CACHE BOOL "")
set(BUILD_CUDA YES CACHE BOOL "")
set(CMAKE_CUDA_ARCHITECTURES "75" CACHE STRING "")
set(BUILD_TESTING YES CACHE BOOL "")
set(THIRD_PARTY_MIRROR aliyun CACHE STRING "")
set(PIP_INDEX_MIRROR "https://pypi.tuna.tsinghua.edu.cn/simple" CACHE STRING "")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
set(CMAKE_GENERATOR Ninja CACHE STRING "")
set(CMAKE_C_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_CXX_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_CUDA_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "")
set(CUDAToolkit_ROOT /usr/local/cuda CACHE STRING "")
set(CUDNN_ROOT_DIR /usr/local/cudnn CACHE STRING "")
set(RPC_BACKEND "LOCAL" CACHE STRING "")
set(BUILD_HWLOC NO CACHE BOOL "")
3 changes: 2 additions & 1 deletion cmake/caches/cn/fast/cuda-61-clang.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(CMAKE_C_COMPILER "clang" CACHE STRING "")
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "")
set(CMAKE_CUDA_COMPILER "clang++" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
Expand All @@ -13,5 +14,5 @@ set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
set(CMAKE_GENERATOR Ninja CACHE STRING "")
set(CMAKE_C_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_CXX_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_CUDA_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "")

4 changes: 2 additions & 2 deletions cmake/caches/cn/fast/cuda-75-clang.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(CMAKE_C_COMPILER "clang" CACHE STRING "")
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "")
set(CMAKE_CUDA_COMPILER "clang++" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld" CACHE STRING "")
Expand All @@ -13,6 +14,5 @@ set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
set(CMAKE_GENERATOR Ninja CACHE STRING "")
set(CMAKE_C_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_CXX_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_CUDA_COMPILER_LAUNCHER ccache CACHE STRING "")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "")


14 changes: 10 additions & 4 deletions cmake/third_party.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ if (NOT WIN32)
find_package(Threads)
endif()

include(zlib)
if (WITH_ZLIB)
include(zlib)
endif()
include(protobuf)
include(googletest)
include(gflags)
Expand Down Expand Up @@ -140,7 +142,6 @@ set(oneflow_third_party_libs
${OPENCV_STATIC_LIBRARIES}
${COCOAPI_STATIC_LIBRARIES}
${LIBJPEG_STATIC_LIBRARIES}
zlib_imported
${ABSL_STATIC_LIBRARIES}
${OPENSSL_STATIC_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
Expand All @@ -155,14 +156,17 @@ if (NOT WITH_XLA)
list(APPEND oneflow_third_party_libs ${RE2_LIBRARIES})
endif()

if (WITH_ZLIB)
list(APPEND oneflow_third_party_libs zlib_imported)
endif()

if(WIN32)
# static gflags lib requires "PathMatchSpecA" defined in "ShLwApi.Lib"
list(APPEND oneflow_third_party_libs "ShLwApi.Lib")
list(APPEND oneflow_third_party_libs "Ws2_32.lib")
endif()

set(oneflow_third_party_dependencies
zlib
protobuf
gflags
glog
Expand All @@ -181,7 +185,9 @@ set(oneflow_third_party_dependencies
if (WITH_ONEDNN)
list(APPEND oneflow_third_party_dependencies onednn)
endif()

if (WITH_ZLIB)
list(APPEND oneflow_third_party_dependencies zlib)
endif()

if (WITH_COCOAPI)
list(APPEND oneflow_third_party_dependencies cocoapi_copy_headers_to_destination)
Expand Down
6 changes: 0 additions & 6 deletions cmake/third_party/absl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ if(THIRD_PARTY)
URL_MD5 20126998c9b17e5f7a93711972f03f79
UPDATE_COMMAND ""
BUILD_BYPRODUCTS ${ABSL_STATIC_LIBRARIES}
CMAKE_ARGS
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
CMAKE_CACHE_ARGS
-DCMAKE_C_COMPILER_LAUNCHER:STRING=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=${CMAKE_CXX_COMPILER_LAUNCHER}
Expand Down
6 changes: 5 additions & 1 deletion cmake/third_party/opencv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else()
endif()

ExternalProject_Add(opencv
DEPENDS zlib libjpeg_copy_headers_to_destination libjpeg_copy_libs_to_destination
DEPENDS libjpeg_copy_headers_to_destination libjpeg_copy_libs_to_destination
PREFIX opencv
URL ${OPENCV_URL}
URL_MD5 59870e55385f5202c1aa178fe37ed2de
Expand Down Expand Up @@ -143,6 +143,10 @@ ExternalProject_Add(opencv
# -DLIB_SUFFIX:STRING=64
)

if (WITH_ZLIB)
add_dependencies(opencv zlib)
endif()

# put opencv includes in the 'THIRD_PARTY_DIR'
add_copy_headers_target(NAME opencv SRC ${OPENCV_BUILD_INCLUDE_DIR} DST ${OPENCV_INCLUDE_DIR} DEPS opencv INDEX_FILE "${oneflow_cmake_dir}/third_party/header_index/opencv_headers.txt")

Expand Down
5 changes: 4 additions & 1 deletion cmake/third_party/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ if (THIRD_PARTY)

ExternalProject_Add(protobuf
PREFIX protobuf
DEPENDS zlib
URL ${PROTOBUF_URL}
URL_MD5 ${PROTOBUF_MD5}
UPDATE_COMMAND ""
Expand All @@ -61,6 +60,7 @@ ExternalProject_Add(protobuf
-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DZLIB_ROOT:PATH=${ZLIB_INSTALL}
-Dprotobuf_WITH_ZLIB:BOOL=${WITH_ZLIB}
-DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
-DBUILD_SHARED_LIBS:BOOL=${PROTOBUF_BUILD_SHARED_LIBS}
-Dprotobuf_BUILD_SHARED_LIBS:BOOL=${PROTOBUF_BUILD_SHARED_LIBS}
Expand All @@ -72,6 +72,9 @@ ExternalProject_Add(protobuf
-Dprotobuf_DEBUG_POSTFIX:STRING=
${PROTOBUF_ADDITIONAL_CMAKE_OPTIONS}
)
if (WITH_ZLIB)
add_dependencies(protobuf zlib)
endif()
else()
add_custom_target(protobuf)
endif(THIRD_PARTY)
Expand Down
Loading