diff --git a/CMakeLists.txt b/CMakeLists.txt index 5869b57..155d29e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -44,13 +44,13 @@ target_link_libraries(bootgen_objlib PUBLIC) add_library(bootgen_shared SHARED $) add_library(bootgen_static STATIC $) -#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 @@ -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}) diff --git a/pyproject.toml b/pyproject.toml index 0adec3f..5e72cdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,8 @@ 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" @@ -21,8 +22,8 @@ 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-*" diff --git a/setup.py b/setup.py index 0bdbbee..226f995 100644 --- a/setup.py +++ b/setup.py @@ -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, @@ -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, @@ -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}", @@ -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 += [ @@ -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: @@ -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"