Esempio n. 1
0
    CMAKE_CONFIGURE_EXTENSION_OPTIONS.append(
        f"-DCMAKE_MODULE_PATH={os.environ['CMAKE_MODULE_PATH']}")

if "CMAKE_PREFIX_PATH" in os.environ:
    CMAKE_CONFIGURE_EXTENSION_OPTIONS.append(
        f"-DCMAKE_PREFIX_PATH={os.environ['CMAKE_PREFIX_PATH']}")

if "CMAKE_TOOLCHAIN_FILE" in os.environ and os.environ["CMAKE_TOOLCHAIN_FILE"]:
    CMAKE_CONFIGURE_EXTENSION_OPTIONS.append(
        f"--toolchain={os.environ['CMAKE_TOOLCHAIN_FILE']}")

ext_modules = [
    cmake_build_extension.CMakeExtension(name='cyhal',
                                         install_prefix="machinekit/hal/cyhal",
                                         source_dir=str(
                                              pathlib.Path(__file__).absolute().parent),
                                         cmake_build_type=os.environ.get(
                                             "MACHINEKIT_HAL_BUILD_CONFIG", "Release"),
                                         cmake_configure_options=[
                                             "-DBUILD_SHARED_LIBS:BOOL=FALSE",
                                         ] + CMAKE_CONFIGURE_EXTENSION_OPTIONS
                                         )
]

cmdclass = dict(build_ext=cmake_build_extension.BuildExtension)


def build(setup_kwargs, **kwargs):
    setup_kwargs.update(ext_modules=ext_modules,
                        cmdclass=cmdclass)
Esempio n. 2
0
 # The resulting "mymath" archive contains two packages: mymath_swig and mymath_pybind.
 # This approach separates the two bindings types, typically just one of them is used.
 ext_modules=[
     cmake_build_extension.CMakeExtension(
         # This could be anything you like, it is used to create build folders
         name="SwigBindings",
         # Name of the resulting package name (import mymath_swig)
         install_prefix="mymath_swig",
         # Exposes the binary print_answer to the environment.
         # It requires also adding a new entry point in setup.cfg.
         expose_binaries=["bin/print_answer"],
         # Writes the content to the top-level __init__.py
         write_top_level_init=init_py,
         # Selects the folder where the main CMakeLists.txt is stored
         # (it could be a subfolder)
         source_dir=str(Path(__file__).parent.absolute()),
         cmake_configure_options=[
             # This option points CMake to the right Python interpreter, and helps
             # the logic of FindPython3.cmake to find the active version
             f"-DPython3_ROOT_DIR={Path(sys.prefix)}",
             "-DCALL_FROM_SETUP_PY:BOOL=ON",
             "-DBUILD_SHARED_LIBS:BOOL=OFF",
             # Select the bindings implementation
             "-DEXAMPLE_WITH_SWIG:BOOL=ON",
             "-DEXAMPLE_WITH_PYBIND11:BOOL=OFF",
         ]
         + CIBW_CMAKE_OPTIONS,
     ),
     cmake_build_extension.CMakeExtension(
         name="Pybind11Bindings",
         # Name of the resulting package name (import mymath_pybind11)
Esempio n. 3
0
 cmake_build_extension.CMakeExtension(
     name="CMakeProject",
     install_prefix="yarp",
     expose_binaries=[
         "bin/yarp",
         "bin/yarp-config",
         "bin/yarpdatadumper",
         "bin/yarpdev",
         "bin/yarphear",
         "bin/yarpidl_rosmsg",
         "bin/yarpidl_thrift",
         "bin/yarpmanager-console",
         "bin/yarprobotinterface",
         "bin/yarpros",
         "bin/yarprun",
         "bin/yarpserver",
     ],
     disable_editable=True,
     cmake_depends_on=["ycm_cmake_modules"],
     write_top_level_init="from .bindings.yarp import *",
     source_dir=source_dir,
     cmake_configure_options=[
         f"-DPython3_EXECUTABLE:PATH={sys.executable}",
         "-DCMAKE_BUILD_TYPE=Release",
         "-DBUILD_SHARED_LIBS:BOOL=OFF",
         "-DYARP_COMPILE_BINDINGS:BOOL=ON",
         "-DCREATE_PYTHON:BOOL=ON",
         "-DCMAKE_INSTALL_PYTHON3DIR:PATH='bindings/'",
         "-DYARP_COMPILE_EXAMPLES:BOOL=OFF",
         "-DYARP_COMPILE_GUIS:BOOL=OFF",
         "-DYARP_COMPILE_TESTS:BOOL=OFF",
         "-DYARP_COMPILE_UNMAINTAINED:BOOL=OFF",
         "-DYARP_COMPILE_libYARP_math:BOOL=ON",
         "-DYARP_PYTHON_PIP_METADATA_INSTALL:BOOL=OFF".
     ]
     + CIBW_CMAKE_OPTIONS,
 )
Esempio n. 4
0
import sys

import cmake_build_extension
import setuptools

setuptools.setup(
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name="InstallAllTargets",
            install_prefix="gazebo_yarp_synchronizer",
            cmake_depends_on=["pybind11", "yarp", "ycm_cmake_modules"],
            disable_editable=True,
            cmake_configure_options=[
                f"-DPython3_EXECUTABLE:PATH={sys.executable}",
                "-DBUILD_SHARED_LIBS:BOOL=OFF",
                "-DGYS_CALL_FROM_SETUP_PY:BOOL=ON",
            ],
        )
    ],
    cmdclass=dict(build_ext=cmake_build_extension.BuildExtension),
)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import pathlib
import setuptools

import cmake_build_extension

cmake_flags = [
    "-DBUILD_SHARED_LIBS:BOOL=OFF",
    "-DCALL_FROM_SETUP_PY:BOOL=ON",
]
if "CMAKE_FLAGS" in os.environ:
    flags = os.environ["CMAKE_FLAGS"]
    cmake_flags.extend(flags.split())

setuptools.setup(
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name="realsr-ncnn-vulkan-python",
            install_prefix="realsr_ncnn_vulkan_python",
            write_top_level_init=
            "from .realsr_ncnn_vulkan import Realsr, RealSR, wrapped",
            source_dir=str(
                pathlib.Path(__file__).parent / "realsr_ncnn_vulkan_python"),
            cmake_configure_options=cmake_flags,
        )
    ],
    cmdclass={"build_ext": cmake_build_extension.BuildExtension},
)
Esempio n. 6
0
    # Install from sdist
    source_dir = str(Path(".").absolute())
else:
    # Install from sources or build wheel
    source_dir = str(Path(".").absolute().parent.parent)

if "CIBUILDWHEEL" in os.environ and os.environ["CIBUILDWHEEL"] == "1":
    CIBW_CMAKE_OPTIONS = ["-DCMAKE_INSTALL_LIBDIR=lib"]
else:
    CIBW_CMAKE_OPTIONS = []

setup(
    cmdclass=dict(
        build_ext=cmake_build_extension.BuildExtension,
        sdist=cmake_build_extension.GitSdistFolder,
    ),
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name="CMakeProject",
            install_prefix="ycm_cmake_modules",
            disable_editable=True,
            write_top_level_init="",
            source_dir=source_dir,
            cmake_configure_options=[
                "-DBUILD_TESTING:BOOL=OFF",
                "-DYCM_NO_DEPRECATED:BOOL=ON",
            ] + CIBW_CMAKE_OPTIONS,
        ),
    ],
)
Esempio n. 7
0
# Copyright (C) 2020 Istituto Italiano di Tecnologia (IIT). All rights reserved.
# This software may be modified and distributed under the terms of the
# GNU Lesser General Public License v2.1 or any later version.

from pathlib import Path

import cmake_build_extension
import setuptools

setuptools.setup(
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name="actuation_delay",
            source_dir=str(Path(".") / "plugins" / "actuation_delay"),
            install_prefix="gazebo_scenario_plugins",
            cmake_depends_on=["scenario"],
            disable_editable=True,
        ),
        cmake_build_extension.CMakeExtension(
            name="low_pass_target",
            source_dir=str(Path(".") / "plugins" / "low_pass_target"),
            install_prefix="gazebo_scenario_plugins",
            cmake_depends_on=["scenario"],
            disable_editable=True,
        ),
    ],
    cmdclass=dict(build_ext=cmake_build_extension.BuildExtension),
)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import pathlib
import setuptools

