Skip to content

Commit

Permalink
python3 win32 improvements:
Browse files Browse the repository at this point in the history
* generalize "optimize" as a pkgconfig keyword
* move "win32_include_dir" where it is used

git-svn-id: https://xpra.org/svn/Xpra/trunk@6214 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 28, 2014
1 parent 8c830f2 commit 1f317a1
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ def pkgconfig(*pkgs_options, **ekw):
#add_to_keywords(kw, 'include_dirs', '.')
if verbose_ENABLED:
print("pkgconfig(%s,%s)=%s" % (pkgs_options, ekw, kw))
if ekw.get("optimize"):
del ekw["optimize"]
add_to_keywords(kw, 'extra_compile_args', "-O3")
return kw


Expand Down Expand Up @@ -761,10 +764,6 @@ def glob_recurse(srcdir):
#but until someone figures this out, the ugly path code below works
#as long as you install in the same place or tweak the paths.

#first some header crap so codecs can find the inttypes.h
#and stdint.h:
win32_include_dir = os.path.join(os.getcwd(), "win32")

#ffmpeg is needed for both swscale and x264:
libffmpeg_path = None
if dec_avcodec_ENABLED:
Expand Down Expand Up @@ -856,13 +855,16 @@ def checkdirs(*dirs):
if not os.path.exists(d) or not os.path.isdir(d):
raise Exception("cannot find a directory which is required for building: %s" % d)

#hard-coded pkgconfig replacement for visual studio:
def pkgconfig(*pkgs_options, **ekw):
kw = dict(ekw)
#remove static flag on win32..
static = kw.get("static", None)
if static is not None:
del kw["static"]
#always add the win32 include dirs, everyone needs that:
#always add the win32 include dirs for VC,
#so codecs can find the inttypes.h and stdint.h:
win32_include_dir = os.path.join(os.getcwd(), "win32")
add_to_keywords(kw, 'include_dirs', win32_include_dir)
if len(pkgs_options)==0:
return kw
Expand Down Expand Up @@ -951,6 +953,9 @@ def add_to_PATH(*bindirs):
add_to_keywords(kw, 'extra_compile_args', flag)
add_to_keywords(kw, 'extra_link_args', "/DEBUG")
kw['cython_gdb'] = True
if ekw.get("optimize"):
del ekw["optimize"]
add_to_keywords(kw, 'extra_compile_args', "/Ox")
print("pkgconfig(%s,%s)=%s" % (pkgs_options, ekw, kw))
return kw

Expand Down Expand Up @@ -1350,25 +1355,15 @@ def cython_add(*args, **kwargs):

toggle_packages(rencode_ENABLED, "xpra.net.rencode")
if rencode_ENABLED:
rencode_pkgconfig = pkgconfig()
if not debug_ENABLED:
if WIN32:
add_to_keywords(rencode_pkgconfig, 'extra_compile_args', "/Ox")
else:
add_to_keywords(rencode_pkgconfig, 'extra_compile_args', "-O3")
rencode_pkgconfig = pkgconfig(optimize=not debug_ENABLED)
cython_add(Extension("xpra.net.rencode.rencode",
["xpra/net/rencode/rencode.pyx"],
**rencode_pkgconfig))


toggle_packages(bencode_ENABLED, "xpra.net.bencode")
if cython_bencode_ENABLED:
bencode_pkgconfig = pkgconfig()
if not debug_ENABLED:
if WIN32:
add_to_keywords(bencode_pkgconfig, 'extra_compile_args', "/Ox")
else:
add_to_keywords(bencode_pkgconfig, 'extra_compile_args', "-O3")
bencode_pkgconfig = pkgconfig(optimize=not debug_ENABLED)
cython_add(Extension("xpra.net.bencode.cython_bencode",
["xpra/net/bencode/cython_bencode.pyx"],
**bencode_pkgconfig))
Expand Down

0 comments on commit 1f317a1

Please sign in to comment.