diff --git a/.github/workflows/test-linux-mac.yml b/.github/workflows/test-linux-mac.yml index df02372..d231f76 100644 --- a/.github/workflows/test-linux-mac.yml +++ b/.github/workflows/test-linux-mac.yml @@ -15,19 +15,19 @@ jobs: fail-fast: false matrix: version: - - "1.6" - - "1.11" + - "1.10" + - "1" - "nightly" os: - ubuntu-latest - - macos-13 + - macos-15-intel arch: - x64 include: - - os: macos-14 + - os: macos-latest arch: aarch64 - version: "1.11" - - os: macos-14 + version: "1.10" + - os: macos-latest arch: aarch64 version: "nightly" steps: @@ -38,12 +38,6 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - name: Set up GCC 10 on Ubuntu and Julia 1.6 - if: matrix.os == 'ubuntu-latest' && matrix.version == '1.6' - run: | - sudo apt-get install -y gcc-10 g++-10 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 - name: Build and test env: body: ${{ github.event.pull_request.body }} @@ -52,14 +46,11 @@ jobs: if [[ ! "${package}" =~ ^https:// ]]; then package="https://github.com/JuliaInterop/CxxWrap.jl.git" fi - if [[ "$OSTYPE" != "darwin"* ]]; then - rm -f /opt/hostedtoolcache/julia/1.6*/x64/lib/julia/libstdc++.so.6 - fi mkdir build && cd build CXXFLAGS=-ftemplate-backtrace-limit=0 cmake -DCMAKE_INSTALL_PREFIX=$HOME/install -DAPPEND_OVERRIDES_TOML=ON -DCMAKE_BUILD_TYPE=Debug .. VERBOSE=ON cmake --build . --config Debug --target install wget https://github.com/JuliaRegistries/General/raw/refs/heads/master/jll/L/libcxxwrap_julia_jll/Versions.toml - jllversion=0.14.2 #$(grep '\["' Versions.toml | tail -n 1 | sed -E 's/\["([0-9]+\.[0-9]+\.[0-9]+)\+[^"]*"\]/\1/g') + jllversion=$(grep '\["' Versions.toml | tail -n 1 | sed -E 's/\["([0-9]+\.[0-9]+\.[0-9]+)\+[^"]*"\]/\1/g') cd lib if [ ! -f libcxxwrap_julia.${jllversion}.dylib ]; then ln -s libcxxwrap_julia.*.*.*.* libcxxwrap_julia.${jllversion}.dylib diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index ea4f07d..4925d82 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -16,8 +16,8 @@ jobs: fail-fast: false matrix: version: - - "1.7" - - "1.11" + - "1.10" + - "1" - "nightly" os: - windows-latest diff --git a/examples/inheritance.cpp b/examples/inheritance.cpp index 5061e88..73a2d06 100644 --- a/examples/inheritance.cpp +++ b/examples/inheritance.cpp @@ -180,6 +180,25 @@ namespace virtualsolver }; } +struct Parent { + virtual std::string name() const { return "Parent"; } + virtual ~Parent() = default; +}; + +struct DerivedA : public Parent { + std::string name() const override { return "DerivedA"; } +}; + +struct DerivedB : public Parent { + std::string name() const override { return "DerivedB"; } +}; + + +Parent* make_a() { return new DerivedA(); } +Parent* make_b() { return new DerivedB(); } +const Parent* make_const_a() { return new const DerivedA(); } +const Parent* make_const_b() { return new const DerivedB(); } + namespace jlcxx { // Needed for upcasting @@ -196,6 +215,9 @@ namespace jlcxx template<> struct IsMirroredType : std::false_type { }; template<> struct IsMirroredType : std::false_type { }; template<> struct SuperType { typedef StaticBase type; }; + + template<> struct SuperType { typedef Parent type; }; + template<> struct SuperType { typedef Parent type; }; } JLCXX_MODULE define_types_module(jlcxx::Module& types) @@ -230,6 +252,20 @@ JLCXX_MODULE define_types_module(jlcxx::Module& types) .constructor() .method("getData", &VirtualCfunctionExtended::getData) .method("set_callback", &VirtualCfunctionExtended::set_callback); + + types.add_type("Parent") + .method("name", &Parent::name); + + types.add_type("DerivedA", jlcxx::julia_base_type()) + .method("name", &DerivedA::name); + + types.add_type("DerivedB", jlcxx::julia_base_type()) + .method("name", &DerivedB::name); + + types.method("make_a", &make_a); + types.method("make_b", &make_b); + types.method("make_const_a", &make_const_a); + types.method("make_const_b", &make_const_b); } JLCXX_MODULE define_vsolver_module(jlcxx::Module& vsolver_mod) diff --git a/include/jlcxx/jlcxx_config.hpp b/include/jlcxx/jlcxx_config.hpp index dce3950..bfee421 100644 --- a/include/jlcxx/jlcxx_config.hpp +++ b/include/jlcxx/jlcxx_config.hpp @@ -16,7 +16,7 @@ #define JLCXX_VERSION_MAJOR 0 #define JLCXX_VERSION_MINOR 14 -#define JLCXX_VERSION_PATCH 5 +#define JLCXX_VERSION_PATCH 6 // From https://stackoverflow.com/questions/5459868/concatenate-int-to-string-using-c-preprocessor #define __JLCXX_STR_HELPER(x) #x