[ESI runtime] Fix Python wheel build

- Older versions of Linux (like the ones we use for Python wheel builds)
need more includes.
- Install backend shared libraries
- Exclude MtiPli from repair
This commit is contained in:
John Demme 2024-07-10 13:54:41 +00:00
parent 98e8265a7c
commit dcc7dd8db4
4 changed files with 45 additions and 13 deletions

View File

@ -45,6 +45,12 @@ if (NOT TARGET nlohmann_json)
FetchContent_MakeAvailable(json)
endif()
# In a Python wheel build, we need to install libraries to different places.
option(WHEEL_BUILD "Set up the build for a Python wheel." OFF)
if (WHEEL_BUILD)
message(STATUS "Setting up for a Python wheel build.")
endif()
##===----------------------------------------------------------------------===//
## Overall target to build everything.
##===----------------------------------------------------------------------===//
@ -113,10 +119,17 @@ else()
)
endif()
add_dependencies(ESIRuntime ESICppRuntime)
install(TARGETS ESICppRuntime
DESTINATION lib
COMPONENT ESIRuntime
)
if (WHEEL_BUILD)
install(TARGETS ESICppRuntime
DESTINATION lib
COMPONENT ESIRuntime
)
else()
install(TARGETS ESICppRuntime
DESTINATION python/esiaccel
COMPONENT ESIRuntime
)
endif()
install(FILES ${ESICppRuntimeHeaders}
DESTINATION include/esi
COMPONENT ESIRuntime-dev
@ -165,11 +178,6 @@ add_dependencies(ESIRuntime esitester)
## Python bindings for the ESI runtime.
##===----------------------------------------------------------------------===//
option(WHEEL_BUILD "Set up the build for a Python wheel." OFF)
if (WHEEL_BUILD)
message(STATUS "Setting up for a Python wheel build.")
endif()
# Pybind11 is used to wrap the ESICppRuntime APIs.
if(NOT DEFINED Python3_FOUND)
find_package(Python3 COMPONENTS Interpreter Development)
@ -284,7 +292,6 @@ else() # Python not found.
endif()
##===----------------------------------------------------------------------===//
## Backends are loaded dynamically as plugins.
##===----------------------------------------------------------------------===//
@ -331,6 +338,18 @@ if(ESI_COSIM)
add_dependencies(ESIRuntime CosimBackend)
if (WHEEL_BUILD)
install(TARGETS CosimBackend
DESTINATION lib
COMPONENT ESIRuntime
)
else()
install(TARGETS CosimBackend
DESTINATION python/esiaccel
COMPONENT ESIRuntime
)
endif()
# Build the RTL DPI cosim server.
add_subdirectory(cosim_dpi_server)
else()
@ -365,6 +384,17 @@ if (XRT_PATH)
-L${XRT_PATH}/lib
)
add_dependencies(ESIRuntime XrtBackend)
if (WHEEL_BUILD)
install(TARGETS XrtBackend
DESTINATION lib
COMPONENT ESIRuntime
)
else()
install(TARGETS XrtBackend
DESTINATION python/esiaccel
COMPONENT ESIRuntime
)
endif()
endif()
install(FILES ${ESICppRuntimeBackendHeaders}

View File

@ -23,6 +23,8 @@
#ifdef __linux__
#include <dlfcn.h>
#include <linux/limits.h>
#include <unistd.h>
#elif _WIN32
// TODO: this.
#endif

View File

@ -18,6 +18,9 @@ git_describe_command = "git describe --dirty --tags --long --match ESIRuntime*"
[tool.cibuildwheel]
build-frontend = "build"
[tool.cibuildwheel.linux]
repair-wheel-command = "auditwheel repair --exclude libMtiPli.so -w {dest_dir} {wheel}"
[project]
name = "esiaccel"
dynamic = ["version"]

View File

@ -111,9 +111,6 @@ class CMakeBuild(build_py):
"--parallel",
"--target",
"ESIRuntime",
"esiquery",
"ESIPythonRuntime",
"EsiCosimDpiServer",
],
cwd=cmake_build_dir)