-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
104 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
# This recipe contains three patches to add libpython to the link. Each package will | ||
# probably only need one of those patches, but we keep them all for two reasons: | ||
# | ||
# * To serve as an example for other packages. | ||
# * As the basis for a future PR to merge this into upstream pybind11. | ||
|
||
package: | ||
name: cmake_example | ||
version: "0.0.1" | ||
|
||
build: | ||
number: 1 | ||
|
||
source: | ||
git_url: https://github.com/pybind/cmake_example.git | ||
git_rev: 8818f493e3698a3ab936cdd8e7144afae85df3f8 | ||
|
||
requirements: | ||
build: | ||
- cmake | ||
- cmake 3.28.1 | ||
host: | ||
- python |
50 changes: 39 additions & 11 deletions
50
server/pypi/packages/cmake-example/patches/chaquopy.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,41 @@ | ||
diff -ur src-original/setup.py src/setup.py | ||
--- src-original/setup.py 2018-08-26 13:00:28.012674587 +0000 | ||
+++ src/setup.py 2018-08-26 13:52:26.893666837 +0000 | ||
@@ -36,6 +36,9 @@ | ||
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, | ||
'-DPYTHON_EXECUTABLE=' + sys.executable] | ||
diff --git a/pybind11/CMakeLists.txt b/pybind11/CMakeLists.txt | ||
index 2a3e1ed7..dcd8f98a 100644 | ||
--- a/pybind11/CMakeLists.txt | ||
+++ b/pybind11/CMakeLists.txt | ||
@@ -105,7 +105,7 @@ if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0 | ||
target_compile_options(module INTERFACE -fvisibility=hidden) | ||
endif() | ||
target_link_libraries(module INTERFACE pybind11::pybind11) | ||
- if(WIN32 OR CYGWIN) | ||
+ if(WIN32 OR CYGWIN OR ANDROID) # Chaquopy: added ANDROID | ||
target_link_libraries(module INTERFACE $<BUILD_INTERFACE:${PYTHON_LIBRARIES}>) | ||
elseif(APPLE) | ||
target_link_libraries(module INTERFACE "-undefined dynamic_lookup") | ||
diff --git a/pybind11/tools/pybind11Config.cmake.in b/pybind11/tools/pybind11Config.cmake.in | ||
index 3dd1b2c1..3e96af80 100644 | ||
--- a/pybind11/tools/pybind11Config.cmake.in | ||
+++ b/pybind11/tools/pybind11Config.cmake.in | ||
@@ -86,7 +86,7 @@ if(NOT TARGET ${PN}::pybind11) | ||
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED) | ||
set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS}) | ||
set_property(TARGET ${PN}::embed APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES}) | ||
- if(WIN32 OR CYGWIN) | ||
+ if(WIN32 OR CYGWIN OR ANDROID) # Chaquopy: added ANDROID | ||
set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES}) | ||
endif() | ||
|
||
+ # Chaquopy added | ||
+ cmake_args += ["-DCMAKE_TOOLCHAIN_FILE=" + os.path.abspath("../chaquopy.toolchain.cmake")] | ||
+ | ||
cfg = 'Debug' if self.debug else 'Release' | ||
build_args = ['--config', cfg] | ||
diff --git a/pybind11/tools/pybind11Tools.cmake b/pybind11/tools/pybind11Tools.cmake | ||
index a7c471a0..dbb84c3f 100644 | ||
--- a/pybind11/tools/pybind11Tools.cmake | ||
+++ b/pybind11/tools/pybind11Tools.cmake | ||
@@ -146,8 +146,8 @@ function(pybind11_add_module target_name) | ||
# potential warnings or issues from having mixed hidden/non-hidden types. | ||
set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET "hidden") | ||
|
||
- if(WIN32 OR CYGWIN) | ||
- # Link against the Python shared library on Windows | ||
+ if(WIN32 OR CYGWIN OR ANDROID) # Chaquopy: added ANDROID | ||
+ # Link against the Python shared library on these platforms | ||
target_link_libraries(${target_name} PRIVATE ${PYTHON_LIBRARIES}) | ||
elseif(APPLE) | ||
# It's quite common to have multiple copies of the same Python version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% set version = "2.24.0.0" %} | ||
|
||
package: | ||
name: depthai | ||
version: "{{ version }}" | ||
|
||
build: | ||
number: 2 | ||
script_env: | ||
- CI=1 # Set to build a release package | ||
|
||
source: | ||
git_url: https://github.com/luxonis/depthai-python.git | ||
git_rev: v{{ version }} | ||
|
||
requirements: | ||
host: | ||
- python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/depthai-core/cmake/Hunter/config.cmake b/depthai-core/cmake/Hunter/config.cmake | ||
index 8b1ec798..1e4c58d8 100644 | ||
--- a/depthai-core/cmake/Hunter/config.cmake | ||
+++ b/depthai-core/cmake/Hunter/config.cmake | ||
@@ -124,5 +124,6 @@ hunter_config( | ||
CMAKE_ARGS | ||
WITH_UDEV=OFF | ||
# Build shared libs by default to not cause licensing issues | ||
- BUILD_SHARED_LIBS=ON | ||
+ # Chaquopy: changed to OFF | ||
+ BUILD_SHARED_LIBS=OFF | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index cddfd09b..3d9e4eea 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -255,6 +255,8 @@ target_link_libraries(${TARGET_NAME} | ||
depthai::core # Use non-opencv target as we use opencv-python in bindings | ||
hedley | ||
pybind11_json | ||
+ # Chaquopy: added | ||
+ ${PYTHON_LIBRARY} | ||
) | ||
|
||
# Find Git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import unittest | ||
|
||
class TestDepthAI(unittest.TestCase): | ||
def test_import(self): | ||
try: | ||
import depthai | ||
except ImportError: | ||
print("Unable to import DepthAI module!") | ||
raise |