Skip to content

Commit a0a7813

Browse files
committed
LLVM: Support linking exec to python library
1 parent 634177d commit a0a7813

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/bin/lpython.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,16 @@ int link_executable(const std::vector<std::string> &infiles,
12261226
if (compiler_options.enable_symengine) {
12271227
cmd += " -L$CONDA_PREFIX/lib -Wl,-rpath -Wl,$CONDA_PREFIX/lib -lsymengine";
12281228
}
1229+
1230+
if (compiler_options.enable_cpython) {
1231+
std::string py_version = "3.10";
1232+
std::string py_flags = R"(-I $CONDA_PREFIX/include/python)" + py_version + R"( -L$CONDA_PREFIX/lib -Wl,-rpath -Wl,$CONDA_PREFIX/lib -lpython)" + py_version + R"()";
1233+
if (compiler_options.link_numpy) {
1234+
py_flags += R"( -I$CONDA_PREFIX/lib/python)" + py_version + R"(/site-packages/numpy/core/include)";
1235+
}
1236+
cmd += " " + py_flags;
1237+
}
1238+
12291239
int err = system(cmd.c_str());
12301240
if (err) {
12311241
std::cout << "The command '" + cmd + "' failed." << std::endl;

0 commit comments

Comments
 (0)