Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Galaxies
LEPHARE
Commits
82fec745
Commit
82fec745
authored
May 11, 2022
by
Johann Cohen-Tanugi
Browse files
add a custom doc building and the install step for th C++ executables
parent
4e879301
Changes
1
Hide whitespace changes
Inline
Side-by-side
setup.py
View file @
82fec745
...
...
@@ -70,6 +70,7 @@ import subprocess
from
distutils.version
import
LooseVersion
from
setuptools
import
setup
,
Extension
,
find_packages
from
setuptools.command.build_ext
import
build_ext
from
setuptools
import
Command
import
pathlib
here
=
pathlib
.
Path
(
__file__
).
parent
.
resolve
()
...
...
@@ -104,7 +105,8 @@ class CMakeBuild(build_ext):
def
build_extension
(
self
,
ext
):
extdir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
self
.
get_ext_fullpath
(
ext
.
name
)))
cmake_args
=
[
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY='
+
extdir
,
cmake_args
=
[
'-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}'
,
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY='
+
extdir
,
'-DPYTHON_EXECUTABLE='
+
sys
.
executable
]
cfg
=
'Debug'
if
self
.
debug
else
'Release'
...
...
@@ -131,8 +133,19 @@ class CMakeBuild(build_ext):
cwd
=
self
.
build_temp
,
env
=
env
)
subprocess
.
check_call
([
'cmake'
,
'--build'
,
'.'
]
+
build_args
,
cwd
=
self
.
build_temp
)
subprocess
.
check_call
([
'cmake'
,
'--install'
,
'.'
],
cwd
=
self
.
build_temp
)
print
()
# Add an empty line for cleaner output
class
MakeDoc
(
Command
):
user_options
=
[]
def
initialize_options
(
self
):
pass
def
finalize_options
(
self
):
pass
def
run
(
self
):
cmd
=
"doxygen Doxyfile"
subprocess
.
check_call
([
'doxygen'
,
'Doxyfile'
],
cwd
=
'doc'
)
setup
(
name
=
'lephare'
,
...
...
@@ -148,9 +161,9 @@ setup(
ext_modules
=
[
CMakeExtension
(
'lephare._lephare'
)],
include_package_data
=
True
,
# add custom build_ext command
cmdclass
=
dict
(
build_ext
=
CMakeBuild
),
cmdclass
=
dict
(
build_ext
=
CMakeBuild
,
doc
=
MakeDoc
),
zip_safe
=
False
,
python_requires
=
">=3.8"
,
extras_require
=
{
"test"
:
"pytest"
}
extras_require
=
{
"test"
:
"pytest"
}
,
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment