Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_backend_cpu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_backend_cpu
Commits
ad03e782
Commit
ad03e782
authored
1 year ago
by
Olivier BICHLER
Browse files
Options
Downloads
Patches
Plain Diff
Fixed compile issue with Pybind
parent
d06722da
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+6
-10
6 additions, 10 deletions
CMakeLists.txt
cmake/PybindModuleCreation.cmake
+7
-4
7 additions, 4 deletions
cmake/PybindModuleCreation.cmake
with
13 additions
and
14 deletions
CMakeLists.txt
+
6
−
10
View file @
ad03e782
cmake_minimum_required
(
VERSION 3.1
1
)
cmake_minimum_required
(
VERSION 3.1
5
)
set
(
project aidge_backend_cpu
)
# This will also be python module name
set
(
module_name _
${
project
}
)
# target name
...
...
@@ -46,17 +46,13 @@ target_include_directories(${module_name}
generate_python_binding
(
${
project
}
${
module_name
}
)
if
(
PYBIND
)
message
(
STATUS
"PYTHON INCLUDE DIR :
${
PYTHON_INCLUDE_DIRS
}
"
)
message
(
STATUS
"PYTHON PYTHON_LIBRARY :
${
PYTHON_LIBRARIES
}
"
)
target_include_directories
(
${
module_name
}
PUBLIC
$<BUILD_INTERFACE:
${
PYTHON_INCLUDE_DIRS
}
>
)
# Handles Python + pybind11 headers dependencies
target_link_libraries
(
${
module_name
}
PUBLIC
pybind11::pybind11
PRIVATE
${
PYTHON_LIBRARIES
}
)
Python::Python
)
endif
()
target_compile_features
(
${
module_name
}
PRIVATE cxx_std_14
)
...
...
This diff is collapsed.
Click to expand it.
cmake/PybindModuleCreation.cmake
+
7
−
4
View file @
ad03e782
...
...
@@ -9,12 +9,15 @@ function(generate_python_binding name target_to_bind)
GIT_TAG v2.10.4
# or a later release
)
# Use the New FindPython mode, recommanded. Requires CMake 3.15+
find_package
(
Python COMPONENTS Interpreter Development
)
FetchContent_MakeAvailable
(
PyBind11
)
message
(
STATUS
"Creating binding for module
${
name
}
"
)
file
(
GLOB_RECURSE pybind_src_files
"python_binding/*.cpp"
)
pybind11_add_module
(
${
name
}
MODULE
${
pybind_src_files
}
)
target_include_directories
(
${
name
}
PUBLIC
${
pybind
11_INCLUDE_DIRS
}
"python_binding"
)
target_
l
in
k_libra
ries
(
${
name
}
PUBLIC
${
target_to
_bind
}
)
pybind11_add_module
(
${
name
}
MODULE
${
pybind
_src_files
}
"NO_EXTRAS"
)
# NO EXTRA recquired for pip install
target_in
clude_directo
ries
(
${
name
}
PUBLIC
"python
_bind
ing"
)
target_link_libraries
(
${
name
}
PUBLIC
${
target_to_bind
}
)
endif
()
endfunction
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment