Skip to content

Commit

Permalink
(dbg) silly / typo
Browse files Browse the repository at this point in the history
  • Loading branch information
MementoRC committed Mar 28, 2024
1 parent e55f25b commit bd1291b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify_conda_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
run: tox -e lint,typing

- name: Run tests
run: LD_LIBRARY_PATH=$CONDA_PREFIX/lib tox -e ${PYTHON_VERSION}
run: LD_LIBRARY_PATH=$CONDA_PREFIX/lib tox -e ${PYTHON_VERSION} -vvv

- name: Run benchmarks
run: LD_LIBRARY_PATH=$CONDA_PREFIX/lib tox -e bench
Expand Down
9 changes: 8 additions & 1 deletion cm_library_c_binding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/build.py DESTINATION ${CFFI_C_CODE_DIR})
include(VerifyPythonModule)
VerifyPythonModule(cffi ${Python_EXECUTABLE})

if (VENDORED_HEADERS_DIR)
set(_static_build 'ON')
else()
message(STATUS "CFFI C-file is built for a SHARED system library")
set(_static_build 'OFF')
endif()

# Generate the CFFI source file
add_custom_command(
OUTPUT ${CFFI_C_CODE_DIR}/${CFFI_C_CODE}
COMMAND ${Python_EXECUTABLE} ${CFFI_C_CODE_DIR}/build.py
${CFFI_HEADERS_DIR}
${CFFI_C_CODE_DIR}/${CFFI_C_CODE} '1'
${CFFI_C_CODE_DIR}/${CFFI_C_CODE} ${_static_build}
MAIN_DEPENDENCY ${CMAKE_CURRENT_LIST_DIR}/build.py
DEPENDS headers-for-cffi
WORKING_DIRECTORY ${CFFI_C_CODE_DIR}
Expand Down
4 changes: 2 additions & 2 deletions cm_library_c_binding/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ def mk_ffi(directory: str, sources: List[Source], static_lib: bool = False, name
parser = argparse.ArgumentParser(description='Generate C code using CFFI.')
parser.add_argument('headers_dir', help='Path to the header files.', type=str)
parser.add_argument('c_file', help='Generated C code filename.', type=str)
parser.add_argument('static_lib', help='Generate static lib in Windows.', default='0', type=str)
parser.add_argument('static_lib', help='Generate static lib in Windows.', default='0N', type=str)
args = parser.parse_args()

modules = gather_sources_from_directory(args.headers_dir)
ffi = mk_ffi(args.headers_dir, modules, args.static_lib == '1')
ffi = mk_ffi(args.headers_dir, modules, args.static_lib == 'ON')
ffi.emit_c_code(args.c_file)
logging.info(f' Generated C code: {args.c_file}')
6 changes: 3 additions & 3 deletions cm_library_cffi_headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ if(VENDORED_HEADERS_DIR)
file(GLOB src_headers ${VENDORED_HEADERS_DIR}/*.h)
elseif(VENDORED_AS_SYSTEM_LIB_FOUND)
message(WARNING "Using system library ${VENDORED_LIBRARY_CMAKE_TARGET}. The list of headers is set to:"
" <system_include>/*${VENDORED_LIBRARY_CMAKE_TARGET}/*.h
")
file(GLOB src_headers ${VENDORED_AS_SYSTEM_LIB_INCLUDE_DIRS}/*${VENDORED_LIBRARY_CMAKE_TARGET}/*.h)
" <system_include>/*${VENDORED_LIBRARY_CMAKE_TARGET}/*.h")
file(GLOB src_headers ${VENDORED_AS_SYSTEM_LIB_INCLUDE_DIRS}/*${VENDORED_LIBRARY_CMAKE_TARGET}*.h)
message(STATUS " Generating CFFI header for ${src_headers}")
else()
message(FATAL_ERROR "Headers for CFFI cannot be found. Exiting")
endif()
Expand Down
14 changes: 7 additions & 7 deletions cm_library_cffi_headers/compose_cffi_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,16 @@ def make_header_cffi_compliant(src_header_dir, src_header, cffi_dir):
# Deprecated flags
'SECP256K1_CONTEXT_VERIFY',
'SECP256K1_CONTEXT_SIGN',
# Testing flags
'SECP256K1_CONTEXT_DECLASSIFY',
# Not for direct use - That may not mean to remove them!
'SECP256K1_FLAGS_TYPE_MASK',
'SECP256K1_FLAGS_TYPE_CONTEXT',
'SECP256K1_FLAGS_TYPE_COMPRESSION',
'SECP256K1_FLAGS_BIT_CONTEXT_VERIFY',
'SECP256K1_FLAGS_BIT_CONTEXT_SIGN',
# Testing flags
'SECP256K1_CONTEXT_DECLASSIFY',
'SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY',
'SECP256K1_FLAGS_BIT_COMPRESSION',
# Not for direct use - That may not mean to remove them!
# 'SECP256K1_FLAGS_TYPE_MASK',
# 'SECP256K1_FLAGS_TYPE_CONTEXT',
# 'SECP256K1_FLAGS_TYPE_COMPRESSION',
# 'SECP256K1_FLAGS_BIT_COMPRESSION',
# Not supported
'SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC',
'SECP256K1_SCHNORRSIG_EXTRAPARAMS',
Expand Down
4 changes: 3 additions & 1 deletion cm_python_module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if (PROJECT_IGNORE_SYSTEM_LIB OR NOT VENDORED_AS_SYSTEM_LIB_FOUND)
# https://docs.python.org/3/c-api/stable.html#limited-c-api
target_link_libraries(${CFFI_OUTPUT_LIBRARY} PRIVATE ${CFFI_INPUT_LIBRARY})
elseif(VENDORED_AS_SYSTEM_LIB_FOUND)
target_link_libraries(${CFFI_OUTPUT_LIBRARY} PRIVATE ${VENDORED_AS_SYSTEM_LIB_LINK_LIBRARIES})
message(STATUS "Vendored system library found: ${VENDORED_AS_SYSTEM_LIB_LINK_LIBRARIES}")
target_include_directories(${CFFI_OUTPUT_LIBRARY} PRIVATE ${VENDORED_AS_SYSTEM_LIB_INCLUDE_DIRS})
target_link_libraries(${CFFI_OUTPUT_LIBRARY} PRIVATE ${VENDORED_AS_SYSTEM_LIB_LDFLAGS})
else()
message(FATAL_ERROR "Vendored library not found.")
endif()
Expand Down

0 comments on commit bd1291b

Please sign in to comment.