Skip to content

Commit 6591b42

Browse files
committed
Use Github worlflow
1 parent 1335a19 commit 6591b42

File tree

10 files changed

+194
-165
lines changed

10 files changed

+194
-165
lines changed

.appveyor.yml

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

.github/workflows/main.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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+
- name: install julia
40+
uses: julia-actions/setup-julia@v1
41+
with:
42+
version: 1.6.3
43+
44+
- name: install CxxWrap
45+
run: |
46+
julia -E "using Pkg; Pkg.add(PackageSpec(name=\"CxxWrap\", version=\"0.11.2\"))"
47+
48+
- name: install host dependencies
49+
shell: bash -l {0}
50+
run: |
51+
$HOME/micromamba-bin/micromamba install xtensor=0.24.0 -c conda-forge -y
52+
53+
- name: cmake configure
54+
shell: bash -l {0}
55+
run: |
56+
JlCxx_DIR=$(julia -E "using CxxWrap; joinpath(CxxWrap.prefix_path(), \"lib\", \"cmake\", \"JlCxx\")")
57+
JlCxx_DIR=${JlCxx_DIR//\"/}
58+
mkdir -p build
59+
cd build
60+
cmake .. \
61+
-D DOWNLOAD_GTEST=ON \
62+
-D BUILD_TESTS=ON \
63+
-D JlCxx_DIR=$JlCxx_DIR \
64+
-DCMAKE_BUILD_TYPE=Release \
65+
-D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX
66+
67+
- name: build
68+
shell: bash -l {0}
69+
run: |
70+
cd build
71+
make -j ${{ steps.cpu-cores.outputs.count }} test_xtensor_julia
72+
73+
- name: Test xtensor-julia
74+
shell: bash -l {0}
75+
run: |
76+
cd build
77+
make xtest
78+
79+
- name: install xtensor-julia
80+
shell: bash -l {0}
81+
run: |
82+
cd build
83+
make install
84+
85+
win:
86+
87+
runs-on: ${{ matrix.os }}
88+
89+
strategy:
90+
fail-fast: false
91+
matrix:
92+
os: [ windows-2016 ]
93+
94+
steps:
95+
- uses: actions/checkout@v2
96+
97+
- name: install mamba
98+
uses: mamba-org/provision-with-micromamba@main
99+
with:
100+
environment-file: environment-dev.yml
101+
environment-name: xtensor-julia
102+
103+
- name: micromamba shell hook
104+
shell: powershell
105+
run: |
106+
micromamba shell hook -s cmd.exe -p C:\Users\runneradmin\micromamba
107+
Get-Content -Path C:\Users\runneradmin\micromamba\condabin\mamba_hook.bat
108+
109+
- name: install cxx compiler
110+
shell: cmd
111+
run: |
112+
call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
113+
micromamba install cxx-compiler -c conda-forge -y
114+
115+
- name: install julia
116+
uses: julia-actions/setup-julia@v1
117+
with:
118+
version: 1.6.3
119+
120+
- name: install CxxWrap
121+
shell: cmd
122+
run: |
123+
julia -E "using Pkg; Pkg.add(PackageSpec(name=\"CxxWrap\", version=\"0.11.2\"))"
124+
125+
- name: install host dependencies
126+
shell: bash -l {0}
127+
run: |
128+
micromamba install xtensor=0.24.0 -c conda-forge -y
129+
130+
- name: cmake configure
131+
shell: cmd
132+
run: |
133+
julia -E "using CxxWrap; joinpath(CxxWrap.prefix_path(), \"lib\", \"cmake\", \"JlCxx\")" > temp.txt
134+
set /p JlCxx_DIR=<temp.txt
135+
set JlCxx_DIR=%JlCxx_DIR:"=%
136+
call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
137+
mkdir -p build
138+
cd build
139+
cmake .. \
140+
-G "NMake Makefiles" \
141+
-D BUILD_TESTS=ON \
142+
-D JlCxx_DIR=%JlCxx_DIR% \
143+
-DCMAKE_BUILD_TYPE=Release \
144+
-D CMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\\LIBRARY
145+
146+
- name: build
147+
shell: cmd
148+
run: |
149+
nmake test_xtensor_julia
150+
151+
- name: run test
152+
shell: cmd
153+
run:
154+
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: xtensor-julia
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- cmake
6+
- xtl
7+
- 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)