Skip to content

Commit 511a274

Browse files
authored
Fix test (#194)
* Update Julia test versions * Bump version to v0.14.6 * Add tests for const dynamic cast
1 parent 5827575 commit 511a274

File tree

4 files changed

+46
-19
lines changed

4 files changed

+46
-19
lines changed

.github/workflows/test-linux-mac.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
version:
18-
- "1.6"
19-
- "1.11"
18+
- "1.10"
19+
- "1"
2020
- "nightly"
2121
os:
2222
- ubuntu-latest
23-
- macos-13
23+
- macos-15-intel
2424
arch:
2525
- x64
2626
include:
27-
- os: macos-14
27+
- os: macos-latest
2828
arch: aarch64
29-
version: "1.11"
30-
- os: macos-14
29+
version: "1.10"
30+
- os: macos-latest
3131
arch: aarch64
3232
version: "nightly"
3333
steps:
@@ -38,12 +38,6 @@ jobs:
3838
with:
3939
version: ${{ matrix.version }}
4040
arch: ${{ matrix.arch }}
41-
- name: Set up GCC 10 on Ubuntu and Julia 1.6
42-
if: matrix.os == 'ubuntu-latest' && matrix.version == '1.6'
43-
run: |
44-
sudo apt-get install -y gcc-10 g++-10
45-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
46-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
4741
- name: Build and test
4842
env:
4943
body: ${{ github.event.pull_request.body }}
@@ -52,14 +46,11 @@ jobs:
5246
if [[ ! "${package}" =~ ^https:// ]]; then
5347
package="https://github.com/JuliaInterop/CxxWrap.jl.git"
5448
fi
55-
if [[ "$OSTYPE" != "darwin"* ]]; then
56-
rm -f /opt/hostedtoolcache/julia/1.6*/x64/lib/julia/libstdc++.so.6
57-
fi
5849
mkdir build && cd build
5950
CXXFLAGS=-ftemplate-backtrace-limit=0 cmake -DCMAKE_INSTALL_PREFIX=$HOME/install -DAPPEND_OVERRIDES_TOML=ON -DCMAKE_BUILD_TYPE=Debug ..
6051
VERBOSE=ON cmake --build . --config Debug --target install
6152
wget https://github.com/JuliaRegistries/General/raw/refs/heads/master/jll/L/libcxxwrap_julia_jll/Versions.toml
62-
jllversion=0.14.2 #$(grep '\["' Versions.toml | tail -n 1 | sed -E 's/\["([0-9]+\.[0-9]+\.[0-9]+)\+[^"]*"\]/\1/g')
53+
jllversion=$(grep '\["' Versions.toml | tail -n 1 | sed -E 's/\["([0-9]+\.[0-9]+\.[0-9]+)\+[^"]*"\]/\1/g')
6354
cd lib
6455
if [ ! -f libcxxwrap_julia.${jllversion}.dylib ]; then
6556
ln -s libcxxwrap_julia.*.*.*.* libcxxwrap_julia.${jllversion}.dylib

.github/workflows/test-win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
version:
19-
- "1.7"
20-
- "1.11"
19+
- "1.10"
20+
- "1"
2121
- "nightly"
2222
os:
2323
- windows-latest

examples/inheritance.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,25 @@ namespace virtualsolver
180180
};
181181
}
182182

183+
struct Parent {
184+
virtual std::string name() const { return "Parent"; }
185+
virtual ~Parent() = default;
186+
};
187+
188+
struct DerivedA : public Parent {
189+
std::string name() const override { return "DerivedA"; }
190+
};
191+
192+
struct DerivedB : public Parent {
193+
std::string name() const override { return "DerivedB"; }
194+
};
195+
196+
197+
Parent* make_a() { return new DerivedA(); }
198+
Parent* make_b() { return new DerivedB(); }
199+
const Parent* make_const_a() { return new const DerivedA(); }
200+
const Parent* make_const_b() { return new const DerivedB(); }
201+
183202
namespace jlcxx
184203
{
185204
// Needed for upcasting
@@ -196,6 +215,9 @@ namespace jlcxx
196215
template<> struct IsMirroredType<StaticBase> : std::false_type { };
197216
template<> struct IsMirroredType<StaticDerived> : std::false_type { };
198217
template<> struct SuperType<StaticDerived> { typedef StaticBase type; };
218+
219+
template<> struct SuperType<DerivedA> { typedef Parent type; };
220+
template<> struct SuperType<DerivedB> { typedef Parent type; };
199221
}
200222

201223
JLCXX_MODULE define_types_module(jlcxx::Module& types)
@@ -230,6 +252,20 @@ JLCXX_MODULE define_types_module(jlcxx::Module& types)
230252
.constructor<int, double>()
231253
.method("getData", &VirtualCfunctionExtended::getData)
232254
.method("set_callback", &VirtualCfunctionExtended::set_callback);
255+
256+
types.add_type<Parent>("Parent")
257+
.method("name", &Parent::name);
258+
259+
types.add_type<DerivedA>("DerivedA", jlcxx::julia_base_type<Parent>())
260+
.method("name", &DerivedA::name);
261+
262+
types.add_type<DerivedB>("DerivedB", jlcxx::julia_base_type<Parent>())
263+
.method("name", &DerivedB::name);
264+
265+
types.method("make_a", &make_a);
266+
types.method("make_b", &make_b);
267+
types.method("make_const_a", &make_const_a);
268+
types.method("make_const_b", &make_const_b);
233269
}
234270

235271
JLCXX_MODULE define_vsolver_module(jlcxx::Module& vsolver_mod)

include/jlcxx/jlcxx_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#define JLCXX_VERSION_MAJOR 0
1818
#define JLCXX_VERSION_MINOR 14
19-
#define JLCXX_VERSION_PATCH 5
19+
#define JLCXX_VERSION_PATCH 6
2020

2121
// From https://stackoverflow.com/questions/5459868/concatenate-int-to-string-using-c-preprocessor
2222
#define __JLCXX_STR_HELPER(x) #x

0 commit comments

Comments
 (0)