File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -705,6 +705,24 @@ def get_data_type(t):
705705 file .write (template )
706706
707707 # ----------------------------------------------------------------------
708+ # Generate the Shared library
708709 # TODO: Use LLVM instead of C backend
709710 r = os .system ("lpython --show-c --disable-main a.py > a.h" )
710711 assert r == 0 , "Failed to create C file"
712+ gcc_flags = ""
713+ if platform .system () == "Linux" :
714+ gcc_flags = " -shared -fPIC "
715+ elif platform .system () == "Darwin" :
716+ gcc_flags = " -bundle -flat_namespace -undefined suppress "
717+ else :
718+ raise NotImplementedError ("Platform not implemented" )
719+ python_path = "-I" + get_python_inc () + " "
720+ numpy_path = "-I" + get_include ()
721+ rt_path_01 = "-I" + get_rtlib_dir () + "/../libasr/runtime "
722+ rt_path_02 = "-L" + get_rtlib_dir () + " -Wl,-rpath " \
723+ + get_rtlib_dir () + " -llpython_runtime "
724+ python_lib = "-L" "$CONDA_PREFIX/lib/ -lpython3.10 -lm"
725+ r = os .system ("gcc -g" + gcc_flags + python_path + numpy_path +
726+ " a.c -o lpython_jit_module.so " + rt_path_01 + rt_path_02 + python_lib )
727+ assert r == 0 , "Failed to create the shared library"
728+
You can’t perform that action at this time.
0 commit comments