Skip to content

Commit

Permalink
Fix c2py_magic on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoemi09 committed Feb 14, 2024
1 parent 00e680f commit 47454f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/c2py/python/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

debug = True
dylib_ext = "dylib" if platform.system() == "Darwin" else "so"
env_lib_path = "DYLD_LIBRARY_PATH" if platform.system() == "Darwin" else "LD_LIBRARY_PATH"

def print_out (m, out) :
print(m + out)
Expand All @@ -27,10 +28,10 @@ class ClangInvocation:
"""
def __init__(self, cpp_preamble = "", env_preamble = "", flags= "", command = None):
# FIXME : should I expand clair_flags ?
self.command = command or "clang++ -fplugin=clair_c2py.%s `c2py_flags` -std=c++20 -shared -o {m}.so {m}.cpp -fdiagnostics-color=always %s "%(dylib_ext, flags)
self.command = command or "clang++ -fplugin=clair_c2py.%s -std=c++20 -shared -o {m}.so {m}.cpp `c2py_flags` -fdiagnostics-color=always %s "%(dylib_ext, flags)
self.cpp_preamble = cpp_preamble
# We export the (DY)LD_LIBRARY_PATH from the current shell to the subprocess...
self.env_preamble = "export DYLD_LIBRARY_PATH=%s:$DYLD_LIBRARY_PATH"%os.environ["DYLD_LIBRARY_PATH"] + "\n" + env_preamble
self.env_preamble = "export %s=%s:$%s"%(env_lib_path, os.environ[env_lib_path], env_lib_path) + "\n" + env_preamble

def copy(self):
copy.deepcopy(self)
Expand Down

0 comments on commit 47454f7

Please sign in to comment.