Exemplo n.º 1
0
def sip_makefile(sipfile, output):
    module = os.path.basename(sipfile[:-4])
    # The name of the SIP build file generated by SIP and used by the build
    # system.
    build_file = "%s/%s.sbf" % (output, module)

    # Get the SIP configuration information.
    config = sipconfig.Configuration()

    # compiler sip
    os.system(" ".join([config.sip_bin, "-c", output, sipfile]))

    # Run SIP to generate the code.
    os.system(" ".join(
        [config.sip_bin, "-c", output, "-b", build_file, sipfile]))

    # Create the Makefile.
    makefile = sipconfig.SIPModuleMakefile(config, build_file)

    # Add the library we are wrapping.  The name doesn't include any platform
    # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
    # ".dll" extension on Windows).
    makefile.extra_libs = [module, 'aws', 'pthread', 'm']
    makefile.extra_lib_dirs = [output]
    makefile.extra_defines = []
    makefile.extra_cflags = ['--std=gnu99', '-I$(LUA)/pyas']
    makefile.extra_cxxflags = ['-I$(LUA)/pyas']
    if (os.name == 'nt'):
        makefile.extra_libs.append('PCANBasic')
        makefile.extra_libs.append('pyas')
        makefile.extra_libs.append('wsock32')
    # Generate the Makefile itself.
    makefile.generate()
Exemplo n.º 2
0
def main():
    #
    # Parse the command line options specified by the user.
    #
    parser = create_options_parser()
    (options, arguments) = parser.parse_args()
    #
    # The name of the build file generated by SIP and used by the
    # build system.
    #
    build_file = "libserial.sbf"
    logging.info("Build file is " + build_file)
    #
    # Get the configuration information for the local SIP installation.
    #
    logging.info("Reading sip configuration.")
    config = sipconfig.Configuration()
    config.qt_framework = None
    #
    # Construct and run SIP to generate the module's C++ code.
    #
    sip_command = " ".join(
        [config.sip_bin, "-c", ".", "-e", "-b", build_file, "libserial.sip"])
    logging.info("Running sip command: '" + sip_command + "'")
    os.system(sip_command)
    #
    # Create the Makefile with threading support as the libserial libraries
    # use threads implicitly.
    #
    makefile = sipconfig.SIPModuleMakefile(config,
                                           build_file=build_file,
                                           threaded=1,
                                           makefile="Makefile.sip")
    #
    # Add the library we are wrapping.  The name doesn't include any platform
    # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
    # ".dll" extension on Windows).
    #
    makefile.extra_include_dirs = ["../src"]
    makefile.extra_lib_dirs = ["../src/.libs"]
    makefile.extra_libs = ["serial"]
    #
    # Generate the Makefile itself.
    #
    makefile.generate()
Exemplo n.º 3
0
def main():
    args = parse_args()

    # SIP build file generated by SIP and used by the build system.
    build_file = "sip/word.sbf"
    # SIP specification file created by us.
    spec_file = "sip/word.sip"
    # stub file for python type hints
    stub_file = "generated/word.pyi"

    # Get the SIP configuration information.
    config = sipconfig.Configuration()

    options = [
        "-c",
        "generated",  # name of the directory into which all of the generated C++ code is placed
        "-b",
        build_file,  # name of the build file to generate
        "-e",  # support for C++ exceptions is enabled
        "-g",  # The Python GIL is released before making any calls to the C/C++ library being wrapped and reacquired afterwards
    ]
    if args.pyi:
        options = options + ["-y", stub_file]
    options_str = " ".join(options)
    cmd = " ".join([config.sip_bin, options_str, spec_file])
    # Execute the command in a subshell
    os.system(cmd)

    makefile = sipconfig.SIPModuleMakefile(config,
                                           build_file,
                                           makefile="generated/Makefile")

    # Add the library we are wrapping. The name doesn't include any platform
    # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
    # ".dll" extension on Windows).
    makefile.extra_libs = ["word"]

    # Generate the Makefile itself.
    makefile.generate()
