Skip to content

Commit

Permalink
Build a Python package for the client API (#71)
Browse files Browse the repository at this point in the history
Templatize Dockerfile
Move Python setup files
Refactor dockerfile generator
Enable building server in cibuildwheel container
Don't install libraries for skbuild
Update import path for Python extension
Support building for other Python versions
Fix building python package in normal CMake flow
Update documentation

Signed-off-by: Varun Sharma <varun.sharma@amd.com>
  • Loading branch information
varunsh-xilinx committed Sep 20, 2022
1 parent 9cff917 commit 134cd03
Show file tree
Hide file tree
Showing 32 changed files with 1,237 additions and 619 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ external/artifacts
external/repository
private/
src/proteus/bindings/python/dist
_skbuild
dist

# files
**/callgrind.out.*
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ external/overlaybins
docs/_*/
tests/shell/test_helper
src/proteus/bindings/python/dist
_skbuild
dist

# files
callgrind.out.*
Expand All @@ -45,6 +47,7 @@ tests/assets/girl-1867092_640.jpg
*.pb
*.pth
*.pt
Dockerfile

# generated by cmake
include/proteus/build_options.hpp
Expand Down
22 changes: 16 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2021 Xilinx Inc.
# Copyright 2022 Advanced Micro Devices Inc.
# Copyright 2021 Xilinx, Inc.
# Copyright 2022 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -54,8 +54,12 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-Wl,")
add_link_options("LINKER:--as-needed")
add_link_options("LINKER:--no-undefined")
add_link_options("LINKER:--no-allow-shlib-undefined")
if(NOT SKBUILD)
# For manylinux builds, the Python extension is intentionally not linked
# against Python at compile time so we need to allow undefined symbols
add_link_options("LINKER:--no-undefined")
add_link_options("LINKER:--no-allow-shlib-undefined")
endif()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Coverage"
CACHE STRING "Available build-types: Debug, Release and Coverage"
)
Expand Down Expand Up @@ -95,9 +99,9 @@ find_package(gRPC CONFIG)
find_package(Doxygen)
find_package(Sphinx)
find_package(efsw)
find_package(json-c)
find_package(json-c QUIET)
find_package(prometheus-cpp)
find_package(sockpp)
find_package(sockpp QUIET)

find_package(xir QUIET)
find_package(vart CONFIG COMPONENTS runner util QUIET)
Expand Down Expand Up @@ -155,6 +159,12 @@ else()
add_derived_option("ENABLE_HTTP" OFF)
endif()

# override tracing option and disable it if building Python bindings
if(SKBUILD)
set(PROTEUS_ENABLE_TRACING OFF)
set(PROTEUS_BUILD_TESTING OFF)
endif()

configure_file(
src/proteus/build_options.hpp.in
${PROJECT_SOURCE_DIR}/include/proteus/build_options.hpp
Expand Down

0 comments on commit 134cd03

Please sign in to comment.