import cmake_build_extension

cmake_flags = [
    "-DBUILD_SHARED_LIBS:BOOL=OFF",
    "-DCALL_FROM_SETUP_PY:BOOL=ON",
]
cmake_flags.extend(os.environ.get("CMAKE_FLAGS", "").split())

setuptools.setup(
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name="srmd-ncnn-vulkan-python",
            install_prefix="srmd_ncnn_vulkan_python",
            write_top_level_init="from .srmd_ncnn_vulkan import Srmd, SRMD",
            source_dir=str(
                pathlib.Path(__file__).parent / "srmd_ncnn_vulkan_python"),
            cmake_configure_options=cmake_flags,
        )
    ],
    cmdclass={"build_ext": cmake_build_extension.BuildExtension},
)
Esempio n. 9
0
    with _cmake_build_extension.build_extension_env():
        from ._pyopendds import *
    """
)

setup(
    packages=find_packages(),
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name='_pyopendds',
            install_prefix='_pyopendds',
            source_dir='pyopendds/ext',
            write_top_level_init=init_py,
            cmake_configure_options=[
                f'-DPython3_ROOT_DIR={Path(sys.prefix)}',
                '-DCALL_FROM_SETUP_PY:BOOL=ON',
                '-DPYOPENDDS_INCLUDE='
                    + str(Path(__file__).resolve().parent / 'pyopendds/dev/include'),
                # https://github.com/diegoferigo/cmake-build-extension/issues/26
                f"-DCMAKE_MAKE_PROGRAM={shutil.which('ninja')}",
            ],
            cmake_build_type=build_type,
        )
    ],
    cmdclass=dict(build_ext=cmake_build_extension.BuildExtension),
    entry_points={
        'console_scripts': [
            'itl2py=pyopendds.dev.itl2py.__main__:main',
        ],
    },
    package_data={
Esempio n. 10
0
build_type = os.environ.get('PYOPENDDS_BUILD_TYPE', 'Release')
init_py = inspect.cleandoc("""
    import cmake_build_extension as _cmake_build_extension
    with _cmake_build_extension.build_extension_env():
        from .{{ native_package_name }} import *
    """)

setup(
    name='{{ package_name }}',
    packages=find_packages(),
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name='{{ native_package_name }}',
            install_prefix='{{ native_package_name }}',
            source_dir='.',
            write_top_level_init=init_py,
            cmake_configure_options=[
                f'-DPython3_ROOT_DIR={python_root}',
                '-DCALL_FROM_SETUP_PY:BOOL=ON',
                f'-DPYOPENDDS_INCLUDE={pyopendds_include}',
            ],
            cmake_build_type=build_type,
        )
    ],
    cmdclass=dict(build_ext=cmake_build_extension.BuildExtension),
    install_requires=[
        'pyopendds',
        'cmake-build-extension',
    ],
)
Esempio n. 11
0
    import cmake_build_extension as _cmake_build_extension
    with _cmake_build_extension.build_extension_env():
        from ._pyopendds import *
    """
)

setup(
    packages=find_packages(),
    ext_modules=[
        cmake_build_extension.CMakeExtension(
            name='_pyopendds',
            install_prefix='_pyopendds',
            source_dir='pyopendds/ext',
            write_top_level_init=init_py,
            cmake_configure_options=[
                f'-DPython3_ROOT_DIR={Path(sys.prefix)}',
                '-DCALL_FROM_SETUP_PY:BOOL=ON',
                '-DPYOPENDDS_INCLUDE='
                + str(Path(__file__).resolve().parent / 'pyopendds/dev/include'),
            ],
            cmake_build_type=build_type,
        )
    ],
    cmdclass=dict(build_ext=cmake_build_extension.BuildExtension),
    entry_points={
        'console_scripts': [
            'itl2py=pyopendds.dev.itl2py.__main__:main',
            'pyidl=pyopendds.dev.pyidl.__main__:run',
        ],
    },
    package_data={