def sip_makefile(module):
    # The name of the SIP build file generated by SIP and used by the build
    # system.
    build_file = "%s.sbf"%(module)
    
    # Get the SIP configuration information.
    config = sipconfig.Configuration()
    
    # Run SIP to generate the code.
    os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "%s.sip"%(module)]))
    
    # Create the Makefile.
    makefile = sipconfig.SIPModuleMakefile(config, build_file)
    
    # Add the library we are wrapping.  The name doesn't include any platform
    # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
    # ".dll" extension on Windows).
    makefile.extra_libs = [module]
    makefile.extra_lib_dirs = ['.']
    makefile.extra_defines  = ['DYNAMIC_XLDRIVER_DLL','POINTER_32=']
    makefile.extra_cflags = ['--std=gnu99']
    # Generate the Makefile itself.
    makefile.generate()
Exemplo n.º 5
0
def gen_makefile():
    # Get the SIP configuration information.
    config = sipconfig.Configuration()

    run_sip(config)

    # Create the Makefile in src.
    makefile = sipconfig.SIPModuleMakefile(config,
                                           build_file,
                                           dir=str(SIP_DIR))

    # Add the library we are wrapping.  The name doesn't include any platform
    # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
    # ".dll" extension on Windows).
    makefile.extra_libs = []
    makefile.extra_cxxflags = wxpyconfig.cxxflags
    makefile.extra_lflags = wxpyconfig.lflags

    # Generate the Makefile itself.
    makefile.generate()

    # Create the parent makefile
    root_make = sipconfig.ParentMakefile(config, subdirs=[SIP_DIR])
    root_make.generate()
Exemplo n.º 6
0
# We are going to install the SIP specification file for this module and
# its configuration module.
installs = []

installs.append(
    ["qtermwidget.sip",
     os.path.join(config.default_sip_dir, "qtermwidget5")])

installs.append(["qtermwidgetconfig.py", config.default_mod_dir])

# Create the Makefile.  The QtModuleMakefile class provided by the
# pyqtconfig module takes care of all the extra preprocessor, compiler and
# linker flags needed by the Qt library.
makefile = sipconfig.SIPModuleMakefile(configuration=config,
                                       build_file=build_file,
                                       installs=installs)

# Add the library we are wrapping.  The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_lib_dirs.append("..")
makefile.extra_libs = ["qtermwidget5", "Qt5Core", "Qt5Gui", "Qt5Widgets"]

makefile.extra_include_dirs.append("/usr/include/qt5")
makefile.extra_include_dirs.append("/usr/include/qt5/QtCore")
makefile.extra_include_dirs.append("/usr/include/qt5/QtGui")
makefile.extra_include_dirs.append("/usr/include/qt5/QtWidgets")
# Generate the Makefile itself.
makefile.generate()
Exemplo n.º 7
0
# The name of the SIP build file generated by SIP and used by the build
# system.
build_file = "PyIndimod.sbf"
if code_directory != "":
    sip_build_file = code_directory + os.sep + build_file

# Get the SIP configuration information.
config = sipconfig.Configuration()

# Run SIP to generate the code.
os.system(" ".join([
    config.sip_bin, "-c", code_directory, "-b", sip_build_file, "-I",
    sip_directory, "PyIndimod.sip"
]))

# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(config,
                                       build_file,
                                       dir=code_directory,
                                       threaded=1)

# Add the library we are wrapping.  The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_libs = ["indi", "indiclient", "nova"]
makefile.extra_include_dirs = ["/usr/include/libindi", "/usr/include/libnova"]

# Generate the Makefile itself.
makefile.generate()
Exemplo n.º 8
0
    "-c",
    build_dir,
    "-b",
    build_file,
    sip_file
])
print cmd
ret = os.system(cmd)

if ret:
    print "sip error: exiting..."
    sys.exit(ret)

# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(config,
                                       build_file,
                                       dir=this_dir,
                                       install_dir=install_dir)

python_lib = "python{v[0]}.{v[1]}".format(v=sys.version_info)

