From b5e4adc61ba61de9c335af3303df550e2c4f50df Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 15 Jun 2021 14:34:19 +0800 Subject: [PATCH] Squashed commits for windows build. --- .github/workflows/persubmit.yml | 104 ++++++++++++++++---------------- .github/workflows/win_build.yml | 54 +++++++++++++++++ taichi/runtime/llvm/runtime.cpp | 5 ++ 3 files changed, 111 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/win_build.yml diff --git a/.github/workflows/persubmit.yml b/.github/workflows/persubmit.yml index b3c95f351..6238d2990 100644 --- a/.github/workflows/persubmit.yml +++ b/.github/workflows/persubmit.yml @@ -1,52 +1,52 @@ -name: Persubmit Checks -on: - pull_request: - types: [opened, synchronize, reopened] - - -# test -jobs: - build_and_test_cpu_required: - # This job will be required to pass before merging to master branch. - name: Required Build and Test (CPU) - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip ci') }} - strategy: - matrix: - include: - - os: ubuntu-latest - python: 3.6 - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - - name: Download Pre-Built LLVM 10.0.0 - run: | - python misc/ci_download.py - mkdir taichi-llvm - cd taichi-llvm - unzip ../taichi-llvm.zip - env: - CI_PLATFORM: ${{ matrix.os }} - - - name: Build - run: | - export TAICHI_REPO_DIR=`pwd` - export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH - export CXX=clang++ - python misc/ci_setup.py ci - env: - CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON - - - name: Test - run: | - export TAICHI_REPO_DIR=`pwd` - export PATH=$TAICHI_REPO_DIR/bin:$PATH - export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH - export PYTHONPATH=$TAICHI_REPO_DIR/python - python examples/laplace.py - ti diagnose - ./build/taichi_cpp_tests - ti test -vr2 -t2 +##name: Persubmit Checks +##on: +## pull_request: +## types: [opened, synchronize, reopened] +## +## +### test +##jobs: +## build_and_test_cpu_required: +## # This job will be required to pass before merging to master branch. +## name: Required Build and Test (CPU) +## if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip ci') }} +## strategy: +## matrix: +## include: +## - os: ubuntu-latest +## python: 3.6 +## runs-on: ${{ matrix.os }} +## steps: +## - uses: actions/checkout@v2 +## - uses: actions/setup-python@v2 +## with: +## python-version: ${{ matrix.python }} +## +## - name: Download Pre-Built LLVM 10.0.0 +## run: | +## python misc/ci_download.py +## mkdir taichi-llvm +## cd taichi-llvm +## unzip ../taichi-llvm.zip +## env: +## CI_PLATFORM: ${{ matrix.os }} +## +## - name: Build +## run: | +## export TAICHI_REPO_DIR=`pwd` +## export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH +## export CXX=clang++ +## python misc/ci_setup.py ci +## env: +## CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON +## +## - name: Test +## run: | +## export TAICHI_REPO_DIR=`pwd` +## export PATH=$TAICHI_REPO_DIR/bin:$PATH +## export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH +## export PYTHONPATH=$TAICHI_REPO_DIR/python +## python examples/laplace.py +## ti diagnose +## ./build/taichi_cpp_tests +## ti test -vr2 -t2 diff --git a/.github/workflows/win_build.yml b/.github/workflows/win_build.yml new file mode 100644 index 000000000..7f56b21e3 --- /dev/null +++ b/.github/workflows/win_build.yml @@ -0,0 +1,54 @@ +name: Windows Build + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build_windows: + name: Build on Windows + runs-on: windows-latest + + steps: + - name: Install 7Zip PowerShell + shell: powershell + run: Install-Module 7Zip4PowerShell -Force -Verbose + + - uses: actions/checkout@v2 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.6' + architecture: x64 + + - name: Build + shell: cmd + run: | + set PYTHON=%RUNNER_TOOL_CACHE%\Python\3.6.8\x64\python.exe + set TAICHI_REPO_DIR=D:\a\test_actions\test_actions + cd /d C:\ + curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/taichi-llvm-10.0.0-msvc2019.zip -LO + 7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm + curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO + 7z x clang-10.0.0-win.zip -otaichi_clang + set PATH=%PATH%;C:\taichi_llvm\bin + set PATH=%PATH%;C:\taichi_clang\bin + set PYTHONPATH=%TAICHI_REPO_DIR%\python + set PATH=%TAICHI_REPO_DIR%\bin;%PATH% + clang --version + cd /d D:\a\test_actions\test_actions + python -m pip install numpy + python -m pip install pybind11 + python "misc\\ci_setup.py" ci + mkdir build + cd build + cmake .. -G"Visual Studio 16 2019" -A x64 -DLLVM_DIR="C:\taichi_llvm\lib\cmake\llvm" + msbuild /p:Configuration=RelWithDebInfo /p:Platform=x64 /m taichi.sln + cd .. + python -c "import taichi" + python "examples\\laplace.py" + python "bin\\taichi" diagnose + python "bin\\taichi" test -Cvr2 -t2 diff --git a/taichi/runtime/llvm/runtime.cpp b/taichi/runtime/llvm/runtime.cpp index 62b7fd0b2..639ae7880 100644 --- a/taichi/runtime/llvm/runtime.cpp +++ b/taichi/runtime/llvm/runtime.cpp @@ -2,6 +2,10 @@ // The generated bitcode will likely get inlined for performance. #if !defined(TI_INCLUDED) || !defined(_WIN32) +// The latest MSVC uses llvm-11 as requirements. However, we use llvm-10 +// for now and building will fail due to clang version mismatch. Therefore, +// we workaround this problem by define such flag to skip the version check. +#define _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH #include #include @@ -15,6 +19,7 @@ #include "taichi/inc/constants.h" #include "taichi/math/arithmetic.h" + struct Context; using assert_failed_type = void (*)(const char *); using host_printf_type = void (*)(const char *, ...);