Skip to content

Commit

Permalink
No longer building core archive for linking and compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Nov 25, 2024
1 parent fcfd856 commit 8660160
Showing 1 changed file with 13 additions and 53 deletions.
66 changes: 13 additions & 53 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
os.makedirs(TEMP_DIR)

OUTPUT_EXECUTABLE = os.path.join(OUT_DIR, 'n8')
OUTPUT_LIBRARY = os.path.join(OUT_DIR, 'n8std')
OUTPUT_LIBRARY = os.path.join(OUT_DIR, 'n8-std')
OUTPUT_CORE = OUTPUT_LIBRARY + '-core.a'

cpp_files = []
Expand Down Expand Up @@ -102,27 +102,17 @@ def get_ext_instructions():
'-std=c++17', '-fopenmp'] + ext_instructions + ['-mfpmath=sse',
'-march=native', '-funroll-loops', '-ffast-math', '-static', '-static-libgcc',
'-static-libstdc++'
] + lib_headers + lib_source_files + cpp_files

core_build_args = exe_build_args + [
'-shared',
'-o', OUTPUT_CORE
]
exe_build_args += ['-o', OUTPUT_EXECUTABLE]
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]
lib_build_args = [
'g++', '-static', '-static-libgcc', '-Iinclude',
'-Istd', '-I' + os.path.join(TEMP_DIR, 'include'),
'-shared', '-o', OUTPUT_LIBRARY + '.dll', OUTPUT_CORE
] + cc_files
'-shared', '-o', OUTPUT_LIBRARY + '.dll'
] + cpp_files + cc_files

print("Executing:")
print(' '.join(exe_build_args))
subprocess.run(exe_build_args)

print("Executing:")
print(' '.join(core_build_args))
subprocess.run(core_build_args)

print("Executing:")
print(' '.join(lib_build_args))
subprocess.run(lib_build_args)
Expand All @@ -146,28 +136,17 @@ def get_ext_instructions():
'-Wvolatile-register-var', '-Wwrite-strings', '-pipe', '-ffast-math', '-s',
'-std=c++20', '-fopenmp'] + ext_instructions + ['-march=native',
'-funroll-loops', '-ffast-math', '-D__TERMUX__'
] + lib_headers + lib_source_files + cpp_files

core_build_args = exe_build_args + [
'-fPIC', '-shared',
'-o', OUTPUT_CORE
]
exe_build_args += ['-o', OUTPUT_EXECUTABLE]
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]
lib_build_args = [
'g++', '-Iinclude',
'-Istd', '-I' + os.path.join(TEMP_DIR, 'include'),
'-fPIC', '-shared', '-o', OUTPUT_LIBRARY + '.so',
OUTPUT_CORE
] + cc_files
'-fPIC', '-shared', '-o', OUTPUT_LIBRARY + '.so'
] + cpp_files + cc_files

print("Executing:")
print(' '.join(exe_build_args))
subprocess.run(exe_build_args)

print("Executing:")
print(' '.join(core_build_args))
subprocess.run(core_build_args)

print("Executing:")
print(' '.join(lib_build_args))
subprocess.run(lib_build_args)
Expand All @@ -191,28 +170,17 @@ def get_ext_instructions():
'-Wvolatile-register-var', '-Wwrite-strings', '-pipe', '-ffast-math', '-s',
'-std=c++20', '-fopenmp'] + ext_instructions + ['-mfpmath=sse',
'-march=native', '-funroll-loops', '-ffast-math'
] + lib_headers + lib_source_files + cpp_files

core_build_args = exe_build_args + [
'-fPIC', '-shared',
'-o', OUTPUT_CORE
]
exe_build_args += ['-o', OUTPUT_EXECUTABLE]
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]
lib_build_args = [
'g++', '-Iinclude',
'-Istd', '-I' + os.path.join(TEMP_DIR, 'include'),
'-fPIC', '-shared', '-o', OUTPUT_LIBRARY + '.so',
OUTPUT_CORE
] + cc_files
'-fPIC', '-shared', '-o', OUTPUT_LIBRARY + '.so'
] + cpp_files + cc_files

print("Executing:")
print(' '.join(exe_build_args))
subprocess.run(exe_build_args)

print("Executing:")
print(' '.join(core_build_args))
subprocess.run(core_build_args)

print("Executing:")
print(' '.join(lib_build_args))
subprocess.run(lib_build_args)
Expand All @@ -238,25 +206,17 @@ def get_ext_instructions():
'-std=c++17', '-fopenmp', '-march=native', '-funroll-loops',
'-ffast-math', '-flto=auto', '-Xpreprocessor', '-O3',
'-Wno-header-guard', '-Wno-pessimizing-move'
] + lib_headers + lib_source_files + cpp_files

core_build_args = exe_build_args + ['-shared', '-o', OUTPUT_CORE]
exe_build_args += ['-o', OUTPUT_EXECUTABLE]

] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]
lib_build_args = [
'/opt/homebrew/opt/llvm/bin/clang++', '-Iinclude',
'-Istd', '-I' + os.path.join(TEMP_DIR, 'include'),
'-shared', '-o', OUTPUT_LIBRARY + '.dylib', OUTPUT_CORE
] + cc_files
'-shared', '-o', OUTPUT_LIBRARY + '.dylib'
] + cpp_files + cc_files

print("Executing:")
print(' '.join(exe_build_args))
subprocess.run(exe_build_args)

print("Executing:")
print(' '.join(core_build_args))
subprocess.run(core_build_args)

print("Executing:")
print(' '.join(lib_build_args))
subprocess.run(lib_build_args)
Expand Down

0 comments on commit 8660160

Please sign in to comment.