'--std=c++11', '-D_GLIBCXX_USE_CXX11_ABI=0',\
             '-DGOOGLE_CUDA=1', '-DNDEBUG'],
    'g++': tf.sysconfig.get_link_flags() + ['-std=c++11'],
}

if is_debug_info:
    for _ in extra_compile_args:
        extra_compile_args[_].append('-DDEBUGINFO')

ext = Extension(
    os.path.join(mod, '_' + mod),
    sources=[
        'src/decoding_op.cc', 'src/decoding_op.cu.cc', 'src/decoding.cu',
        'src/decoder.cu'
    ],
    library_dirs=[CUDA['lib64']],
    runtime_library_dirs=[CUDA['lib64']],
    libraries=['cudart', 'cublas', 'tensorflow_framework'],
    extra_link_args=tf.sysconfig.get_link_flags(),
    extra_compile_args=extra_compile_args,
    include_dirs=[CUDA['include'], 'src',
                  tf.sysconfig.get_include()])


def customize_compiler_for_nvcc(self):
    self.src_extensions.append('.cu')

    default_compiler_so = self.compiler_so
    super = self._compile

    def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
Exemple #2
0
    numpy_include = numpy.get_numpy_include()

ext = Extension(
    'cuml',
    sources=[
        'cuML/src/pca/pca.cu', 'cuML/src/tsvd/tsvd.cu',
        'cuML/src/dbscan/dbscan.cu', 'cuML/src//kmeans/kmeans.cu',
        'python/cuML/cuml.pyx'
    ],
    depends=['cuML/src/tsvd/tsvd.cu'],
    library_dirs=[CUDA['lib64']],
    libraries=['cudart', 'cublas', 'cusolver'],
    language='c++',
    runtime_library_dirs=[CUDA['lib64']],
    # this syntax is specific to this build system
    extra_compile_args={
        'gcc': ['-std=c++11', '-fopenmp'],
        'nvcc': [
            '-arch=sm_60', '--ptxas-options=-v', '-c', '--compiler-options',
            "'-fPIC'", '-std=c++11', '--expt-extended-lambda'
        ]
    },
    include_dirs=[
        numpy_include, CUDA['include'], 'cuML/src',
        'cuML/external/ml-prims/src',
        'cuML/external/ml-prims/external/cutlass', 'cuML/external/cutlass',
        'cuML/external/ml-prims/external/cub'
    ],
    extra_link_args=["-std=c++11", '-fopenmp'])

cmdclass = versioneer.get_cmdclass()
Exemple #3
0
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
import numpy as np

# To install and compile to your anaconda/python site-packages, simply run:
# $ pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
# Note that the original compile flags below are GCC flags unsupported by the Visual C++ 2015 build tools.
# They can safely be removed.

ext_modules = [
    Extension(
        'pycocotools._mask',
        sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],
        include_dirs = [np.get_include(), '../common'],
        extra_compile_args=[] # originally was ['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
    )
]

setup(name='pycocotools',
      packages=['pycocotools'],
      package_dir = {'pycocotools': 'pycocotools'},
      version='2.0.1',
      ext_modules=
          cythonize(ext_modules)
      )
Exemple #4
0
else:
    print("""\
WARNING: This operating system (%s) is not supported by RtMidi.
Linux, Mac OS X (>= 10.5), Windows (XP, Vista, 7/8/10) are supported.
Continuing and hoping for the best...
""" % sys.platform)

# define _rtmidi Extension
extensions = [
    Extension(
        PKG_DIR + "._rtmidi",
        sources=sources,
        language="c++",
        define_macros=define_macros,
        include_dirs=include_dirs,
        libraries=libraries,
        library_dirs=library_dirs,
        extra_compile_args=extra_compile_args,
        extra_link_args=extra_link_args
    )
]

# Finally, set up our distribution
setup(
    packages=['rtmidi'],
    ext_modules=cythonize(extensions),
    tests_require=['pytest', 'mock'],
    # On systems without a RTC (e.g. Raspberry Pi), system time will be the
    # Unix epoch when booted without network connection, which makes zip fail,
    # because it does not support dates < 1980-01-01.
Exemple #5
0
try:
    # pip > 10
    from pip._internal import parse_command, download
    from pip._internal.req import parse_requirements

except Exception as e:
    # pip < 10
    from pip import parse_command, download
    from pip.req import parse_requirements

ext_modules = [
    Extension("pyreBloom", [
        "clib/pyreBloom/bloom.c",
        "clib/pyreBloom/pyreBloom.pyx",
    ],
              libraries=['hiredis'],
              library_dirs=['/usr/local/lib'],
              include_dirs=['/usr/local/include'],
              extra_compile_args=['-std=c99'])
]
# setup(
#     name="pyreBloom-ng",
#     # extensions=extensions,
#     version = '0.0.1',
#     ext_modules=extensions,
#     cmdclass={'build_ext': Cython.Build.build_ext},
# )
packages = {"pyreBloom", "pyreBloom.utils"}
package_data = {
    "pyreBloom": ["*.pyi"],
    "pyreBloom.utils": ["*.pyi"],
Exemple #6
0
# -*- coding: utf-8 -*-
# @Time  : 2020/2/18 15:23
# @Author: [email protected]
from setuptools import setup, find_packages
from distutils.extension import Extension
from os.path import join
import os
from pyunit_math import __version__, __author__, __description__, __email__, __names__, __url__

dirs = os.path.abspath(os.path.dirname(__file__))

with open(dirs + os.sep + 'README.md', encoding='utf-8') as f:
    long_text = f.read()

ext_modules = [
    Extension('pyunit_math.pi', [join(dirs, 'pi.c')], extra_compile_args=['-O3'])
]

setup(
    name=__names__,
    version=__version__,
    description=__description__,
    long_description=long_text,
    long_description_content_type="text/markdown",
    url=__url__,
    author=__author__,
    author_email=__email__,
    license='MIT Licence',
    packages=find_packages(),
    platforms='any',
    package_data={__names__: ['*.py', '*.c']},
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import build_ext
import numpy

setup(
      name="Merge sort program",
      ext_modules=[
            Extension('bubble_sort_opt',
                      sources=['bubble_sort_opt.pyx'],
                      extra_compile_args=['-O3'],
                      language='c++')
      ],
      include_dirs=[numpy.get_include()],
      cmdclass={'build_ext': build_ext}
)
Exemple #8
0
    'View.cpp',
    'numerics.cpp',
    'utils.cpp',
    'weakprng.cpp',
]
State_sources = generate_sources([
    (pyx_src_dir, State_pyx_sources),
    (cpp_src_dir, State_cpp_sources),
])


# create exts
ContinuousComponentModel_ext = Extension(
    'crosscat.cython_code.ContinuousComponentModel',
    extra_compile_args = [],
    sources=ContinuousComponentModel_sources,
    include_dirs=include_dirs,
    language='c++',
)
MultinomialComponentModel_ext = Extension(
    'crosscat.cython_code.MultinomialComponentModel',
    extra_compile_args = [],
    sources=MultinomialComponentModel_sources,
    include_dirs=include_dirs,
    language='c++',
)
CyclicComponentModel_ext = Extension(
    'crosscat.cython_code.CyclicComponentModel',
    extra_compile_args = [],
    sources=CyclicComponentModel_sources,
    include_dirs=include_dirs,
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
import os

# np_lib = os.path.dirname(numpy.__file__)
# np_inc = [os.path.join(np_lib, 'core/include')]

# ext_modules = [Extension("dtw.fast",["src/fast.pyx"], include_dirs=np_inc)]

setup(description='Dynamic Time Warping',
      cmdclass={'build_ext': build_ext},
      include_dirs=[np.get_include()],
      ext_modules=[Extension("dtw_fast", ["dtw_fast.pyx"])])
Exemple #10
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

setup(cmdclass={'build_ext': build_ext},
      ext_modules=[Extension("cdfire", ["cdfire.pyx"])])
Exemple #11
0
classy_folder = os.path.join(root_folder, "python")

# Recover the CLASS version
with open(os.path.join(include_folders[1], 'common.h'), 'r') as v_file:
    for line in v_file:
        if line.find("_VERSION_") != -1:
            # get rid of the " and the v
            VERSION = line.split()[-1][2:-1]
            break

# Define cython extension and fix Python version
classy_ext = Extension(
    "classy",
    [os.path.join(classy_folder, "classy.pyx")],
    include_dirs=include_folders,
    libraries=liblist,
    library_dirs=[root_folder, GCCPATH],
    language="c++",
    extra_compile_args=compile_args,
    define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
)
import six

setup(
    name='classy',
    version=VERSION,
    description='Python interface to the Cosmological Boltzmann code CLASS',
    url='http://www.class-code.net',
    ext_modules=cythonize(
        classy_ext,
        language_level=3 if six.PY3 else 2,
        annotate=False,
Exemple #12
0
try:
    from Cython.Build import cythonize
    ext = 'pyx'
except ImportError:
    cythonize = None
    ext = 'c'


extensions = []
for file in glob.glob('py/loqui/*.%s' % ext):
    package = os.path.splitext(os.path.basename(file))[0]
    print package
    extensions.append(Extension(
        'loqui.%s' % package,
        [file],
        extra_compile_args=['-O3']
    ))

if cythonize:
    extensions = cythonize(extensions)

setup(
    name='loqui',
    version='0.2.11',
    author='Jake Heinz',
    author_email='*****@*****.**',
    url="http://github.com/discordapp/loqui",
    description='A really simple stream based RPC - with a gevent client/server implementation',
    license='MIT',
    package_dir={
Exemple #13
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np

ext_modules = []

# We need to specify the path to all the scripts involved in this module
ext_modules += [
    Extension(
        "IV_module",
        sources=[
            "IV_module.pyx", "./LetsBeRational/lets_be_rational.cpp",
            "./LetsBeRational/erf_cody.cpp",
            "./LetsBeRational/rationalcubic.cpp",
            "./LetsBeRational/normaldistribution.cpp"
        ],
    )
]

setup(name='IV_module',
      description='Implied Volatility Library',
      author='Aitor Muguruza',
      ext_modules=cythonize(ext_modules),
      script_args=["build_ext"],
      options={'build_ext': {
          'inplace': True
      }},
      include_dirs=[np.get_include()])
Exemple #14
0
                                         os.path.basename(self.egg_info))


# Disable cythonification if we're not really building anything
if (len(sys.argv) >= 2
        and any(i in sys.argv[1:]
                for i in ('--help', 'clean', 'egg_info', '--version'))):

    def cythonize(x, **kwargs):
        return x


setup(
    name='rados',
    version=get_version(),
    description="Python libraries for the Ceph librados library",
    long_description=(
        "This package contains Python libraries for interacting with Ceph's "
        "rados library."),
    ext_modules=cythonize(
        [Extension(
            "rados",
            ["rados.pyx"],
            libraries=["rados"],
        )],
        build_dir=os.environ.get("CYTHON_BUILD_DIR", None)),
    cmdclass={
        "egg_info": EggInfoCommand,
    },
)
Exemple #15
0
from distutils.core import setup
from distutils.extension import Extension

hello_world = Extension(
    'hello_world',
    sources=['hello_world.cpp'],
    libraries=['boost_python-mt'],
)

setup(name='hello-world_0', version='0.1', ext_modules=[hello_world])
Exemple #16
0
#!/usr/bin/python2.7

"setup.py script"

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

import numpy

ext_modules = [
    Extension("life_cy",
              sources=["life_cy.pyx", "life.c"],
              headers=["life.h"],
              include_dirs=[numpy.get_include()],
              pyrex_gdb=True,
              extra_compile_args=["-std=c99", "-O3", "-g"])
]

setup(cmdclass={'build_ext': build_ext}, ext_modules=ext_modules)
Exemple #17
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
#ext_modules = [Extension("_nms_gpu_post", ["_nms_gpu_post.pyx"])]
ext_modules = [
    Extension("_nms_gpu_post", ["_nms_gpu_post.pyx"],
              include_dirs=[numpy.get_include()])
]
setup(name="nms pyx",
      cmdclass={'build_ext': build_ext},
      ext_modules=ext_modules)
Exemple #18
0
with open(join(THIS_DIR, 'README.md'), encoding='utf-8') as file:
    long_description = file.read()

#if exists(BUILD_DIRECTORY):
#    rmtree(BUILD_DIRECTORY)

#copytree(CORE_EXT_DIRECTORY, join(BUILD_DIRECTORY))
#os.remove(join(BUILD_DIRECTORY, '__init__.py'))

ext_modules = [
    Extension(name='sqsgenerator.core.base',
              sources=[
                  join(BUILD_DIRECTORY, 'base.pyx'),
                  join(BUILD_DIRECTORY, 'src', 'utils.c'),
                  join(BUILD_DIRECTORY, 'src', 'rank.c')
              ],
              extra_compile_args=EXTRA_COMPILE_ARGS,
              extra_link_args=EXTRA_LINK_ARGS,
              include_dirs=INCLUDE_DIRS),
    Extension(name='sqsgenerator.core.collection',
              sources=[
                  join(BUILD_DIRECTORY, 'collection.pyx'),
                  join(BUILD_DIRECTORY, 'src', 'list.c'),
                  join(BUILD_DIRECTORY, 'src', 'conf_list.c'),
                  join(BUILD_DIRECTORY, 'src', 'conf_array.c'),
                  join(BUILD_DIRECTORY, 'src', 'conf_collection.c'),
                  join(BUILD_DIRECTORY, 'src', 'rank.c'),
                  join(BUILD_DIRECTORY, 'src', 'utils.c')
              ],
              extra_compile_args=EXTRA_COMPILE_ARGS,
Exemple #19
0
    ext_data.update(statespace_ext_data)
except ImportError:
    for name, data in statespace_ext_data.items():
        path = '.'.join([data["name"].split('.')[0], 'pyx.in'])
        append_cython_exclusion(path, CYTHON_EXCLUSION_FILE)

extensions = []
for name, data in ext_data.items():
    data['sources'] = data.get('sources', []) + [data['name']]

    destdir = ".".join(os.path.dirname(data["name"]).split("/"))
    data.pop('name')

    filename = data.pop('filename', name)

    obj = Extension('%s.%s' % (destdir, filename), **data)

    extensions.append(obj)


def get_data_files():
    sep = os.path.sep
    # install the datasets
    data_files = {}
    root = pjoin(curdir, "statsmodels", "datasets")
    for i in os.listdir(root):
        if i is "tests":
            continue
        path = pjoin(root, i)
        if os.path.isdir(path):
            data_files.update({
Exemple #20
0
# unfortunately, making it proper by extending build and build_ext and install
# commands is not documented
#
if '--mincdir' in sys.argv:
    index = sys.argv.index('--mincdir')
    sys.argv.pop(index)  # Removes the '--mincdir'
    MINCDIR = sys.argv.pop(index)  # Returns the element after the '--mincdir'

ext_modules = [
    Extension(
        "minc.pyezminc",  # name of extension
        [
            "minc/pyezminc.pyx", "minc/pyezminc.pxd",
            "minc/minc_1_iterators.cpp", "minc/xfm_param.cpp",
            "minc/matrix-ops.cpp"
        ],  # our Cython source
        libraries=MINCLIBS,
        include_dirs=[os.path.join(MINCDIR, 'include'),
                      numpy.get_include()],
        library_dirs=[os.path.join(MINCDIR, 'lib')],
        runtime_library_dirs=[os.path.join(MINCDIR, 'lib')],  # RPATH settings
        #extra_objects = [os.path.join(MINCDIR,'libminc_io.a')], # Use this if using static link
        language="c++")
]  # causes Cython to create C++ source

setup(name='pyezminc',
      version='1.2',
      url='https://github.com/BIC-MNI/pyezminc',
      author='Haz-Edine Assemlal',
      author_email='*****@*****.**',
      classifiers=[
          "Development Status :: 4 - Beta",
Exemple #21
0
# -*- coding: utf-8 -*-
# @Author: lenovouser
# @Date:   2019-06-20 15:57:53
# @Last Modified by:   lenovouser
# @Last Modified time: 2019-06-23 16:51:44
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

setup(
    ext_modules=cythonize([Extension("sin_of_square", ["sin_of_square.pyx"])])
)
Exemple #22
0
import os
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

os.environ["CC"] = "g++"
os.environ["CXX"] = "g++"

ext_modules = [
    Extension("pipeline", ["pipeline.pyx"]),
    Extension("custom_logger", ["custom_logger.pyx"]),
    Extension("config", ["config.pyx"]),
    # Extension("animal",  ["env/animal.py"]),  # Doesn't work due to ABC?
    Extension("env.fish", ["env/fish.pyx"]),
    Extension("env.shark", ["env/shark.pyx"]),
    Extension("env.aquarium", ["env/aquarium.pyx"]),
    Extension("env.util", ["env/util.pyx"]),
    Extension("env.animal_controller", ["env/animal_controller.pyx"]),
    Extension("env.collision", ["env/collision.pyx"])
    # Extension("view",  ["view.py"])
]

for e in ext_modules:
    e.cython_directives = {'language_level': "3"}

setup(name='aquarium_experiments',
      cmdclass={'build_ext': build_ext},
      ext_modules=ext_modules)
Exemple #23
0
        # reset the default compiler_so, which we might have changed for cuda
        self.compiler_so = default_compiler_so

    # inject our redefined _compile method into the class
    self._compile = _compile

# run the customize_compiler
class custom_build_ext(build_ext):
    def build_extensions(self):
        customize_compiler_for_nvcc(self.compiler)
        build_ext.build_extensions(self)

ext_modules = [
    Extension(
        "utils.cython_bbox",
        ["utils/bbox.pyx"],
        extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
        include_dirs = [numpy_include]
    ),
    Extension(
        "nms.cpu_nms",
        ["nms/cpu_nms.pyx"],
        extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
        include_dirs = [numpy_include]
    ),
    Extension('nms.gpu_nms',
        ['nms/nms_kernel.cu', 'nms/gpu_nms.pyx'],
        library_dirs=[CUDA['lib64']],
        libraries=['cudart'],
        language='c++',
        runtime_library_dirs=[CUDA['lib64']],
        # this syntax is specific to this build system
Exemple #24
0
    # inject our redefined _compile method into the class
    self._compile = _compile


# run the customize_compiler
class custom_build_ext(build_ext):
    def build_extensions(self):
        customize_compiler_for_nvcc(self.compiler)
        build_ext.build_extensions(self)


ext_modules = [
    Extension(
        "utils.cython_bbox",
        ["utils/bbox.pyx"],
        extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
        include_dirs = [numpy_include]
    ),
    Extension(
        "nms.cpu_nms",
        ["nms/cpu_nms.pyx"],
        extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
        include_dirs = [numpy_include]
    ),    
    Extension('nms.gpu_nms',
        ['nms/nms_kernel.cu', 'nms/gpu_nms.pyx'],
        library_dirs=[CUDA['lib64']],
        libraries=['cudart'],
        language='c++',
        runtime_library_dirs=[CUDA['lib64']],
        # this syntax is specific to this build system
Exemple #25
0
setup(
    name='cephfs',
    version=__version__,
    description="Python bindings for the Ceph FS library",
    long_description=(
        "This package contains Python bindings for interacting with the "
        "Ceph Filesystem (Ceph FS) library. Ceph FS is a POSIX-compliant "
        "filesystem that uses a Ceph Storage Cluster to store its data. The "
        "Ceph filesystem uses the same Ceph Storage Cluster system as "
        "Ceph Block Devices, Ceph Object Storage with its S3 and Swift APIs, "
        "or native bindings (librados)."),
    url='https://github.com/ceph/ceph/tree/master/src/pybind/cephfs',
    license='LGPLv2+',
    platforms='Linux',
    ext_modules=cythonize(
        [Extension("cephfs", [source], **get_python_flags(['cephfs']))],
        compiler_directives={'language_level': sys.version_info.major},
        build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
        include_path=[os.path.join(os.path.dirname(__file__), "..", "rados")]),
    classifiers=[
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)',
        'Operating System :: POSIX :: Linux', 'Programming Language :: Cython',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5'
    ],
    cmdclass=cmdclass,
)
Exemple #26
0
        cythonize(['pytesmo/time_series/filters.pyx'])


class NumpyBuildExt(_build_ext):
    def build_extensions(self):
        numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')

        for ext in self.extensions:
            if hasattr(ext,
                       'include_dirs') and not numpy_incl in ext.include_dirs:
                ext.include_dirs.append(numpy_incl)
        _build_ext.build_extensions(self)


ext_modules = [
    Extension("pytesmo.time_series.filters", ["pytesmo/time_series/filters.c"],
              include_dirs=[]),
]


def setup_package():
    cmdclass = {}
    cmdclass['cythonize'] = Cythonize
    cmdclass['build_ext'] = NumpyBuildExt
    needs_sphinx = {'build_sphinx', 'upload_docs'}.intersection(sys.argv)
    sphinx = ['sphinx'] if needs_sphinx else []
    setup(setup_requires=['six', 'pyscaffold>=2.5a0,<2.6a0'] + sphinx,
          tests_require=['pytest_cov', 'pytest', 'pytest-mpl'],
          cmdclass=cmdclass,
          ext_modules=ext_modules,
          use_pyscaffold=True)
Exemple #27
0
    def swig_generate(self):
        "build all available modules"

        def quote(s): return '"' + s + '"'

        def win_quote(s):
            if sys.platform == 'win32':
                return '"' + s + '"'
            return s

        for module in self.MODULES:
            module_name = self.MODULES[module][0]
            config_cmd = self.MODULES[module][1]
            module_pkg_name = self.MODULES[module][2]
            mod_hack_name = self.MODULES[module][3]
            mod_out_prefix = module_pkg_name.replace('.', os.sep) + module
            try:
                CPP_FLAGS = os.environ["PIVY_CPP_FLAGS"]
            except KeyError:
                CPP_FLAGS = ""

            if sys.platform == "_win32":  # this should never happen
                INCLUDE_DIR = os.path.join(os.getenv("COINDIR"), "include")
                CPP_FLAGS += "-I" + quote(INCLUDE_DIR) + " " + \
                            "-I" + quote(os.path.join(os.getenv("COINDIR"), "include", "Inventor", "annex")) + \
                            " /DCOIN_DLL /wd4244 /wd4049"
                # aquire highest non-debug Coin library version
                try:
                    LDFLAGS_LIBS = quote(
                        max(glob.glob(os.path.join(os.getenv("COINDIR"), "lib", "coin?.lib")))) + " "
                # with cmake the coin library is named Coin4.lib
                except ValueError:
                    LDFLAGS_LIBS = quote(
                        max(glob.glob(os.path.join(os.getenv("COINDIR"), "lib", "Coin?.lib")))) + " "

                if module == "sowin":
                    CPP_FLAGS += " /DSOWIN_DLL"
                    LDFLAGS_LIBS += quote(os.path.join(os.getenv("COINDIR"), "lib", "sowin1.lib"))
                elif module == "soqt":
                    CPP_FLAGS += " -I" + '"' + os.getenv("QTDIR") + "\\include\"  /DSOQT_DLL"
                    if os.path.isdir(os.getenv("QTDIR") + "\\include\Qt\""):
                        CPP_FLAGS += " -I" + '"' + os.getenv("QTDIR") + "\\include\Qt\""
                        LDFLAGS_LIBS += os.path.join(os.getenv("COINDIR"), "lib", "soqt1.lib") + " "
                    else:
                        # workaround for conda qt4:
                        CPP_FLAGS += " -I" + '"' + os.getenv("QTDIR") + "\\include\qt\Qt\""
                        CPP_FLAGS += " -I" + '"' + os.getenv("QTDIR") + "\\include\qt\""
                        LDFLAGS_LIBS += os.path.join(os.getenv("COINDIR"), "lib", "SoQt.lib") + " "
            else:
                INCLUDE_DIR = self.cmake_config_dict[config_cmd + '_INCLUDE_DIR']
                LIB_DIR = self.cmake_config_dict[config_cmd + '_LIB_DIR']
                if sys.platform == 'win32':
                    _INCLUDE_DIR = INCLUDE_DIR
                else:
                    # replace all quotes from INCLUDE_DIR
                    _INCLUDE_DIR = INCLUDE_DIR.replace('"', "")
                CPP_FLAGS += ' -I' + _INCLUDE_DIR
                CPP_FLAGS += ' -I' + os.path.join(_INCLUDE_DIR, 'Inventor', 'annex')
                if sys.platform == 'win32': 
                    CPP_FLAGS += " /DCOIN_DLL /wd4244 /wd4049"
                    LDFLAGS_LIBS = quote(max(glob.glob(os.path.join(LIB_DIR, "Coin?.lib")))) + " "
                else:
                    CPP_FLAGS += " -Wno-unused -Wno-maybe-uninitialized"
                    LDFLAGS_LIBS = ' -L' + self.cmake_config_dict[config_cmd + '_LIB_DIR']

                if module == "soqt":
                    CPP_FLAGS += ' -I' + win_quote(self.QTINFO.getHeadersPath())
                    CPP_FLAGS += ' -I' + win_quote(os.path.join(self.QTINFO.getHeadersPath(), 'QtCore'))
                    CPP_FLAGS += ' -I' + win_quote(os.path.join(self.QTINFO.getHeadersPath(), 'QtGui'))
                    CPP_FLAGS += ' -I' + win_quote(os.path.join(self.QTINFO.getHeadersPath(), 'QtOpenGL'))
                    CPP_FLAGS += ' -I' + win_quote(os.path.join(self.QTINFO.getHeadersPath(), 'QtWidgets'))
                    if sys.platform == 'win32':
                        LDFLAGS_LIBS += " " + quote(max(glob.glob(os.path.join(LIB_DIR, "SoQt?.lib")))) + " "
                        CPP_FLAGS += " /DSOQT_DLL"
                    else:
                        LDFLAGS_LIBS += ' -lSoQt'
                
                if module == "coin":
                    if sys.platform == 'win32':
                        pass
                    else:
                        LDFLAGS_LIBS += ' -lCoin'

            if not os.path.isfile(mod_out_prefix + "_wrap.cpp"):
                print(red("\n=== Generating %s_wrap.cpp for %s ===\n" %
                          (mod_out_prefix, module)))
                print(blue(self.SWIG + " " + self.SWIG_SUPPRESS_WARNINGS + " " + self.SWIG_PARAMS %
                           (INCLUDE_DIR,
                            self.CXX_INCS,
                            mod_out_prefix, module)))
                if os.system(self.SWIG + " " + self.SWIG_SUPPRESS_WARNINGS + " " + self.SWIG_PARAMS %
                             (INCLUDE_DIR,
                              self.CXX_INCS,
                              mod_out_prefix, mod_hack_name)):
                    print(red("SWIG did not generate wrappers successfully! ** Aborting **"))
                    sys.exit(1)
            else:
                print(red("=== %s_wrap.cpp for %s already exists! ===" %
                          (mod_out_prefix, module_pkg_name + module)))

            self.ext_modules.append(Extension(module_name, [mod_out_prefix + "_wrap.cpp"],
                                              extra_compile_args=(
                                                  self.CXX_INCS + CPP_FLAGS).split(),
                                              extra_link_args=(self.CXX_LIBS + LDFLAGS_LIBS).split()))
Exemple #28
0
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 12 14:18:20 2015

@author: ash
"""

from distutils.core import setup
from distutils.extension import Extension

setup(
    name='evoMPS-ext-pure-c',
    ext_modules=[
        Extension("evoMPS.eps_maps_c", ["evoMPS/eps_maps_c.c"],
                  libraries=["cblas"],
                  extra_compile_args=['-fopenmp'],
                  extra_link_args=['-fopenmp'])
    ]  #for openmp with gcc
)
Exemple #29
0
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup
from distutils.extension import Extension

import sys
import os.path

version = "1.8"

SOURCES = ["acora/_acora", "acora/_nfa2dfa"]
BASEDIR = os.path.dirname(__file__)

extensions = [
    Extension("acora._acora", ["acora/_acora.pyx"]),
    Extension("acora._nfa2dfa", ["acora/_nfa2dfa.py"]),
]

try:
    sys.argv.remove('--with-cython')
except ValueError:
    USE_CYTHON = False
else:
    USE_CYTHON = True

try:
    sys.argv.remove('--no-compile')
except ValueError:
    if not all(
            os.path.exists(os.path.join(BASEDIR, sfile + '.c'))
Exemple #30
0
np_inc = os.path.join(numpy.__path__[0], 'core', 'include')

# use additional compiler flags: "-ffast-math" "-g"

# FIXME this only works for EPD?
if platform.system() == "Windows":
    lib_path = "C:\Python26\PCbuild"
else:
    lib_path = "/usr/lib"

setup(name="nut.externals.bolt",
      ext_modules=[
          Extension("nut.externals.bolt.trainer.sgd",
                    ["nut/externals/bolt/trainer/sgd.c"],
                    include_dirs=[np_inc],
                    extra_link_args=["-O3"],
                    library_dirs=[
                        lib_path,
                    ],
                    extra_compile_args=["-O3", "-g"]),
          Extension("nut.externals.bolt.trainer.avgperceptron",
                    ["nut/externals/bolt/trainer/avgperceptron.c"],
                    include_dirs=[np_inc],
                    extra_link_args=["-O3"],
                    library_dirs=[
                        lib_path,
                    ],
                    extra_compile_args=["-O3", "-g"]),
          Extension("nut.externals.bolt.trainer.maxent",
                    ["nut/externals/bolt/trainer/maxent.c"],
                    include_dirs=[np_inc],
                    extra_link_args=["-O3"],