Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ar_sandbox_python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AR_Sandbox
ar_sandbox_python
Commits
3e390bb1
Commit
3e390bb1
authored
1 month ago
by
Alexis Durgnat
Browse files
Options
Downloads
Plain Diff
Merge branch 'QL-devel' into 'main'
Update of install process See merge request
!1
parents
494cf1d8
f1415dc3
Branches
Branches containing commit
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+81
-11
81 additions, 11 deletions
CMakeLists.txt
cpp/Makefile.valid
+24
-0
24 additions, 0 deletions
cpp/Makefile.valid
with
105 additions
and
11 deletions
CMakeLists.txt
+
81
−
11
View file @
3e390bb1
cmake_minimum_required
(
VERSION
2.8
.1
2
)
cmake_minimum_required
(
VERSION
3
.1
)
project
(
sandbox_wrapper
)
project
(
sandbox_wrapper
)
set
(
LIBNAME
"sandbox_wrapper"
)
set
(
LIB_MINOR_VERS
"0.0"
)
set
(
LIB_MAJOR_VERS
"1"
)
set
(
LIB_VERS
"
${
LIB_MAJOR_VERS
}
.
${
LIB_MINOR_VERS
}
"
)
set
(
LIB_FULL_NAME
"
${
LIBNAME
}
.so.
${
LIB_VERS
}
"
)
set
(
LIBSANDBOX_DIR
""
CACHE PATH
"Path to LIBSANDBOX Directory"
)
set
(
BUILD_DIR
""
CACHE PATH
"Path in the LIBSANDBOX Directory for the built .so file"
)
if
(
NOT LIBSANDBOX_DIR
)
message
(
FATAL_ERROR
"LIBSANDBOX Directory must be passed with -DLIBSANDBOX_DIR=..."
)
endif
()
if
(
NOT BUILD_DIR
)
message
(
FATAL_ERROR
"BUILD_DIR Directory must be passed with -DBUILD_DIR=..."
)
endif
()
set
(
BUILD_DIR
"
${
LIBSANDBOX_DIR
}${
BUILD_DIR
}
"
)
message
(
STATUS
"LIBSANDBOX located at:
${
LIBSANDBOX_DIR
}
"
)
message
(
STATUS
"Build of LIBSANDBOX located at
${
BUILD_DIR
}
"
)
find_package
(
OpenCV REQUIRED
)
find_package
(
OpenCV REQUIRED
)
include_directories
(
${
OpenCV_INCLUDE_DIRS
}
)
include_directories
(
inc
${
OpenCV_INCLUDE_DIRS
}
)
include_directories
(
/usr/include/x86_64-linux-gnu/python3.6m
)
include_directories
(
/usr/include/python3.6m
)
find_package
(
realsense2 REQUIRED
)
include_directories
(
/home/frog/Prog/Projects/Sandbox/lib/ar_sandbox_lib/inc
)
include_directories
(
inc
${
realsense_INCLUDE_DIR
}
)
find_package
(
yaml-cpp REQUIRED
)
include_directories
(
inc
${
YAML_CPP_INCLUDE_DIRS
}
)
find_package
(
Python3 REQUIRED COMPONENTS Interpreter Development
)
include_directories
(
inc
${
Python3_INCLUDE_DIRS
}
)
include_directories
(
inc
${
LIBSANDBOX_DIR
}
/inc
)
set
(
PYBIND11_FINDPYTHON ON
)
find_package
(
pybind11 CONFIG REQUIRED
)
include_directories
(
inc
${
pybind11_INCLUDE_DIR
}
)
# pybind11_add_module(sandbox_wrapper cpp/sandbox_wrapper.cpp)
file
(
GLOB_RECURSE SOURCES
cpp/*.cpp
)
add_library
(
${
LIBNAME
}
SHARED
${
SOURCES
}
)
set_target_properties
(
${
LIBNAME
}
PROPERTIES OUTPUT_NAME
${
LIBNAME
}
VERSION
${
LIB_VERS
}
SOVERSION
${
LIB_MAJOR_VERS
}
)
target_link_libraries
(
${
LIBNAME
}
${
OpenCV_LIBS
}
)
target_link_libraries
(
${
LIBNAME
}
${
realsense_LIBS
}
)
target_link_libraries
(
${
LIBNAME
}
-lrealsense2
)
target_link_libraries
(
${
LIBNAME
}
${
YAML_CPP_LIBRARIES
}
)
target_link_libraries
(
${
LIBNAME
}
-lyaml-cpp
)
include_directories
(
${
LIBNAME
}
${
BUILD_DIR
}
)
target_link_libraries
(
${
LIBNAME
}
"
${
BUILD_DIR
}
/libsandbox.so.1.0.0"
)
target_compile_options
(
${
LIBNAME
}
PRIVATE
-std=c++11
# Utilisation de C++11
-Wall
# Affichage des avertissements classiques
-Wextra
# Avertissements supplémentaires
-g
# Ajout des symboles de debug
-fPIC
# Position Indépendante du Code (obligatoire pour les bibliothèques partagées)
-Ilib
)
# Création des liens symboliques après la compilation
add_custom_command
(
TARGET
${
LIBNAME
}
POST_BUILD
WORKING_DIRECTORY
${
CMAKE_LIBRARY_OUTPUT_DIRECTORY
}
COMMENT
"Copie de
${
LIB_FULL_NAME
}
dans src/ar_sandbox/wrapper"
COMMAND
${
CMAKE_COMMAND
}
ARGS -E copy
"lib
${
LIB_FULL_NAME
}
"
../src/ar_sandbox/wrapper/
"
${
LIBNAME
}
.so"
)
include_directories
(
/usr/local/lib/python3.6/dist-packages/pybind11/share/cmake/pybind11
)
add_custom_command
(
TARGET
${
LIBNAME
}
POST_BUILD
find_package
(
pybind11 REQUIRED
)
WORKING_DIRECTORY
${
CMAKE_LIBRARY_OUTPUT_DIRECTORY
}
pybind11_add_module
(
sandbox_wrapper ./cpp/sandbox_wrapper.cpp
)
COMMENT
"Création du module Python dans le répertoire dist/"
COMMAND python -m build ..
# Création du module python en prenant en compte que cmake est exécuté dans un répertoir build situé à la racine du projet.
)
include_directories
(
/home/frog/Prog/Projects/Sandbox/lib/ar_sandbox_lib/build/
)
# Installation de la bibliothèque et des fichiers d'en-tête
target_link_libraries
(
sandbox_wrapper PRIVATE
${
OpenCV_LIBS
}
)
install
(
TARGETS
${
LIBNAME
}
DESTINATION lib
)
target_link_libraries
(
sandbox_wrapper PRIVATE /home/frog/Prog/Projects/Sandbox/lib/ar_sandbox_lib/build/libsandbox.so.1.0.0 -lrealsense2 -lyaml-cpp
)
install
(
DIRECTORY inc/ DESTINATION include
)
This diff is collapsed.
Click to expand it.
cpp/Makefile.valid
0 → 100644
+
24
−
0
View file @
3e390bb1
OPENCVFLAG
=
`
pkg-config
--libs
--cflags
opencv3
`
CAMERAFLAG
=
-lrealsense2
YAMLFLAG
=
-I
/usr/local/include
-L
/usr/local/lib
-lyaml-cpp
DEP_SANDBOX
=
$(
OPENCVFLAG
)
$(
CAMERAFLAG
)
$(
YAMLFLAG
)
SANDBOX
=
-I
/home/quentin/Documents/HEPIA/ar_sandbox_lib/inc
-L
/home/quentin/Documents/HEPIA/ar_sandbox_lib/build_test/lib
-lsandbox
CFLAGS
=
-std
=
c++11
-Wall
-Wextra
-g
-Ilib
-fPIC
WRAPPER_NAME
=
sandbox_wrapper.so
all
:
sandbox_wrapper.so
sandbox_wrapper
:
sandbox_wrapper.o
c++
-o
$@
$^
$(
shell python3-config
--libs
)
$(
CFLAGS
)
$(
SANDBOX
)
$(
DEP_SANDBOX
)
$(
LDFLAGS
)
sandbox_wrapper.so
:
sandbox_wrapper.o
c++
-O3
-shared
$(
CFLAGS
)
$(
shell python3
-m
pybind11
--includes
)
$^
-o
$(
WRAPPER_NAME
)$(
python3-config
--extension-suffix
)
$(
DEP_SANDBOX
)
$(
SANDBOX
)
sandbox_wrapper.o
:
sandbox_wrapper.cpp
c++
-c
$^
-o
$@
-I
/usr/include/python3.13
$(
python3
-m
pybind11
--includes
)
$(
CFLAGS
)
$(
SANDBOX
)
$(
DEP_SANDBOX
)
clean
:
rm
*
.so
*
.o
\ No newline at end of file
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