# Add the library we are wrapping.  The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_libs = ["tango", "log4tango", python_lib]
makefile.extra_libs += [
    "zmq", "omniORB4", "omniDynamic4", "omnithread", "COS4"
]
#makefile.extra_lib_dirs = ["/home/tcoutinho/.local/lib"]
#makefile.extra_include_dirs = ["/home/tcoutinho/.local/include", "/home/tcoutinho/.local/include/tango"]
makefile.extra_cxxflags = ["-std=c++0x"]
Exemplo n.º 9
0
        build_path,
        "-w",
        "-o",
        sip_file,
    ])

    print(cmd)
    if os.system(cmd) != 0: sys.exit(1)

    python_dir = os.path.abspath(os.path.join(rundir, "python"))

    makefile = sipconfig.SIPModuleMakefile(
        config,
        build_file,
        dir=output_dir,
        install_dir=dest_pkg_dir,
        installs=[(
            os.path.join(python_dir, '__init__.py'),
            dest_pkg_dir,
        )],
    )

    makefile.extra_defines += [
        'MYQONSCREENKEYBOARD_LIBRARY', 'QT_CORE_LIB', 'QT_GUI_LIB',
        'QT_WIDGETS_LIB'
    ]
    makefile.extra_include_dirs += [
        os.path.abspath(inc_dir), qtconfig.QT_INSTALL_HEADERS
    ]
    makefile.extra_lib_dirs += [
        qtconfig.QT_INSTALL_LIBS,
        os.path.join(rundir, 'src'), lib_dir
Exemplo n.º 10
0
# (c) Copyright Linspire. Inc, 2005
#
# This is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
import os
import sipconfig

modulename = "ipodlib"
buildfile = modulename + ".sbf"
config = sipconfig.Configuration()
os.system(" ".join(
    [config.sip_bin, '-c', '.', '-b', buildfile, modulename + ".sip"]))
makefile = sipconfig.SIPModuleMakefile(
    config, buildfile, installs=[["ipod.py", config.default_mod_dir]])
makefile.extra_lib_dirs = [".", "../src", "../src/.libs"]
makefile.extra_libs = ["ipod", "expat"]
makefile.extra_include_dirs = [".", "../src", "../include"]
makefile.generate()
Exemplo n.º 11
0
# Run SIP to generate the code.  Note that we tell SIP where to find the qt
# module's specification files using the -I flag.
cmd = [
    config.sip_bin, '-c', build_dir, '-b',
    os.path.join(build_dir, build_file), '-I',
    os.path.join(config.default_sip_dir, 'PyQt5'), '-w'
]
cmd += qt_sip_flags.split(' ')
cmd.append(sip_file)
subprocess.check_call(cmd)

# Create the Makefile.  The QtModuleMakefile class provided by the
# pyqtconfig module takes care of all the extra preprocessor, compiler and
# linker flags needed by the Qt library.
makefile = sipconfig.SIPModuleMakefile(configuration=config,
                                       build_file=build_file,
                                       dir=build_dir)

# hack to override makefile behavior which always prepend -l to libraries which is wrong for absolute paths
default_platform_lib_function = sipconfig.SIPModuleMakefile.platform_lib


def custom_platform_lib_function(self, clib, framework=0):
    if os.path.isabs(clib):
        return clib
    return default_platform_lib_function(self, clib, framework)


sipconfig.SIPModuleMakefile.platform_lib = custom_platform_lib_function

Exemplo n.º 12
0
def generate_code(mname,
                  include_dirs=None,
                  lib_dirs=None,
                  libs=None,
                  extra_sip_flags=None,
                  debug=0):
    """Generate the code for a module.

    mname is the name of the module to generate the code for.
    extra_include_dirs is an optional list of additional directories to add to
    the list of include directories.
    extra_lib_dirs is an optional list of additional directories to add to the
    list of library directories.
    extra_libs is an optional list of additional libraries to add to the list
    of libraries.
    extra_sip_flags is an optional list of additional flags to pass to SIP.
    """
    sipconfig.inform("Generating the C++ source for the %s module..." % mname)
    modfile = mname + "mod.sip"
    builddir = abspath(
        join("build", mname, "release" if not debug else "debug"))

    #sanity check - avoid cleaning a directory full of .sip files!
    if exists(join(builddir, modfile)):
        raise RuntimeError(
            "SIP module target {} exists in build directory {}, aborting!".
            format(modfile, builddir))

    #clean the build directory
    mk_clean_dir(builddir)

    # Build the SIP command line.
    argv = ['"' + pyqtcfg.sip_bin + '"']

    argv.append(qt_sip_flags)

    if extra_sip_flags:
        argv.extend(extra_sip_flags)

    #enable debugging statements within sip
    if debug:
        argv.append("-r")

    # the directory where our cpp files are placed
    argv.append("-c")
    argv.append(builddir)

    buildfile = join(builddir, mname + ".sbf")
    argv.append("-b")
    argv.append(buildfile)

    argv.append("-I")
    argv.append(pyqtcfg.pyqt_sip_dir)

    argv.append("-I")
    argv.append(join(os.getcwdu(), mname))

    # SIP assumes POSIX style path separators.
    argv.append(abspath(join(mname, modfile)))

    cmd = " ".join(argv)
    sys.stdout.write(cmd + "\n")

    #call sip.exe to generate our C++ code
    os.system(cmd)

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    makefile = sipconfig.SIPModuleMakefile(configuration=pyqtcfg,
                                           build_file=buildfile,
                                           dir=builddir,
                                           install_dir=pyqt_modroot,
                                           qt=True,
                                           universal=pyqtcfg.universal,
                                           arch=pyqtcfg.arch,
                                           debug=debug,
                                           export_all=True,
                                           prot_is_public=False,
                                           threaded=True)

    add_makefile_extras(makefile, include_dirs, lib_dirs, libs)
    makefile.extra_cxxflags.append('-EHsc')
    makefile.extra_cflags.append("-Zi")
    makefile.extra_cxxflags.append("-Zi")
    makefile.extra_lflags.append("/DEBUG")
    makefile.extra_lflags.append("/PDB:{}.pdb".format(mname))

    makefile.generate()
    return builddir
Exemplo n.º 13
0
def setup_qglviewer_build(configuration, options, package):
    """Setup the qglviewer module build
    """

    print 'Setup the qglviewer package build.'

    setup_qglviewer_config(options, package)

    build_dir = options.subdirs[0]
    tmp_dir = os.path.join('tmp')
    build_file = os.path.join(tmp_dir, 'QGLViewer.sbf')
    extra_sources = []
    extra_headers = []
    extra_moc_headers = []
    extra_py_files = glob.glob(os.path.join('src', 'python', '*.py'))

    # zap the temporary directory
    try:
        shutil.rmtree(tmp_dir)
    except:
        pass
    # make a clean temporary directory
    try:
        os.mkdir(tmp_dir)
    except:
        raise Die, 'Failed to create the temporary build directory.'

    # copy the extra files
    copy_files(extra_sources, tmp_dir)
    copy_files(extra_headers, tmp_dir)
    copy_files(extra_moc_headers, tmp_dir)
    copy_files(extra_py_files, tmp_dir)

    pyqt_sip_flags = configuration.pyqt_sip_flags if type(
        configuration) != dict else configuration['sip_flags']
    pyqt_sip_dir = configuration.pyqt_sip_dir if type(
        configuration) != dict else configuration['pyqt_sip_dir']
    pyqt_sip_dir = pyqt_sip_dir.replace('\\', '/')
    sip_bin = configuration.sip_bin if type(
        configuration) != dict else configuration['sip_bin']

    # invoke SIP
    cmd = ' '.join([
        sip_bin,
        # SIP assumes POSIX style path separators
        '-I',
        pyqt_sip_dir,
        '-b',
        build_file,
        '-c',
        tmp_dir,
        #'-m', 'PyQGLViewer.xml', # Forgenerating xml doc tree
        options.jobs,
        options.trace,
        pyqt_sip_flags,
    ] + options.sip_include_dirs + options.excluded_features +
                   options.timelines
                   # SIP assumes POSIX style path separators
                   + [options.qglviewer_sipfile.replace('\\', '/')])

    if options.verbose_config:
        print 'sip invokation:'
        pprint.pprint(cmd)
    if os.path.exists(build_file):
        os.remove(build_file)
    os.system(cmd)
    if not os.path.exists(build_file):
        raise Die, 'SIP failed to generate the C++ code.'

    # fix the SIP build file
    fix_build_file(build_file, [os.path.basename(f) for f in extra_sources],
                   [os.path.basename(f) for f in extra_headers],
                   [os.path.basename(f) for f in extra_moc_headers])

    # copy lazily to the build directory to speed up recompilation
    if not os.path.exists(build_dir):
        try:
            os.makedirs(build_dir)
        except:
            raise Die, 'Failed to create the build directory.'

    lazy_copies = 0
    for pattern in ('*.c', '*.cpp', '*.h', '*.py', '*.sbf'):
        for source in glob.glob(os.path.join(tmp_dir, pattern)):
            target = os.path.join(build_dir, os.path.basename(source))
            if lazy_copy_file(source, target):
                if options.verbose_config:
                    print 'Copy %s -> %s.' % (source, target)
                lazy_copies += 1
    print '%s file(s) lazily copied.' % lazy_copies

    # byte-compile the Python files
    compileall.compile_dir(build_dir, 1, options.module_install_path)

    # files to be installed
    installs = []
    installs.append([[
        os.path.basename(f)
        for f in glob.glob(os.path.join(build_dir, '*.py*'))
    ], options.module_install_path])

    sip_install_dir = os.path.abspath(
        os.path.join(pyqt_sip_dir, os.path.pardir, 'QGLViewer'))
    if options.verbose_config:
        print 'Module installation dir will be :', options.module_install_path
        print 'Sip files installation dir will be :', sip_install_dir
    # creation of
    #if not os.path.exists(sip_install_dir):
    #    try:
    #        os.mkdir(sip_install_dir)
    #    except:
    #        raise Die, 'Failed to create the sip files repository.'
    pattern = os.path.join('src', 'sip', '*.sip')
    sip_files = glob.glob(pattern)
    sip_files = [os.path.abspath(i) for i in sip_files]
    installs.append([sip_files, sip_install_dir])

    qtmodules = ['QtOpenGL', 'QtXml', 'QtCore', 'QtGui']
    if options.qt == 5:
        qtmodules += ['QtWidgets']

    # module makefile
    makefile = sipconfig.SIPModuleMakefile(
        configuration=configuration,
        build_file=os.path.basename(build_file),
        dir=build_dir,
        install_dir=options.module_install_path,
        installs=installs,
        qt=qtmodules,
        opengl=1,
        warnings=1,
        debug=options.debug,
    )

    makefile.extra_cflags.extend(options.extra_cflags)
    makefile.extra_cxxflags.extend(options.extra_cxxflags)
    makefile.extra_defines.extend(options.extra_defines)
    makefile.extra_include_dirs.extend(options.extra_include_dirs)
    makefile.extra_lflags.extend(options.extra_lflags)
    makefile.extra_libs.extend(options.extra_libs)
    makefile.extra_lib_dirs.extend(options.extra_lib_dirs)
    makefile.generate()
Exemplo n.º 14
0
# Run SIP to generate the code.
command = [
    config.sip_bin,
    "-c", ".",
    "-b", build_file,
    "-I", config.pyqt_sip_dir,
    "-I", config.pyqt_sip_dir+'/QtCore/',
"-e"
] + config.pyqt_sip_flags.split() + [sip_path]
print(' '.join(command))
subprocess.check_call(command)

# Create the Makefile.

makefile = sipconfig.SIPModuleMakefile(config, build_file,
                                       strip = 0, qt=["QtCore", "QtGui"])
makefile.extra_include_dirs.append(os.path.join(here, "../libqxt/src/core"))
makefile.extra_include_dirs.append(os.path.join(here, "../libqxt/src/widgets"))
makefile.extra_lib_dirs.append(os.path.abspath(os.curdir))
makefile.extra_libs.append("QxtGlobalShortcut")
makefile.extra_cxxflags.append("-std=c++11")
makefile.generate()
outmake = os.path.join(makefile.dir,"Makefile")
if qt_api == '5':
    with open(outmake,"r") as f:
        qt5fix = f.read()

    print('''
    Qt5 Fix Applied:
        On Conda installation for instance the lib are named Qt5 instead of the general Qt originally used in the module.
    ''')
Exemplo n.º 15
0
def generate_code(
        mname,
        imports=None,
        extra_cflags=None,
        extra_cxxflags="-I%s/QtCore/ -I%s/QtXml/ -I%s/QtGui/ -I%s -I../../../include -L../../../lib"
    % (pyqtcfg.qt_inc_dir, pyqtcfg.qt_inc_dir, pyqtcfg.qt_inc_dir,
       pyqtcfg.qt_inc_dir),
        extra_define=None,
        extra_include_dir=None,
        extra_lflags=None,
        extra_lib_dir=None,
        extra_lib=None,
        sip_flags=None):
    """Generate the code for a module.

    mname is the name of the module.
    imports is the list of PyQt modules that this one %Imports.
    extra_cflags is a string containing additional C compiler flags.
    extra_cxxflags is a string containing additional C++ compiler flags.
    extra_define is a name to add to the list of preprocessor defines.
    extra_include_dir is the name of a directory to add to the list of include
    directories.
    extra_lflags is a string containing additional linker flags.
    extra_lib_dir is the name of a directory to add to the list of library
    directories.
    extra_lib is the name of an extra library to add to the list of libraries.
    sip_flags is the list of sip flags to use instead of the defaults.
    """
    sipconfig.inform("Generating the C++ source for the %s module..." % mname)

    try:
        shutil.rmtree(mname)
    except:
        pass

    try:
        os.mkdir(mname)
    except:
        sipconfig.error("Unable to create the %s directory." % mname)

    # Build the SIP command line.
    argv = [pyqtcfg.sip_bin]

    if sip_flags:
        argv.extend(sip_flags)

    if opt_concat:
        argv.append("-j")
        argv.append(str(opt_split))

    if opt_tracing:
        argv.append("-r")

    if opt_releasegil:
        argv.append("-g")

    argv.append("-c")
    argv.append(mname)

    buildfile = os.path.join(mname, mname + ".sbf")
    argv.append("-b")
    argv.append(buildfile)

    argv.append("-I")
    argv.append(pyqtcfg.pyqt_sip_dir)

    # SIP assumes POSIX style path separators.
    argv.append(string.join(["sip", mname, mname + "mod.sip"], "/"))

    os.system(string.join(argv))

    # Check the result.
    if not os.access(buildfile, os.F_OK):
        sipconfig.error("Unable to create the C++ code.")

    # Compile the Python stub.
    if pyqtcfg.sip_version < 0x040000:
        sipconfig.inform("Compiling %s.py..." % mname)
        py_compile.compile(os.path.join(mname, mname + ".py"),
                           os.path.join(mname, mname + ".pyc"))

    # Generate the Makefile.
    sipconfig.inform("Creating the Makefile for the %s module..." % mname)

    installs = []

    if pyqtcfg.sip_version >= 0x040000:
        warnings = 1
    else:
        warnings = 0
        installs.append([[mname + ".py", mname + ".pyc"],
                         opt_pyqicstablemoddir])

    sipfiles = []

    for s in glob.glob("sip/" + mname + "/*.sip"):
        sipfiles.append(os.path.join("..", "sip", mname, os.path.basename(s)))

    installs.append([sipfiles, os.path.join(opt_pyqicstablesipdir, mname)])

    makefile = sipconfig.SIPModuleMakefile(configuration=pyqtcfg,
                                           build_file=mname + ".sbf",
                                           dir=mname,
                                           install_dir=opt_pyqicstablemoddir,
                                           installs=installs,
                                           qt=1,
                                           warnings=warnings,
                                           static=opt_static,
                                           debug=opt_debug)

    if extra_cflags:
        makefile.extra_cflags.append(extra_cflags)

    if extra_cxxflags:
        makefile.extra_cxxflags.append(extra_cxxflags)

    if extra_define:
        makefile.extra_defines.append(extra_define)

    if extra_include_dir:
        makefile.extra_include_dirs.append(extra_include_dir)

    if extra_lflags:
        makefile.extra_lflags.append(extra_lflags)

    if extra_lib_dir:
        makefile.extra_lib_dirs.append(extra_lib_dir)

    if extra_lib:
        makefile.extra_libs.append(extra_lib)

    if pyqtcfg.sip_version < 0x040000 and imports:
        # Inter-module links.
        for im in imports:
            makefile.extra_lib_dirs.insert(0, pyqtcfg.pyqt_mod_dir)
            makefile.extra_libs.insert(0, makefile.module_as_lib(im))

    makefile.generate()
Exemplo n.º 16
0
# system.
build_dir = os.path.join(basepath, 'build')
build_file = os.path.join(build_dir, basename + ".sbf")

# Get the SIP configuration information.
config = sipconfig.Configuration()

if not os.path.isdir(build_dir):
    os.makedirs(build_dir)

# Run SIP to generate the code.
os.system(" ".join(
    [config.sip_bin, "-g", "-c", build_dir, "-b", build_file, sipfile]))

# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(config,
                                       build_file,
                                       makefile=os.path.join(
                                           build_dir, 'Makefile'))

