Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from makslevental/ssl
Browse files Browse the repository at this point in the history
re-enable ssl and bootgen
  • Loading branch information
makslevental authored May 8, 2024
2 parents a8195e8 + 65112c7 commit d2a3a38
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
31 changes: 16 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ project(xaiepy)

include(collect)

#find_package(OpenSSL REQUIRED)
#if(OPENSSL_FOUND)
# message(STATUS "OpenSSL found")
# message(STATUS "OpenSSL include directories:" ${OPENSSL_INCLUDE_DIR})
#else()
# message(FATAL_ERROR "OpenSSL Not found.")
#endif()
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
message(STATUS "OpenSSL found")
message(STATUS "OpenSSL include directories:" ${OPENSSL_INCLUDE_DIR})
else()
message(FATAL_ERROR "OpenSSL Not found.")
endif()

set(BOOTGEN_SRC_DIR ${PROJECT_SOURCE_DIR}/third_party/bootgen)
# malloc.h is deprecated and should not be used
Expand Down Expand Up @@ -44,13 +44,13 @@ target_link_libraries(bootgen_objlib PUBLIC)
add_library(bootgen_shared SHARED $<TARGET_OBJECTS:bootgen_objlib>)
add_library(bootgen_static STATIC $<TARGET_OBJECTS:bootgen_objlib>)

#add_executable(bootgen ${BOOTGEN_SRC_DIR}/main.cpp)
#target_include_directories(
# bootgen PUBLIC ${BOOTGEN_SRC_DIR} ${OPENSSL_INCLUDE_DIR}
# ${CMAKE_CURRENT_BINARY_DIR}/include)
#target_compile_definitions(bootgen PRIVATE OPENSSL_USE_APPLINK)
#target_link_libraries(bootgen PRIVATE bootgen_static OpenSSL::SSL
# OpenSSL::applink)
add_executable(bootgen ${BOOTGEN_SRC_DIR}/main.cpp)
target_include_directories(
bootgen PUBLIC ${BOOTGEN_SRC_DIR} ${OPENSSL_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/include)
target_compile_definitions(bootgen PRIVATE OPENSSL_USE_APPLINK)
target_link_libraries(bootgen PRIVATE bootgen_static OpenSSL::SSL
OpenSSL::applink)

add_library(cdo_driver STATIC ${BOOTGEN_SRC_DIR}/cdo-driver/cdo_driver.c)
# because primarily this will be linked into libxaie.so... if not you get
Expand Down Expand Up @@ -80,4 +80,5 @@ add_library(xaie SHARED ${AIERT_SRCS})
set_target_properties(xaie PROPERTIES LINKER_LANGUAGE C)
target_compile_options(xaie PRIVATE -D__AIECDO__)
target_link_libraries(xaie cdo_driver)
target_include_directories(xaie PUBLIC ${AIERT_INCLUDE_DIRECTORIES} ${BOOTGEN_SRC_DIR})
target_include_directories(xaie PUBLIC ${AIERT_INCLUDE_DIRECTORIES})
target_include_directories(xaie PUBLIC SYSTEM ${BOOTGEN_SRC_DIR})
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ before-all = [
"rm -rf *egg*",
]
build-verbosity = 3
build = "cp38-* cp39-* cp310-* cp311-* cp312-*"
#build = "cp38-* cp39-* cp310-* cp311-* cp312-*"
build = "cp311-*"
skip = ["*-manylinux_i686", "*-musllinux*"]
manylinux-aarch64-image = "manylinux_2_28"
manylinux-x86_64-image = "manylinux_2_28"

[tool.cibuildwheel.linux]
before-build = [
"pip install -r requirements-dev.txt",
"yum install -y epel-release && yum install -y openssl openssl-devel"
]

[tool.cibuildwheel.windows]
skip = ["*-win32"]
build = "cp38-* cp39-* cp310-* cp311-* cp312-*"
17 changes: 12 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def print_loader(self):
EXCLUDED_HEADERS = {"xaie_interrupt.h"}


def generate(xaie_build_include_dir: Path, output: Path):
def generate(xaie_build_include_dir: Path, output: Path, bootgen_include_dir: Path):
headers = list(
filter(
lambda f: Path(f).name not in EXCLUDED_HEADERS,
Expand All @@ -266,7 +266,7 @@ def generate(xaie_build_include_dir: Path, output: Path):
allow_gnu_c=False,
builtin_symbols=False,
compile_libdirs=[str(Path(__file__).parent)],
cpp="gcc -E",
cpp=f"gcc -E -I {bootgen_include_dir}",
cpp_defines=[],
cpp_undefines=[],
debug_level=0,
Expand Down Expand Up @@ -334,10 +334,12 @@ def build_extension(self, ext: CMakeExtension) -> None:
CMAKE_MODULE_PATH = str(
Path(__file__).parent / "third_party" / "aie-rt" / "fal" / "cmake"
)
BOOTGEN_INCLUDE_PATH = str(Path(__file__).parent / "third_party" / "bootgen")
if platform.system() == "Windows":
PYTHON_EXECUTABLE = PYTHON_EXECUTABLE.replace("\\", "\\\\")
# i have no clue - cmake parses these at different points...?
CMAKE_MODULE_PATH = CMAKE_MODULE_PATH.replace("\\", "//")
BOOTGEN_INCLUDE_PATH = BOOTGEN_INCLUDE_PATH.replace("\\", "//")

cmake_args = [
f"-B{build_temp}",
Expand All @@ -349,6 +351,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY={extdir / PACKAGE_NAME}",
f"-DPython3_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
"-DCMAKE_C_VISIBILITY_PRESET=default",
]
if platform.system() == "Windows":
cmake_args += [
Expand All @@ -357,8 +360,8 @@ def build_extension(self, ext: CMakeExtension) -> None:
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded",
"-DCMAKE_C_FLAGS=/MT",
"-DCMAKE_CXX_FLAGS=/MT",
"-DLLVM_USE_CRT_MINSIZEREL=MT",
"-DLLVM_USE_CRT_RELEASE=MT",
"-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON",
"-DCMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS=ON",
]

if "CMAKE_ARGS" in os.environ:
Expand Down Expand Up @@ -416,7 +419,11 @@ def build_extension(self, ext: CMakeExtension) -> None:
cwd=build_temp,
check=True,
)
generate(build_temp / "include", extdir / PACKAGE_NAME / "_xaie.py")
generate(
build_temp / "include",
extdir / PACKAGE_NAME / "_xaie.py",
BOOTGEN_INCLUDE_PATH,
)


build_temp = Path.cwd() / "build" / "temp"
Expand Down

0 comments on commit d2a3a38

Please sign in to comment.