Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
bbfae950
Commit
bbfae950
authored
Aug 20, 2015
by
Ehsan Azarnasab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up options
parent
03c0ccb9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
26 deletions
+40
-26
setup.py
tools/python/setup.py
+40
-26
No files found.
tools/python/setup.py
View file @
bbfae950
...
...
@@ -35,7 +35,7 @@ from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
from
setuptools.command.develop
import
develop
as
_develop
from
distutils.command.build_ext
import
build_ext
as
_build_ext
from
distutils.command.build
import
build
as
_build
from
distutils.errors
import
Distutils
OptionError
,
Distutils
SetupError
from
distutils.errors
import
DistutilsSetupError
from
distutils.spawn
import
find_executable
from
distutils
import
log
import
os
...
...
@@ -58,54 +58,68 @@ if os.path.dirname(this_file):
os
.
chdir
(
os
.
path
.
dirname
(
this_file
))
script_dir
=
os
.
getcwd
()
cmake_path
=
find_executable
(
"cmake"
)
cmake_extra
=
[]
cmake_config
=
'Release'
options
=
[]
for
arg
in
sys
.
argv
:
if
arg
.
startswith
(
'--'
):
sys
.
argv
.
remove
(
arg
)
options
.
append
(
arg
[
2
:]
.
lower
())
def
_get_options
():
"""read arguments and creates options
"""
_cmake_path
=
find_executable
(
"cmake"
)
_cmake_extra
=
[]
_cmake_config
=
'Release'
_options
=
[]
opt_key
=
None
opt_key
=
None
# parse commandline options
for
opt_idx
,
opt
in
enumerate
(
options
):
# parse commandline options and consume those we care about
for
opt_idx
,
arg
in
enumerate
(
sys
.
argv
):
if
not
arg
.
startswith
(
'--'
):
continue
opt
=
arg
[
2
:]
.
lower
()
if
opt_key
==
'cmake'
:
cmake_path
=
opt
_
cmake_path
=
opt
if
opt_key
:
sys
.
argv
.
remove
(
arg
)
continue
if
opt
==
'cmake'
:
cmake_path
=
None
_
cmake_path
=
None
opt_key
=
opt
sys
.
argv
.
remove
(
arg
)
continue
opt_key
=
None
custom_arg
=
True
if
opt
==
'debug'
:
cmake_config
=
'Debug'
_
cmake_config
=
'Debug'
elif
opt
==
'release'
:
cmake_config
=
'Release'
_
cmake_config
=
'Release'
elif
opt
==
'no-gui-support'
:
cmake_extra
.
append
(
'-DDLIB_NO_GUI_SUPPORT=yes'
)
_
cmake_extra
.
append
(
'-DDLIB_NO_GUI_SUPPORT=yes'
)
elif
opt
==
'enable-stack-trace'
:
cmake_extra
.
append
(
'-DDLIB_ENABLE_STACK_TRACE=yes'
)
_
cmake_extra
.
append
(
'-DDLIB_ENABLE_STACK_TRACE=yes'
)
elif
opt
==
'enable-asserts'
:
cmake_extra
.
append
(
'-DDLIB_ENABLE_ASSERTS=yes'
)
_
cmake_extra
.
append
(
'-DDLIB_ENABLE_ASSERTS=yes'
)
elif
opt
==
'no-blas'
:
cmake_extra
.
append
(
'-DDLIB_USE_BLAS=no'
)
_
cmake_extra
.
append
(
'-DDLIB_USE_BLAS=no'
)
elif
opt
==
'no-lapack'
:
cmake_extra
.
append
(
'-DDLIB_USE_LAPACK=no'
)
_
cmake_extra
.
append
(
'-DDLIB_USE_LAPACK=no'
)
elif
opt
==
'no-libpng'
:
cmake_extra
.
append
(
'-DDLIB_LINK_WITH_LIBPNG=no'
)
_
cmake_extra
.
append
(
'-DDLIB_LINK_WITH_LIBPNG=no'
)
elif
opt
==
'no-libjpeg'
:
cmake_extra
.
append
(
'-DDLIB_LINK_WITH_LIBJPEG=no'
)
_
cmake_extra
.
append
(
'-DDLIB_LINK_WITH_LIBJPEG=no'
)
elif
opt
==
'no-sqlite3'
:
cmake_extra
.
append
(
'-DDLIB_LINK_WITH_SQLITE3=no'
)
elif
opt
no
t
in
[
'debug'
,
'release'
,
_
cmake_extra
.
append
(
'-DDLIB_LINK_WITH_SQLITE3=no'
)
elif
op
t
in
[
'debug'
,
'release'
,
'repackage'
]:
raise
DistutilsOptionError
(
"Unrecognized option {opt}"
.
format
(
opt
=
opt
))
_options
.
append
(
opt
)
else
:
custom_arg
=
False
if
custom_arg
:
sys
.
argv
.
remove
(
arg
)
return
_options
,
_cmake_config
,
_cmake_path
,
_cmake_extra
options
,
cmake_config
,
cmake_path
,
cmake_extra
=
_get_options
()
if
cmake_path
is
None
:
raise
DistutilsSetupError
(
"Cannot find cmake in the path. Please specify its path with --cmake parameter."
)
...
...
Write
Preview
Markdown
is supported
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