# Add the library we are wrapping.  The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_libs = [basename]

# Search libraries in current directory
#makefile.extra_lflags= ['-L.']

# Generate the Makefile itself.
makefile.generate()
Exemplo n.º 17
0
# Run SIP to generate the build_file
os.system(" ".join([
    config.sip_bin, '-I',
    str(config.pyQtIncludePath),
    str(config.pyqt_sip_flags), "-b", build_file, "-o", "-c", ". "
    " qtermwidget.sip"
]))

installs = []
installs.append(
    ["qtermwidget.sip",
     os.path.join(config.pyqt_sip_dir, "qtermwidget")])
installs.append(["qtermwidgetconfig.py", config.pyqt_mod_dir])

makefile = sipconfig.SIPModuleMakefile(configuration=config,
                                       build_file=build_file,
                                       installs=installs,
                                       qt=["QtCore", "QtGui", "QtWidgets"])

# Add the library we are wrapping.  The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
#makefile.extra_lib_dirs.append("../lib/")
#makefile.extra_lib_dirs.append("..")
makefile.extra_libs = ["qtermwidget5"]

# Support for C++11
makefile.extra_cxxflags.append('-std=c++11')

# Generate the Makefile itself.
makefile.generate()
Exemplo n.º 18
0
# Run SIP to generate the code.
sipcmd = [config.sip_bin]
sipcmd.extend(["-I", "../../../plugins/python/sip/"]) # For finding _shotgun.sip
sipcmd.extend(["-b", "src/%s" % build_file])
sipcmd.extend(["-c", "src"])
sipcmd.append("-e")
sipcmd.append("-w")
sipcmd.append("sip/_siteshotgun.sip")
print " ".join(sipcmd)
result = subprocess.call(sipcmd)
if result != 0:
    sys.exit(result)

# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(config, build_file, dir="src")

try:
    xmlrpc_cppflags = os.environ["XMLRPC_CFLAGS"]
    xmlrpc_ldflags = os.environ["XMLRPC_LDFLAGS"]
    xmlrpc_ldadd = os.environ["XMLRPC_LDADD"]
    xmlrpc_libs = xmlrpc_ldadd.replace("-l", "")
    automake_defs = os.environ["DEFS"]
except KeyError:
    print "./configure.py is intended to be run by make."
    sys.exit(1)

makefile.extra_cxxflags = [automake_defs, xmlrpc_cppflags]
makefile.extra_lflags = [xmlrpc_ldflags]

makefile.extra_include_dirs = ["../../../lib", "../../../../lib"]
Exemplo n.º 19
0
if sys.platform == 'win32' and os.path.isdir(sip_bin):
    sip_bin += '.exe'

cmd = [
    sip_bin, '-c', build_dir, '-b',
    os.path.join(build_dir, build_file), '-I', sip_dir, '-w'
]
cmd += sip_flags.split(' ')
cmd.append(sip_file)
subprocess.check_call(cmd)

# Create the Makefile.  The QtModuleMakefile class provided by the
# pyqtconfig module takes care of all the extra preprocessor, compiler and
# linker flags needed by the Qt library.
makefile = sipconfig.SIPModuleMakefile(dir=build_dir,
                                       configuration=config,
                                       build_file=build_file,
                                       qt=['QtCore', 'QtGui'])

