Skip to content

Commit 10a2ca4

Browse files
committed
Use Github worlflow
1 parent 1335a19 commit 10a2ca4

File tree

11 files changed

+221
-165
lines changed

11 files changed

+221
-165
lines changed

.appveyor.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: CI
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
unix:
13+
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-18.04, macos-10.15]
20+
include:
21+
- os: ubuntu-18.04
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Get number of CPU cores
26+
uses: SimenB/github-actions-cpu-cores@v1
27+
28+
- name: install mamba
29+
uses: mamba-org/provision-with-micromamba@main
30+
with:
31+
environment-file: environment-dev.yml
32+
environment-name: xtensor-julia
33+
34+
- name: install build dependencies
35+
shell: bash -l {0}
36+
run: |
37+
$HOME/micromamba-bin/micromamba install cmake cxx-compiler -c conda-forge -y
38+
39+
# Cannot use julia from setup-julia because of https://github.com/julia-actions/setup-julia/issues/89
40+
# - name: install julia
41+
# uses: julia-actions/setup-julia@v1
42+
# with:
43+
# version: 1.6.3
44+
45+
- name: install CxxWrap
46+
run: |
47+
julia -E "using Pkg; Pkg.add(PackageSpec(name=\"CxxWrap\", version=\"0.11.2\"))"
48+
49+
- name: cmake configure
50+
shell: bash -l {0}
51+
run: |
52+
JlCxx_DIR=$(julia -E "using CxxWrap; joinpath(CxxWrap.prefix_path(), \"lib\", \"cmake\", \"JlCxx\")")
53+
JlCxx_DIR=${JlCxx_DIR//\"/}
54+
mkdir -p build
55+
cd build
56+
cmake .. \
57+
-D DOWNLOAD_GTEST=ON \
58+
-D BUILD_TESTS=ON \
59+
-D JlCxx_DIR=$JlCxx_DIR \
60+
-DCMAKE_BUILD_TYPE=Release \
61+
-D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX
62+
63+
- name: build
64+
shell: bash -l {0}
65+
run: |
66+
cd build
67+
make -j ${{ steps.cpu-cores.outputs.count }} test_xtensor_julia
68+
69+
- name: Test xtensor-julia
70+
shell: bash -l {0}
71+
run: |
72+
cd build
73+
make xtest
74+
75+
- name: install xtensor-julia
76+
shell: bash -l {0}
77+
run: |
78+
cd build
79+
make install
80+
81+
# win:
82+
83+
# runs-on: ${{ matrix.os }}
84+
85+
# strategy:
86+
# fail-fast: false
87+
# matrix:
88+
# os: [ windows-2016 ]
89+
90+
# steps:
91+
# - uses: actions/checkout@v2
92+
93+
# - name: install mamba
94+
# uses: mamba-org/provision-with-micromamba@main
95+
# with:
96+
# environment-file: environment-dev.yml
97+
# environment-name: xtensor-julia
98+
99+
# - name: micromamba shell hook
100+
# shell: powershell
101+
# run: |
102+
# micromamba shell hook -s cmd.exe -p C:\Users\runneradmin\micromamba
103+
# Get-Content -Path C:\Users\runneradmin\micromamba\condabin\mamba_hook.bat
104+
105+
# - name: install cxx compiler
106+
# shell: cmd
107+
# run: |
108+
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
109+
# micromamba install cxx-compiler -c conda-forge -y
110+
111+
# - name: install julia
112+
# uses: julia-actions/setup-julia@v1
113+
# with:
114+
# version: 1.6.3
115+
116+
# - name: install CxxWrap
117+
# shell: cmd
118+
# run: |
119+
# julia -E "using Pkg; Pkg.add(PackageSpec(name=\"CxxWrap\", version=\"0.11.2\"))"
120+
121+
# - name: install host dependencies
122+
# shell: bash -l {0}
123+
# run: |
124+
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
125+
# micromamba install xtensor=0.24.0 -c conda-forge -y
126+
# micromamba install gtest -c conda-forge -y
127+
128+
# - name: cmake configure
129+
# shell: cmd
130+
# run: |
131+
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
132+
# julia -E "using CxxWrap; joinpath(CxxWrap.prefix_path(), \"lib\", \"cmake\", \"JlCxx\")" > temp.txt
133+
# set /p JlCxx_DIR=<temp.txt
134+
# set JlCxx_DIR=%JlCxx_DIR:"=%
135+
# mkdir -p build
136+
# cd build
137+
# cmake .. ^
138+
# -G "NMake Makefiles" ^
139+
# -D BUILD_TESTS=ON ^
140+
# -D JlCxx_DIR=%JlCxx_DIR% ^
141+
# -DCMAKE_BUILD_TYPE=Release ^
142+
# -D CMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\\LIBRARY
143+
144+
# - name: build
145+
# shell: cmd
146+
# run: |
147+
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
148+
# cd build
149+
# nmake test_xtensor_julia
150+
151+
# - name: run test
152+
# shell: cmd
153+
# run: |
154+
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
155+
# cd build
156+
# nmake xtest

.travis.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ from the `docs` subdirectory.
182182
## Running the tests
183183

184184
```
185-
cmake -D JlCxx_DIR=/path/to/.julia/v0.6/CxxWrap/deps/usr/lib/cmake/JlCxx -D BUILD_TESTS=ON ..
185+
cmake -D BUILD_TESTS=ON ..
186186
```
187187

188188
## Dependencies on `xtensor` and `libcxxwrap-julia`
@@ -191,7 +191,7 @@ cmake -D JlCxx_DIR=/path/to/.julia/v0.6/CxxWrap/deps/usr/lib/cmake/JlCxx -D BUIL
191191

192192
| `xtensor-julia` | `xtensor` | `libcxxwrap` | `julia` |
193193
|-----------------|-----------|---------------|----------------|
194-
| master | ^0.21.2 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |
194+
| master | ^0.24.0 | >=0.8.3,<0.9 | >=1.6.4,<2.0 |
195195
| 0.9.0 | ^0.21.2 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |
196196
| 0.8.4 | ^0.20.8 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |
197197
| 0.8.3 | ^0.20.8 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |

environment-dev.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: xtensor-julia
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- cmake
6+
- xtensor=0.24.0

include/xtensor-julia/jlarray.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace xt
4343
template <class T>
4444
struct xcontainer_inner_types<jlarray<T>>
4545
{
46-
using storage_type = xbuffer_adaptor<jlcxx::mapped_julia_type<T>*>;
46+
using storage_type = xbuffer_adaptor<jlcxx::static_julia_type<T>*>;
4747
using reference = typename storage_type::reference;
4848
using const_reference = typename storage_type::const_reference;
4949
using size_type = typename storage_type::size_type;
@@ -430,7 +430,7 @@ namespace jlcxx
430430
****************************************************************/
431431

432432
template <class T>
433-
struct ConvertToJulia<xt::jlarray<T>, false, false, false>
433+
struct ConvertToJulia<xt::jlarray<T>>
434434
{
435435
template <class U>
436436
jl_array_t* operator()(U&& arr) const
@@ -440,7 +440,7 @@ namespace jlcxx
440440
};
441441

442442
template <class T>
443-
struct ConvertToCpp<xt::jlarray<T>, false, false, false>
443+
struct ConvertToCpp<xt::jlarray<T>>
444444
{
445445
xt::jlarray<T> operator()(jl_array_t* arr) const
446446
{
@@ -452,12 +452,16 @@ namespace jlcxx
452452
struct static_type_mapping<xt::jlarray<T>>
453453
{
454454
using type = jl_array_t*;
455-
static constexpr bool is_dynamic = false;
455+
};
456456

457+
template <class T>
458+
struct julia_type_factory<xt::jlarray<T>>
459+
{
457460
static jl_datatype_t* julia_type()
458461
{
462+
create_if_not_exists<T>();
459463
jl_module_t* current_mod = jlcxx::registry().has_current_module() ? jlcxx::registry().current_module().julia_module() : jl_main_module;
460-
// Array{T}
464+
// Array{T} - dimension is not specified.
461465
return (jl_datatype_t*)apply_type(
462466
jl_get_global(current_mod, jl_symbol("Array")),
463467
jl_svec1(jlcxx::julia_type<T>()));

include/xtensor-julia/jlcontainer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ namespace xt
202202
template <class T>
203203
inline jl_value_t* make_julia_array_type(std::size_t dimension)
204204
{
205-
return jlcxx::apply_array_type(jlcxx::static_type_mapping<T>::julia_type(), dimension);
205+
jlcxx::create_if_not_exists<T>();
206+
return jlcxx::apply_array_type(jlcxx::julia_type<T>(), dimension);
206207
}
207208
}
208209

0 commit comments

Comments
 (0)