[pytango] 260/483: add scripts to help compile boost-python on windows

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit 9728ac076a39cf43fc4805a46794acde558c0436
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Sun May 19 20:48:10 2013 +0000

    add scripts to help compile boost-python on windows
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@22689 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 doc/_static/boost_python_install.py | 155 ++++++++++++++++++++++++++++++++++++
 doc/_static/project-config.jam      |  19 +++++
 2 files changed, 174 insertions(+)

diff --git a/doc/_static/boost_python_install.py b/doc/_static/boost_python_install.py
new file mode 100644
index 0000000..893dd43
--- /dev/null
+++ b/doc/_static/boost_python_install.py
@@ -0,0 +1,155 @@
+from __future__ import print_function
+
+"""
+*build boost python script on windows*
+
+Purpose
+    Build boost-python on multiple architectures (32 and 64bits), with different toolsets (vc9, vc10),
+    using different python versions.
+    The different versions of boost-python DLL files are placed in a directory structure preventing
+    overlapping between the different versions.
+    
+    PyTango Visual Studio solution configuration is compatible with the output of this script.
+    
+How to use it
+    This script should be used together with another boost configuration file called user-config.jam.
+    
+    - Download boost source code from http://wwww.boost.org
+    - Extract boost to a directory (ex: c:\workspace\boost-1.53.0)
+    - Place this file in your boost extract directory (ex: c:\workspace\boost-1.53.0\boost_python_install.py)
+    - Place the user-config.jam file in %HOMEPATH%%HOMEDIR%
+    - Open a console
+    - Switch to the boost directory 
+    - Execute this script using python (ex: C:\Python\win32\26\python.exe boost_python_install.py
+"""
+# b2 --with-python --prefix=c:\boost-1.53.0 
+#    --libdir=c:\boost-1.53.0\msvc-9.0\Win32\release\shared\threading-multi\26
+#    toolset=msvc-9.0 address-model=32 variant=release link=shared
+#    threading=multi python=2.6 install
+
+import os
+import sys
+import pprint
+import subprocess
+
+boost_version = r"1.53.0"
+toolsets = r"msvc-9.0", r"msvc-10.0",
+address_models = ("32", "Win32"), ("64", "x64"),
+variants = "release", 
+links = "shared", "static",
+runtime_links = ("shared", "runtime_shared"), ("static", "runtime_static"),
+threadings = "multi",
+
+pythons = "2.6", "2.7", "3.1", "3.2", "3.3",
+
+cpus = 8
+silent = True
+debug_config = False
+simulation = False
+stage = "install"
+
+DIV = 80*"="
+
+# -----------------------
+# overwrite defaults HERE
+# -----------------------
+cpus = 4
+
+def to_name_and_dir(key):
+    if isinstance(key, (str, unicode)):
+        key = key, key
+    return key
+
+def main():
+    try:
+        _main()
+    except KeyboardInterrupt:
+        print("\nStopped by user")
+
+def _main():
+    global toolsets, pythons
+
+    toolsets = r"msvc-9.0",
+    pythons = "2.6", "2.7", "3.2", "3.3"   
+    compile()
+    
+    toolsets = r"msvc-10.0",
+    pythons = "3.3",    
+    compile()
+        
+def compile():
+    cur_dir = os.path.abspath(os.path.curdir)
+    
+    prefix = r"c:\boost-" + boost_version
+    build_prefix = os.path.join(prefix, "build")
+    
+    silent_args = ""
+    if silent:
+        silent_args = "-q -d0"
+    
+    debug_config_args = ""
+    if debug_config:
+        debug_config_args = "--debug-configuration"
+    
+    base_cmd_line = "b2 -j{cpus} {silent} {debug_config} --with-python --build-dir={{build-dir}}".format(cpus=cpus, silent=silent_args, debug_config=debug_config_args)
+    options = "prefix", "libdir", "includedir"
+    properties = "toolset", "address-model", "variant", "link", "runtime-link", "threading", "python"
+    
+    cmd_line_template = base_cmd_line
+    for option in options:
+        cmd_line_template += " --{0}={{{1}}}".format(option, option)
+    for property in properties:
+        cmd_line_template += " {0}={{{1}}}".format(property, property)
+    
+    cmd_line_template += " {0}".format(stage)
+    fh = open("NUL", "w")
+    kwargs = { "prefix" : prefix }
+    for toolset in toolsets:
+        kwargs["toolset"], toolset_dir = to_name_and_dir(toolset)
+        for address_model in address_models:
+            kwargs["address-model"], address_model_dir = to_name_and_dir(address_model)
+            for variant in variants:
+                kwargs["variant"], variant_dir = to_name_and_dir(variant)
+                for link in links:
+                    link, link_dir = to_name_and_dir(link)
+                    kwargs["link"] = link
+                    for runtime_link in runtime_links:
+                        runtime_link, runtime_link_dir = to_name_and_dir(runtime_link)
+                        kwargs["runtime-link"] = runtime_link
+                        # Skip invalid compiler option
+                        if link == "shared" and runtime_link == "static":
+                            print("--> Skipping invalid compile option link=shared runtime_link=static <--")
+                            continue
+                        for threading in threadings:
+                            kwargs["threading"], threading_dir = to_name_and_dir(threading)
+                            for python in pythons:
+                                kwargs["python"], python_dir = to_name_and_dir(python)
+                                info = " ".join([ "{0}={1}".format(k, v) for k, v in kwargs.items() if k in properties ])
+                                python_dir = python_dir.replace(".", "")
+                                
+                                lib_dir = prefix, threading_dir, variant_dir, toolset_dir, address_model_dir, link_dir, runtime_link_dir, python_dir
+                                lib_dir = os.path.join(*lib_dir)
+                                kwargs["libdir"] = lib_dir
+                                
+                                include_dir = os.path.join(prefix, "include")
+                                kwargs["includedir"] = include_dir
+                                
+                                kwargs["build-dir"] = prefix
+                                
+                                cmd_line = cmd_line_template.format(**kwargs)
+                                args = cmd_line.split()
+
+                                print("Running {0}... ".format(info), end='')
+                                ret = 0
+                                if not simulation:
+                                    p = subprocess.Popen(args, stdout=fh, stderr=fh)
+                                    ret = p.wait()
+                                if ret == 0:
+                                    print("[OK]")
+                                else:
+                                    print("[FAILED]")
+                                    print("\t" + cmd_line)
+    fh.close()
+    
+if __name__ == "__main__":
+    main()
\ No newline at end of file
diff --git a/doc/_static/project-config.jam b/doc/_static/project-config.jam
new file mode 100644
index 0000000..1a2723d
--- /dev/null
+++ b/doc/_static/project-config.jam
@@ -0,0 +1,19 @@
+import option ; 
+ 
+using msvc : 9.0 : "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/cl.exe" ; 
+using msvc : 10.0 : "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe" ; 
+
+using python : 2.6 : "C:/Python/win32/26" : : : <address-model>32 <python>2.6 ;
+using python : 2.6 : "C:/Python/x64/26" : : : <address-model>64 <python>2.6 ;
+
+using python : 2.7 : "C:/Python/win32/27" : : : <address-model>32 <python>2.7 ;
+using python : 2.7 : "C:/Python/x64/27" : : : <address-model>64 <python>2.7 ;
+
+using python : 3.2 : "C:/Python/win32/32" : : : <address-model>32 <python>3.2 ;
+using python : 3.2 : "C:/Python/x64/32" : : : <address-model>64 <python>3.2 ;
+
+using python : 3.3 : "C:/Python/win32/33" : : : <address-model>32 <python>3.3 ;
+using python : 3.3 : "C:/Python/x64/33" : : : <address-model>64 <python>3.3 ;
+ 
+option.set keep-going : false ; 
+ 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list