- Notifications
You must be signed in to change notification settings - Fork63
Add clang-cl support#199
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
robertodr wants to merge13 commits intoxtensor-stack:masterChoose a base branch fromrobertodr:clang-cl
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Draft
Changes fromall commits
Commits
Show all changes
13 commits Select commitHold shift + click to select a range
1c5e4f1
Add clang-cl support
robertodrfe0841a
Fix benchmark/CMakeLists.txt
robertodrc0f7703
CMake
robertodr5a44a04
Add HAVE_SNPRINTF compiler definition with clang-cl
robertodr86a4950
Unpin xtensor version
robertodrf716605
Split pytest and C++ unit tests
robertodra9f022d
Not really sure what I am doing here
robertodr2188cb6
Windows is hard
robertodrac654c3
Remove Python 2.7 from PATH
robertodrb2ae4ab
Remove Python 2.7 from PATH
robertodr0f4aedd
echo fest
robertodr1ffa032
echo fest
robertodr59b0b20
echo fest
robertodrFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletionsCMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletionsazure-pipelines.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
trigger: | ||
- master | ||
jobs: | ||
# Configure, build, install, and test job | ||
- job: 'build' | ||
pool: | ||
vmImage: 'vs2015-win2012r2' | ||
timeoutInMinutes: 360 | ||
steps: | ||
# Install Chocolatey (https://chocolatey.org/install#install-with-powershellexe) | ||
- powershell: | | ||
Set-ExecutionPolicy Bypass -Scope Process -Force | ||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | ||
Write-Host "##vso[task.setvariable variable=PATH]$env:PATH" | ||
choco --version | ||
displayName: "Install Chocolatey" | ||
# Install Miniconda | ||
- script: | | ||
echo 'PATH before %PATH%' | ||
echo 'PYTHONPATH before %PYTHONPATH%' | ||
set PATH=%PATH:C:\Python27;=% | ||
choco install miniconda3 --yes | ||
echo 'PATH after %PATH%' | ||
echo 'PYTHONPATH after %PYTHONPATH%' | ||
set PATH=C:\tools\miniconda3\Scripts;C:\tools\miniconda3;C:\tools\miniconda3\Library\bin;%PATH% | ||
echo '##vso[task.setvariable variable=PATH]%PATH%' | ||
echo 'LIB before %LIB%' | ||
set LIB=C:\tools\miniconda3\Library\lib;%LIB% | ||
echo 'LIB after %LIB%' | ||
echo '##vso[task.setvariable variable=LIB]%LIB%' | ||
conda --version | ||
displayName: "Install Miniconda" | ||
# Configure Miniconda | ||
- script: | | ||
conda config --set always_yes yes | ||
conda config --append channels conda-forge | ||
conda info | ||
echo 'PATH again %PATH%' | ||
echo 'PYTHONPATH again %PYTHONPATH%' | ||
echo 'LIB again %LIB%' | ||
displayName: "Configure Miniconda" | ||
# Create conda enviroment | ||
# Note: conda activate doesn't work here, because it creates a new shell! | ||
- script: | | ||
conda install cmake ^ | ||
gtest ^ | ||
ninja ^ | ||
pybind11 ^ | ||
pytest ^ | ||
numpy ^ | ||
xtensor ^ | ||
python=3.6 | ||
conda list | ||
displayName: "Install conda packages" | ||
# Install LLVM | ||
# Note: LLVM distributed by conda is too old | ||
- script: | | ||
choco install llvm --yes | ||
set PATH=C:\Program Files\LLVM\bin;%PATH% | ||
echo '##vso[task.setvariable variable=PATH]%PATH%' | ||
clang-cl --version | ||
displayName: "Install LLVM" | ||
# Configure | ||
- script: | | ||
setlocal EnableDelayedExpansion | ||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 | ||
mkdir build & cd build | ||
cmake -G Ninja ^ | ||
-DCMAKE_BUILD_TYPE=Release ^ | ||
-DCMAKE_C_COMPILER=clang-cl ^ | ||
-DCMAKE_CXX_COMPILER=clang-cl ^ | ||
-DBUILD_TESTS=ON ^ | ||
-DCMAKE_INSTALL_PREFIX=C:\tools\miniconda3 ^ | ||
$(Build.SourcesDirectory) | ||
displayName: "Configure xtensor-python" | ||
workingDirectory: $(Build.BinariesDirectory) | ||
# Build | ||
- script: | | ||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 | ||
cmake --build . ^ | ||
--config Release ^ | ||
--target test_xtensor_python ^ | ||
-- -v | ||
displayName: "Build xtensor-python" | ||
workingDirectory: $(Build.BinariesDirectory)/build | ||
# Install | ||
- script: | | ||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 | ||
cmake --build . ^ | ||
--config Release ^ | ||
--target install ^ | ||
-- -v | ||
displayName: "Install xtensor-python" | ||
workingDirectory: $(Build.BinariesDirectory)/build | ||
# Test (Google test) | ||
- script: | | ||
echo 'PATH and again %PATH%' | ||
echo 'PYTHONPATH and again %PYTHONPATH%' | ||
echo 'LIB and again %LIB%' | ||
.\test_xtensor_python | ||
displayName: "Test xtensor-python (Google test)" | ||
workingDirectory: $(Build.BinariesDirectory)/build/test | ||
# Test (pytest) | ||
- script: | | ||
py.test -s | ||
displayName: "Test xtensor-python (pytest)" | ||
workingDirectory: $(Build.BinariesDirectory) |
85 changes: 58 additions & 27 deletionsbenchmark/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
50 changes: 35 additions & 15 deletionstest/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletionstest/set_compiler_flag.cmake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copied from | ||
# https://github.com/dev-cafe/cmake-cookbook/blob/master/chapter-07/recipe-03/c-cxx-example/set_compiler_flag.cmake | ||
# Adapted from | ||
# https://github.com/robertodr/ddPCM/blob/expose-C-api/cmake/custom/compilers/SetCompilerFlag.cmake | ||
# which was adapted by Roberto Di Remigio from | ||
# https://github.com/SethMMorton/cmake_fortran_template/blob/master/cmake/Modules/SetCompileFlag.cmake | ||
# Given a list of flags, this stateless function will try each, one at a time, | ||
# and set result to the first flag that works. | ||
# If none of the flags works, result is "". | ||
# If the REQUIRED key is given and no flag is found, a FATAL_ERROR is raised. | ||
# | ||
# Call is: | ||
# set_compile_flag(result (Fortran|C|CXX) <REQUIRED> flag1 flag2 ...) | ||
# | ||
# Example: | ||
# set_compiler_flag(working_compile_flag C REQUIRED "-Wall" "-warn all") | ||
include(CheckCCompilerFlag) | ||
include(CheckCXXCompilerFlag) | ||
include(CheckFortranCompilerFlag) | ||
function(set_compiler_flag _result _lang) | ||
# build a list of flags from the arguments | ||
set(_list_of_flags) | ||
# also figure out whether the function | ||
# is required to find a flag | ||
set(_flag_is_required FALSE) | ||
foreach(_arg IN ITEMS ${ARGN}) | ||
string(TOUPPER "${_arg}" _arg_uppercase) | ||
if(_arg_uppercase STREQUAL "REQUIRED") | ||
set(_flag_is_required TRUE) | ||
else() | ||
list(APPEND _list_of_flags "${_arg}") | ||
endif() | ||
endforeach() | ||
set(_flag_found FALSE) | ||
# loop over all flags, try to find the first which works | ||
foreach(flag IN ITEMS ${_list_of_flags}) | ||
unset(_${flag}_works CACHE) | ||
if(_lang STREQUAL "C") | ||
check_c_compiler_flag("${flag}" _${flag}_works) | ||
elseif(_lang STREQUAL "CXX") | ||
check_cxx_compiler_flag("${flag}" _${flag}_works) | ||
elseif(_lang STREQUAL "Fortran") | ||
check_Fortran_compiler_flag("${flag}" _${flag}_works) | ||
else() | ||
message(FATAL_ERROR "Unknown language in set_compiler_flag: ${_lang}") | ||
endif() | ||
# if the flag works, use it, and exit | ||
# otherwise try next flag | ||
if(_${flag}_works) | ||
set(${_result} "${flag}" PARENT_SCOPE) | ||
set(_flag_found TRUE) | ||
break() | ||
endif() | ||
endforeach() | ||
# raise an error if no flag was found | ||
if(_flag_is_required AND NOT _flag_found) | ||
message(FATAL_ERROR "None of the required flags were supported") | ||
endif() | ||
endfunction() |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.