Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_backend_opencv
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_opencv
Commits
5d01126d
Commit
5d01126d
authored
11 months ago
by
Grégoire Kubler
Browse files
Options
Downloads
Patches
Plain Diff
feat : added alternate build backend option + rm copying version.txt into pkg
parent
b23b3d67
No related branches found
No related tags found
1 merge request
!13
Feat/release pip
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+13
-12
13 additions, 12 deletions
setup.py
with
13 additions
and
12 deletions
setup.py
+
13
−
12
View file @
5d01126d
...
@@ -13,8 +13,9 @@ import toml
...
@@ -13,8 +13,9 @@ import toml
from
setuptools
import
setup
,
Extension
from
setuptools
import
setup
,
Extension
from
setuptools.command.build_ext
import
build_ext
from
setuptools.command.build_ext
import
build_ext
def
get_project_name
()
->
str
:
def
get_project_name
()
->
str
:
with
open
(
pathlib
.
Path
().
absolute
()
/
"
pyproject.toml
"
,
"
r
"
)
as
file
:
with
open
(
pathlib
.
Path
().
absolute
()
/
"
pyproject.toml
"
,
"
r
"
)
as
file
:
project_toml
=
toml
.
load
(
file
)
project_toml
=
toml
.
load
(
file
)
return
project_toml
[
"
project
"
][
"
name
"
]
return
project_toml
[
"
project
"
][
"
name
"
]
...
@@ -23,8 +24,8 @@ class CMakeExtension(Extension):
...
@@ -23,8 +24,8 @@ class CMakeExtension(Extension):
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
super
().
__init__
(
name
,
sources
=
[])
super
().
__init__
(
name
,
sources
=
[])
class
CMakeBuild
(
build_ext
):
class
CMakeBuild
(
build_ext
):
def
run
(
self
):
def
run
(
self
):
# This lists the number of processors available on the machine
# This lists the number of processors available on the machine
# The compilation will use half of them
# The compilation will use half of them
...
@@ -52,24 +53,29 @@ class CMakeBuild(build_ext):
...
@@ -52,24 +53,29 @@ class CMakeBuild(build_ext):
else
os
.
environ
[
"
AIDGE_PYTHON_BUILD_TYPE
"
]
else
os
.
environ
[
"
AIDGE_PYTHON_BUILD_TYPE
"
]
)
)
# Impose to use the executable of the python
# used to launch setup.py to setup PythonInterp
install_path
=
(
install_path
=
(
os
.
path
.
join
(
sys
.
prefix
,
"
lib
"
,
"
libAidge
"
)
os
.
path
.
join
(
sys
.
prefix
,
"
lib
"
,
"
libAidge
"
)
if
"
AIDGE_INSTALL
"
not
in
os
.
environ
if
"
AIDGE_INSTALL
"
not
in
os
.
environ
else
os
.
environ
[
"
AIDGE_INSTALL
"
]
else
os
.
environ
[
"
AIDGE_INSTALL
"
]
)
)
build_gen
=
(
[
"
-G
"
,
os
.
environ
[
"
AIDGE_BUILD_GEN
"
]]
if
"
AIDGE_BUILD_GEN
"
in
os
.
environ
else
[]
)
self
.
spawn
(
self
.
spawn
(
[
[
"
cmake
"
,
"
cmake
"
,
*
build_gen
,
str
(
cwd
),
str
(
cwd
),
f
"
-DPYTHON_EXECUTABLE=
{
sys
.
executable
}
"
,
"
-DTEST=OFF
"
,
"
-DTEST=OFF
"
,
f
"
-DCMAKE_INSTALL_PREFIX:PATH=
{
install_path
}
"
,
f
"
-DCMAKE_INSTALL_PREFIX:PATH=
{
install_path
}
"
,
f
"
-DCMAKE_BUILD_TYPE=
{
compile_type
}
"
,
f
"
-DCMAKE_BUILD_TYPE=
{
compile_type
}
"
,
"
-DPYBIND=ON
"
,
"
-DPYBIND=ON
"
,
"
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
"
,
"
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
"
,
"
-DCOVERAGE=OFF
"
"
-DCOVERAGE=OFF
"
,
]
]
)
)
...
@@ -94,13 +100,8 @@ class CMakeBuild(build_ext):
...
@@ -94,13 +100,8 @@ class CMakeBuild(build_ext):
currentFile
=
os
.
path
.
join
(
root
,
file
)
currentFile
=
os
.
path
.
join
(
root
,
file
)
shutil
.
copy
(
currentFile
,
str
(
aidge_package
.
absolute
()))
shutil
.
copy
(
currentFile
,
str
(
aidge_package
.
absolute
()))
# Copy version.txt in aidge_package
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
shutil
.
copy
(
"
version.txt
"
,
str
(
aidge_package
.
absolute
()))
if
__name__
==
'
__main__
'
:
if
__name__
==
"
__main__
"
:
setup
(
setup
(
include_package_data
=
True
,
include_package_data
=
True
,
ext_modules
=
[
CMakeExtension
(
get_project_name
())],
ext_modules
=
[
CMakeExtension
(
get_project_name
())],
...
...
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