# hack to override makefile behavior which always prepend -l to libraries
# which is wrong for absolute paths
default_platform_lib_function = sipconfig.SIPModuleMakefile.platform_lib


def custom_platform_lib_function(self, clib, framework=0):
    if not clib or clib.isspace():
        return None
    # Only add '-l' if a library doesn't already start with '-l' and is not an absolute path
    if os.path.isabs(clib) or clib.startswith('-l'):
        return clib

    global libqt5_rename
Exemplo n.º 20
0
        '-I', py_sip_dir,
        '-I', config.sip_inc_dir,
        '-I', inc_dir,
        "-c", output_dir,
        "-b", build_path,
        "-w",
        "-o",
        sip_file,
    ])

    print(cmd)
    if os.system(cmd)!=0: sys.exit(1)

    makefile=sipconfig.SIPModuleMakefile(
        config,
        build_file,
        dir=output_dir,
        install_dir=dest_pkg_dir
    )

    makefile.extra_defines+=['AnalogClock_LIBRARY','QT_CORE_LIB', 'QT_GUI_LIB', 'QT_WIDGETS_LIB']
    makefile.extra_include_dirs+=[os.path.abspath(inc_dir), qtconfig.QT_INSTALL_HEADERS]
    makefile.extra_lib_dirs+=[qtconfig.QT_INSTALL_LIBS, os.path.join('..','src')]
    makefile.extra_libs+=['analogclock']

    if sys.platform=='darwin':
        makefile.extra_cxxflags+=['-F'+qtconfig.QT_INSTALL_LIBS]        
        makefile.extra_include_dirs+=[
            os.path.join(qtconfig.QT_INSTALL_LIBS,'QtCore.framework','Headers'),
            os.path.join(qtconfig.QT_INSTALL_LIBS,'QtGui.framework','Headers'),
            os.path.join(qtconfig.QT_INSTALL_LIBS,'QtWidgets.framework','Headers'),
        ]
Exemplo n.º 21
0
config=sipconfig.Configuration()

if len( sys.argv ) > 1 :
    libdir=sys.argv[ 1 ]

#os.system( "rm ./sip4build/*" )
os.system( " ".join([config.sip_bin, "-c", "./sip4build", "-b", build_file, "rpcf.sip" ] ) )

macros = config.build_macros()
macros[ 'CC' ] = os.environ['CC']
macros[ 'CXX' ] = os.environ['CXX']                              
macros[ 'LINK' ] = os.environ['CXX']                             
macros[ 'LINK_SHLIB' ] = macros[ 'LINK' ]                        
sysroot = os.environ['SYSROOT']                                  

makefile = sipconfig.SIPModuleMakefile(config, build_file, export_all=1)
makefile.dir = "./sip4build"
makefile.extra_libs = ["combase", "ipc" ]
makefile.extra_defines = ["DEBUG","_USE_LIBEV" ]
makefile.extra_lib_dirs = [ \
    curPath + "../combase/.libs", \
    curPath + "../ipc/.libs" ]

try:
    pkgconfig=os.environ[ 'PKG_CONFIG' ]
    if pkgconfig is None or len( pkgconfig ) == 0:
        pkgconfig = 'pkg-config'
    armbuild = os.environ[ 'ARMBUILD' ]
    if armbuild == "1" :
        makefile.extra_libs.append( "atomic" )
