Skip to content

Unable to replicate the example in the readme #445

@sylvaticus

Description

@sylvaticus

Hello, I am trying to replicate the example in the readme on a Linux Ubuntu system with gcc/cmake installed but I am getting the following error:

using Pkg
cd(@__DIR__)
Pkg.activate(".")

using CxxWrap
cxxpath    = CxxWrap.prefix_path()
srcpath    = pwd()
buildpath  = joinpath(sourcepath,"build")

write("hello.cpp",
"""
std::string greet()
{
   return "hello, world";
}
""")

write("hello.h",
"""
#include "jlcxx/jlcxx.hpp"

JLCXX_MODULE define_julia_module(jlcxx::Module& mod)
{
  mod.method("greet", &greet);
}
""")

mkpath(buildpath)
cd(buildpath)

cmd1 = `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$cxxpath $srcpath`
cmd2 = `cmake --build . --config Release`
run(cmd1) # error

When I run the command from the terminal I get make: invalid option -- 'D'

I have tried to remove the D and to use two hypens (--), but still no success...

By the way, if the examples are given as made from within Julia (using write/run), they would be easier to replicate....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions