srcanamdw/codescanner/pyinstaller/Sconstruct
changeset 1 22878952f6e2
equal deleted inserted replaced
0:509e4801c378 1:22878952f6e2
       
     1 # Sconstruct file to build the bootloader
       
     2 # Copyright (C) 2005, Giovanni Bajo
       
     3 #
       
     4 # This program is free software; you can redistribute it and/or
       
     5 # modify it under the terms of the GNU General Public License
       
     6 # as published by the Free Software Foundation; either version 2
       
     7 # of the License, or (at your option) any later version.
       
     8 #
       
     9 # This program is distributed in the hope that it will be useful,
       
    10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 # GNU General Public License for more details.
       
    13 #
       
    14 # You should have received a copy of the GNU General Public License
       
    15 # along with this program; if not, write to the Free Software
       
    16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
       
    17 
       
    18 platform = Platform()
       
    19 envs = []
       
    20 
       
    21 if platform.name == "win32":
       
    22 
       
    23     # For Windows, we need generate several different versions of the bootloader:
       
    24     # - Either runtime-compatible with Visual Studio 6.0 or with Visual Studio 7.1
       
    25     #   (the former is used in all Python versions up to 2.3, the latter since
       
    26     #   Python 2.4).
       
    27     # - Either debug build (with debug messages) or release build.
       
    28     # - Either console program or windowed program.
       
    29     for msvs_ver in "6.0", "7.1":
       
    30         base_env = Environment(MSVS_VERSION = msvs_ver)
       
    31 
       
    32         for flavour in "debug", "release":
       
    33             for mode in "cons", "win":
       
    34                 env = base_env.Copy()
       
    35 
       
    36                 # The bootloader is built as a static executable. We want it
       
    37                 # to be self-contained. Extra care was put in writing it so
       
    38                 # that it does not share objects/memory with python.dll (which
       
    39                 # it loads).
       
    40                 env.Append(CCFLAGS = ["/ML"])
       
    41 
       
    42                 if flavour == "debug":
       
    43                     # No optimizations
       
    44                     env.Append(CCFLAGS = ["/Od"])
       
    45                     # Each object has its own pdb, so -jN works
       
    46                     env.Append(CCFLAGS = ["/Zi", "/Fd${TARGET}.pdb"])
       
    47                     env.Append(LINKFLAGS = ["/DEBUG"])
       
    48                 else:
       
    49                     # Use some sensible amount of optimizations
       
    50                     env.Append(CCFLAGS = ["/Ox", "/DNDEBUG"])
       
    51 
       
    52                 if mode == "cons":
       
    53                     env.Append(CPPDEFINES = ["_CONSOLE"])
       
    54 
       
    55                 env["PYINST_FLAVOUR"] = flavour
       
    56                 env["PYINST_MODE"] = mode
       
    57                 env["PYINST_SUFFIX"] = "%c%c%c" % (msvs_ver[0], flavour[0], mode[0])
       
    58 
       
    59                 env.Append(CPPDEFINES = ["WIN32"])
       
    60                 env.Append(LIBS = ["user32.lib", "comctl32.lib", "kernel32.lib", "ws2_32.lib"])
       
    61 
       
    62                 envs.append(env)
       
    63 
       
    64 for env in envs:
       
    65     run,dll = SConscript("source/SConscript", exports = ["env"],
       
    66                          build_dir = "build/" + env["PYINST_SUFFIX"],
       
    67                          duplicate = 0)
       
    68 
       
    69     env.InstallAs(target="support/loader/run_" + env["PYINST_SUFFIX"] + env["PROGSUFFIX"],
       
    70                   source=run)
       
    71     env.InstallAs(target="support/loader/inprocsrvr_" + env["PYINST_SUFFIX"] + env["SHLIBSUFFIX"],
       
    72                   source=dll[0])