|
|
@ -16,7 +16,8 @@ compiler_cmd = "c++" |
|
|
|
|
|
|
|
|
|
|
|
optimize = "-O0" |
|
|
|
optimize = "-O0" |
|
|
|
|
|
|
|
|
|
|
|
cmd_flags = ["$(pkg-config --cflags eigen3)", "-Wall"] |
|
|
|
cmd_flags = ["-std=c++11", "$(pkg-config --cflags eigen3)", "-Wall"] |
|
|
|
|
|
|
|
link_flags = [""] |
|
|
|
|
|
|
|
|
|
|
|
template = """ |
|
|
|
template = """ |
|
|
|
#include <pybind11/pybind11.h> |
|
|
|
#include <pybind11/pybind11.h> |
|
|
@ -91,14 +92,6 @@ def ensure_build_dir(path, clear=False): |
|
|
|
return exists and not clear |
|
|
|
return exists and not clear |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def ensure_linker(): |
|
|
|
|
|
|
|
path = os.path.join(TMP_PATH, "liblinker.so") |
|
|
|
|
|
|
|
exists = os.path.exists(path) |
|
|
|
|
|
|
|
if not os.path.exists(path): |
|
|
|
|
|
|
|
return compile_linkerlib() |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parse_args(line): |
|
|
|
def parse_args(line): |
|
|
|
args = line.split(" ") |
|
|
|
args = line.split(" ") |
|
|
|
ret = {} |
|
|
|
ret = {} |
|
|
@ -134,13 +127,13 @@ def cleanup(args, name, CMakeLists): |
|
|
|
|
|
|
|
|
|
|
|
def get_gcc_cmd(name): |
|
|
|
def get_gcc_cmd(name): |
|
|
|
pyexe = sys.executable |
|
|
|
pyexe = sys.executable |
|
|
|
return f"{compiler_cmd} {' '.join(cmd_flags)} {optimize} -std=c++11 -fPIC $({pyexe} -m pybind11 --includes) -c {BUILD_DIR}/{name}.cpp -o {BUILD_DIR}/{name}.o" |
|
|
|
return f"{compiler_cmd} {' '.join(cmd_flags)} {optimize} -fPIC $({pyexe} -m pybind11 --includes) -c {BUILD_DIR}/{name}.cpp -o {BUILD_DIR}/{name}.o" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_linker_cmd(name, others=None): |
|
|
|
def get_linker_cmd(name, others=None): |
|
|
|
if others is None: |
|
|
|
if others is None: |
|
|
|
others = " ".join([f"-l{os.path.basename(n)[3:-3]}" for n in sorted(glob.glob(f"{LIB_DIR}/*.so"), key=os.path.getmtime)[::-1]]) |
|
|
|
others = " ".join([f"-l{os.path.basename(n)[3:-3]}" for n in sorted(glob.glob(f"{LIB_DIR}/*.so"), key=os.path.getmtime)[::-1]]) |
|
|
|
return f"{compiler_cmd} -Wl,-rpath {LIB_DIR} -shared {BUILD_DIR}/{name}.o -o {MODULES_DIR}/{name}.so -L{LIB_DIR} {others}" |
|
|
|
return f"{compiler_cmd} -Wl,-rpath {LIB_DIR} -shared {BUILD_DIR}/{name}.o -o {MODULES_DIR}/{name}.so -L{LIB_DIR} {others} {' '.join(link_flags)}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def import_to_ip(name): |
|
|
|
def import_to_ip(name): |
|
|
@ -299,9 +292,9 @@ def cpp(line, cell, *what): |
|
|
|
ip = get_ipython() |
|
|
|
ip = get_ipython() |
|
|
|
# get name of module |
|
|
|
# get name of module |
|
|
|
if args["cmake_path"] is None: |
|
|
|
if args["cmake_path"] is None: |
|
|
|
# TODO! |
|
|
|
|
|
|
|
compile_id = get_gcc_cmd("dummy") |
|
|
|
compile_id = get_gcc_cmd("dummy") |
|
|
|
else: |
|
|
|
else: |
|
|
|
|
|
|
|
# TODO! |
|
|
|
compile_id = get_CMakeLists(args) |
|
|
|
compile_id = get_CMakeLists(args) |
|
|
|
|
|
|
|
|
|
|
|
hash_object = hashlib.sha256((compile_id+"|"+line+"|"+cell).encode()) |
|
|
|
hash_object = hashlib.sha256((compile_id+"|"+line+"|"+cell).encode()) |
|
|
@ -344,20 +337,3 @@ def cpp(line, cell, *what): |
|
|
|
shutil.copyfile(os.path.join(MODULES_DIR,f"{other_name}.so"), os.path.join(LIB_DIR,f"lib{other_name}{version}.so")) |
|
|
|
shutil.copyfile(os.path.join(MODULES_DIR,f"{other_name}.so"), os.path.join(LIB_DIR,f"lib{other_name}{version}.so")) |
|
|
|
|
|
|
|
|
|
|
|
bulk_import([h for h in history if h in relinks]) |
|
|
|
bulk_import([h for h in history if h in relinks]) |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
CLEAR LIB_FOLDER |
|
|
|
|
|
|
|
#### PIPELINE #### |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create name |
|
|
|
|
|
|
|
add version |
|
|
|
|
|
|
|
add name to history |
|
|
|
|
|
|
|
compile to modules_dir/{name}.so (may be already there) |
|
|
|
|
|
|
|
detect_relink_needs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for all relinked mv modules_dir/{name}.so -> libs_dir/lib{name}{version}.so (delete old?) |
|
|
|
|
|
|
|
relink |
|
|
|
|
|
|
|
for all relinked mv modules_dir/{name}.so -> libs_dir/lib{name}{version}.so |
|
|
|
|
|
|
|
import_bulk according to history |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|