Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
ef4b7a0e
Commit
ef4b7a0e
authored
Feb 12, 2018
by
Davis King
Browse files
Added -G option to setup.py that sets cmake's generator.
parent
52edc0d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
setup.py
setup.py
+10
-3
No files found.
setup.py
View file @
ef4b7a0e
...
@@ -21,7 +21,8 @@ To exclude/include certain options in the cmake config use --yes and --no:
...
@@ -21,7 +21,8 @@ To exclude/include certain options in the cmake config use --yes and --no:
--yes USE_AVX_INSTRUCTIONS: will set -DUSE_AVX_INSTRUCTIONS=yes
--yes USE_AVX_INSTRUCTIONS: will set -DUSE_AVX_INSTRUCTIONS=yes
--no USE_AVX_INSTRUCTIONS: will set -DUSE_AVX_INSTRUCTIONS=no
--no USE_AVX_INSTRUCTIONS: will set -DUSE_AVX_INSTRUCTIONS=no
Additional options:
Additional options:
--compiler-flags: pass flags onto the compiler, e.g. --compiler-flag "-Os -Wall" passes -Os -Wall onto GCC.
--compiler-flags: pass flags onto the compiler, e.g. --compiler-flags "-Os -Wall" passes -Os -Wall onto GCC.
-G: Set the CMake generator. E.g. -G "Visual Studio 14 2015"
--clean: delete any previous build folders and rebuild. You should do this if you change any build options
--clean: delete any previous build folders and rebuild. You should do this if you change any build options
by setting --compiler-flags or --yes or --no since last time you ran a build to make sure the changes
by setting --compiler-flags or --yes or --no since last time you ran a build to make sure the changes
take effect.
take effect.
...
@@ -42,7 +43,7 @@ from distutils.version import LooseVersion
...
@@ -42,7 +43,7 @@ from distutils.version import LooseVersion
def
get_extra_cmake_options
():
def
get_extra_cmake_options
():
"""read --clean, --yes, --no,
and
--compiler-flag options from the command line and add them as cmake switches.
"""read --clean, --yes, --no, --compiler-flag
s, and -G
options from the command line and add them as cmake switches.
"""
"""
_cmake_extra_options
=
[]
_cmake_extra_options
=
[]
_clean_build_folder
=
False
_clean_build_folder
=
False
...
@@ -51,9 +52,11 @@ def get_extra_cmake_options():
...
@@ -51,9 +52,11 @@ def get_extra_cmake_options():
argv
=
[
arg
for
arg
in
sys
.
argv
]
# take a copy
argv
=
[
arg
for
arg
in
sys
.
argv
]
# take a copy
# parse command line options and consume those we care about
# parse command line options and consume those we care about
for
opt_idx
,
arg
in
enumerate
(
argv
)
:
for
arg
in
argv
:
if
opt_key
==
'compiler-flags'
:
if
opt_key
==
'compiler-flags'
:
_cmake_extra_options
.
append
(
'-DCMAKE_CXX_FLAGS={arg}'
.
format
(
arg
=
arg
.
strip
()))
_cmake_extra_options
.
append
(
'-DCMAKE_CXX_FLAGS={arg}'
.
format
(
arg
=
arg
.
strip
()))
elif
opt_key
==
'G'
:
_cmake_extra_options
+=
[
'-G'
,
arg
.
strip
()]
elif
opt_key
==
'yes'
:
elif
opt_key
==
'yes'
:
_cmake_extra_options
.
append
(
'-D{arg}=yes'
.
format
(
arg
=
arg
.
strip
()))
_cmake_extra_options
.
append
(
'-D{arg}=yes'
.
format
(
arg
=
arg
.
strip
()))
elif
opt_key
==
'no'
:
elif
opt_key
==
'no'
:
...
@@ -73,6 +76,10 @@ def get_extra_cmake_options():
...
@@ -73,6 +76,10 @@ def get_extra_cmake_options():
opt_key
=
arg
[
2
:].
lower
()
opt_key
=
arg
[
2
:].
lower
()
sys
.
argv
.
remove
(
arg
)
sys
.
argv
.
remove
(
arg
)
continue
continue
if
arg
in
[
'-G'
]:
opt_key
=
arg
[
1
:]
sys
.
argv
.
remove
(
arg
)
continue
return
_cmake_extra_options
,
_clean_build_folder
return
_cmake_extra_options
,
_clean_build_folder
...
...
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