except:
Exemplo n.º 22
0
import os
import sipconfig

# The name of the SIP build file generated by SIP and used by the build
# system.
build_file = "PMI_benchmark_mob.sbf"

# Get the SIP configuration information.
config = sipconfig.Configuration()

# Run SIP to generate the code.
os.system(" ".join([
    config.sip_bin, "-c", ".", "-b", build_file, "-I", "../include",
    "PMI_benchmark_mob.sip"
]))

# Create the Makefile.

makefile = sipconfig.SIPModuleMakefile(config, build_file)

makefile.extra_include_dirs = ["..", "../include"]

# Add the library we are wrapping.  The name doesn't include any platform
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
# ".dll" extension on Windows).
makefile.extra_lib_dirs = [".."]
makefile.extra_libs = ["PMIBenchmarkMob"]

# Generate the Makefile itself.
makefile.generate()
Exemplo n.º 23
0
import os
import sipconfig

# The name of the SIP build file generated by SIP and used by the build
# system.
build_file = "py_sems.sbf"

# Get the SIP configuration information.
config = sipconfig.Configuration()

# Run SIP to generate the code.
os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "-r", "py_sems.sip"]))

# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(config, build_file, makefile="Makefile.gen")

makefile.extra_cxxflags = ["-Wall -Wno-reorder -g"]
makefile.extra_include_dirs = ["$(COREPATH)"]
makefile.extra_lflags = ["-g"]
makefile._warnings = 0

# Generate the Makefile itself.
makefile.generate()