Skip to content

Commit

Permalink
Updated build script file snippet for SHA library adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Dec 11, 2024
1 parent 4450356 commit 1b29c5f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
cpp_files = []
cc_files = []

lib_headers = ['-Ilib/QuickDigest5/include']
lib_headers = ['-Ilib/QuickDigest5/include', '-Ilib/SHA/src']
lib_source_files = []

def get_ext_instructions():
Expand Down Expand Up @@ -80,6 +80,16 @@ def get_ext_instructions():

return supported_features

def include_sha_headers():
global lib_source_files

for root, _, files in os.walk('lib/SHA/src'):
for file in files:
if file.endswith('.cpp'):
lib_source_files.append(os.path.join(root, file))

lib_source_files = [file for file in lib_source_files if not file.endswith("example.cpp")]

for root, dirs, files in os.walk('src'):
for file in files:
if file.endswith('.cpp'):
Expand Down Expand Up @@ -119,6 +129,8 @@ def get_ext_instructions():
'-march=native', '-funroll-loops', '-ffast-math', '-static', '-static-libgcc',
'-static-libstdc++'
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]

include_sha_headers()
lib_build_args = [
'g++', '-static', '-static-libgcc', '-Iinclude',
'-Istd', '-shared', '-o', OUTPUT_LIBRARY + '.dll'
Expand Down Expand Up @@ -153,6 +165,8 @@ def get_ext_instructions():
'-std=c++20', '-fopenmp'] + ext_instructions + ['-march=native',
'-funroll-loops', '-ffast-math', '-D__TERMUX__'
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]

include_sha_headers()
lib_build_args = [
'g++', '-Iinclude', '-Istd', '-fPIC',
'-shared', '-o', OUTPUT_LIBRARY + '.so'
Expand Down Expand Up @@ -186,6 +200,8 @@ def get_ext_instructions():
'-std=c++20', '-fopenmp'] + ext_instructions + ['-mfpmath=sse',
'-march=native', '-funroll-loops', '-ffast-math'
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]

include_sha_headers()
lib_build_args = [
'g++', '-Iinclude', '-Istd', '-fPIC',
'-shared', '-o', OUTPUT_LIBRARY + '.so'
Expand Down Expand Up @@ -221,6 +237,8 @@ def get_ext_instructions():
'-ffast-math', '-flto=auto', '-Xpreprocessor', '-O3',
'-Wno-header-guard', '-Wno-pessimizing-move'
] + lib_headers + lib_source_files + cpp_files + ['-o', OUTPUT_EXECUTABLE]

include_sha_headers()
lib_build_args = [
'/opt/homebrew/opt/llvm/bin/clang++', '-Iinclude',
'-Istd', '-shared', '-o', OUTPUT_LIBRARY + '.dylib'
Expand Down

0 comments on commit 1b29c5f

Please sign in to comment.