Beispiel #1
0
    def package_info(self):
        # PCL has a find script which populates variables holding include paths
        # and libs, but since it doesn't define a target, and re-searches for
        # Eigen and other dependencies, it's a little annoying to use - still,
        # it's available by adding the resdir (below) to the CMAKE_MODULE_DIR
        #
        # While this might break encapsulation a little, we will add the libs
        # to the package info such that we can simply use the conan package if
        # we wish.

        (pcl_release, pcl_major) = [int(i) for i in self.version.split('.')[:2]]
        pcl_version_str = f'{pcl_release}.{pcl_major}'

        # Add the directory with CMake.. Not sure if this is a good use of resdirs
        self.cpp_info.resdirs = [self.pcl_cmake_dir]

        # Add the real include path, the default one points to include/ but the one
        # we use is include/pcl-1.8
        self.cpp_info.includedirs = [os.path.join('include', f'pcl-{pcl_version_str}')]

        # Populate the libs
        self.cpp_info.libs = tools.collect_libs(self)

        if self.options.shared and 'Windows' == self.settings.os:
            # Add our libs to PATH
            self.env_info.path.append(os.path.join(self.package_folder, 'lib'))

        # Populate the pkg-config environment variables
        with tools.pythonpath(self):
            from platform_helpers import adjustPath, appendPkgConfigPath

            self.env_info.PKG_CONFIG_PCL_PREFIX = adjustPath(self.package_folder)
            appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info)
Beispiel #2
0
    def package_info(self):
        # For now, don't export the lib
        # self.cpp_info.libs = tools.collect_libs(self)

        # Populate the pkg-config environment variables
        with tools.pythonpath(self): # Compensate for #2644
            from platform_helpers import adjustPath, appendPkgConfigPath

            self.env_info.PKG_CONFIG_MPFR_PREFIX = adjustPath(self.package_folder)
            appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info)
Beispiel #3
0
    def package_info(self):
        self.cpp_info.libs = ['ffi']
        self.env_info.MANPATH.append(os.path.join(self.package_folder, 'share', 'man'))

        # Populate the pkg-config environment variables
        with tools.pythonpath(self):
            from platform_helpers import adjustPath, appendPkgConfigPath

            self.env_info.PKG_CONFIG_LIBFFI_PREFIX = adjustPath(self.package_folder)
            appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info)
    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)

        # Populate the pkg-config environment variables
        with tools.pythonpath(self):
            from platform_helpers import adjustPath, appendPkgConfigPath
            self.env_info.PKG_CONFIG_FLANN_PREFIX = adjustPath(self.package_folder)
            appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info)

        if tools.os_info.is_windows:
            # console_bridge installs the dll to the lib directory.  We prefer to
            # see it in the bin/ directory, but because there are CMake files and
            # stuff, we're just going to point bin at lib for simplicity.
            self.cpp_info.bindirs = self.cpp_info.libdirs
Beispiel #5
0
    def build(self):
        from platform_helpers import adjustPath

        cmake = CMake(self)

        # Qt exposes pkg-config files (at least on Linux, on Windows there are
        # .prl files *shrugs*, but PCL (pcl_find_qt5.cmake) doesn't use this.
        qt_deps = ['Core', 'Gui', 'OpenGL', 'Widgets', 'Svg']
        for p in qt_deps:
            cmake.definitions[f'Qt5{p}_DIR:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['qt'].rootpath, 'lib', 'cmake', f'Qt5{p}'))
        cmake.definitions['QT_QMAKE_EXECUTABLE:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['qt'].rootpath, 'bin', 'qmake'))

        cmake.configure(source_folder=self.name)
        cmake.build()
        cmake.install()
Beispiel #6
0
    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)

        # Populate the pkg-config environment variables
        with tools.pythonpath(self):
            from platform_helpers import adjustPath, appendPkgConfigPath

            pkg_config_path = os.path.join(self.package_folder, 'lib',
                                           'pkgconfig')
            appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)

            pc_files = glob.glob(
                adjustPath(os.path.join(pkg_config_path, '*.pc')))
            for f in pc_files:
                p_name = re.sub(r'\.pc$', '', os.path.basename(f))
                p_name = re.sub(r'\W', '_', p_name.upper())
                setattr(self.env_info, 'PKG_CONFIG_%s_PREFIX' % p_name,
                        adjustPath(self.package_folder))

            appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)
Beispiel #7
0
    def _set_up_cmake(self):
        # Import from helpers/x@ntc/stable
        from platform_helpers import adjustPath

        # Environment to perhaps populate
        env = {}

        cmake = CMake(self)

        cmake.definitions['STATIC'] = 'FALSE' if self.options.shared else 'TRUE'

        qt_deps = ['Core', 'Quick', 'Widgets', 'QuickTest']
        for p in qt_deps:
            cmake.definitions[f'Qt5{p}_DIR:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['qt'].rootpath, 'lib', 'cmake', f'Qt5{p}'))
        cmake.definitions['QT_QMAKE_EXECUTABLE:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['qt'].rootpath, 'bin', 'qmake'))
        if tools.os_info.is_windows:
            env['PATH'] = os.environ.get('PATH', '').split(';')
            env['PATH'].extend([adjustPath(os.path.join(self.deps_cpp_info['qt'].rootpath, p)) for p in ['bin']])

        if 'vlc' in self.deps_cpp_info.deps:
            def findLibInList(base, libs, name):
                """
                Search the list of libs for the one we want.
                On Windows, prefer the (shared) lib<lib>.lib to the <lib>.lib
                """
                test_lib = 'lib' + name
                if tools.os_info.is_windows:
                    test_lib = 'lib' + name + '.lib'
                else:
                    test_lib = 'lib' + name + '.so'
                test_lib = os.path.join(base, test_lib)
                test_lib = adjustPath(test_lib)
                if os.path.exists(test_lib):
                    return test_lib
                else:
                    raise ValueError('Could not find %s base=%s libs=%s'%(name, base, ', '.join(libs)))

            if 'vlc' in self.deps_cpp_info.deps:
                cmake.definitions['LIBVLC_LIBRARY:PATH']     = adjustPath(findLibInList(base=os.path.join(self.deps_cpp_info['vlc'].rootpath, self.deps_cpp_info['vlc'].libdirs[0]), libs=self.deps_cpp_info['vlc'].libs, name='vlc'))
                cmake.definitions['LIBVLCCORE_LIBRARY:PATH'] = adjustPath(findLibInList(base=os.path.join(self.deps_cpp_info['vlc'].rootpath, self.deps_cpp_info['vlc'].libdirs[0]), libs=self.deps_cpp_info['vlc'].libs, name='vlccore'))
                cmake.definitions['LIBVLC_INCLUDE_DIR:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['vlc'].rootpath, self.deps_cpp_info['vlc'].includedirs[0]))
                cmake.definitions['LIBVLC_BIN_DIR:PATH']     = adjustPath(os.path.join(self.deps_cpp_info['vlc'].rootpath, self.deps_cpp_info['vlc'].bindirs[0]))

        if tools.os_info.is_windows and 'Visual Studio' == self.settings.compiler:
            # The creator of VLC Qt seems to prefer nmake, and in fact doesn't
            # support stuff build with regular VS (see
            # https://github.com/vlc-qt/vlc-qt/issues/193 )
            self.output.info('Using NMake Generator')
            cmake.generator='NMake Makefiles'

        s = '\nCMake Definitions:\n'
        for k,v in cmake.definitions.items():
            s += ' - %s=%s\n'%(k, v)
        self.output.info(s)

        return cmake, env
Beispiel #8
0
    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)
        self.env_info.CMAKE_PREFIX_PATH.append(os.path.join(self.package_folder, 'lib', 'cmake'))

        if tools.os_info.is_windows:
            # VLC-Qt appears to copy all of VLC's plugins to it's local bin
            # directory.  This env var is required or else VLC cannot be
            # loaded. (Though, we could likely also just point to the vlc/../bin/plugins
            self.env_info.VLC_PLUGIN_PATH = os.path.join(self.package_folder, 'bin', 'plugins')

        # Populate the pkg-config environment variables
        with tools.pythonpath(self):
            from platform_helpers import adjustPath, appendPkgConfigPath

            pkg_config_path = os.path.join(self.package_folder, 'lib', 'pkgconfig')
            appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)

            pc_files = glob.glob(adjustPath(os.path.join(pkg_config_path, '*.pc')))
            for f in pc_files:
                p_name = re.sub(r'\.pc$', '', os.path.basename(f))
                p_name = re.sub(r'\W', '_', p_name.upper())
                setattr(self.env_info, f'PKG_CONFIG_{p_name}_PREFIX', adjustPath(self.package_folder))

            appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)
Beispiel #9
0
 def findLibInList(base, libs, name):
     """
     Search the list of libs for the one we want.
     On Windows, prefer the (shared) lib<lib>.lib to the <lib>.lib
     """
     test_lib = 'lib' + name
     if tools.os_info.is_windows:
         test_lib = 'lib' + name + '.lib'
     else:
         test_lib = 'lib' + name + '.so'
     test_lib = os.path.join(base, test_lib)
     test_lib = adjustPath(test_lib)
     if os.path.exists(test_lib):
         return test_lib
     else:
         raise ValueError('Could not find %s base=%s libs=%s'%(name, base, ', '.join(libs)))
Beispiel #10
0
    def _fixPkgConfig(self):
        """ Replace variables based on a prefix with a prefix.  Right now ffmpeg pkg-config variables use pull paths """

        from platform_helpers import adjustPath
        self.output.info('Modifying pkg-config variables (libdir, includedir, ..) to start with ${prefix}')

        pkg_config_path = os.path.join(self.package_folder, 'lib', 'pkgconfig')
        pc_files = glob.glob(adjustPath(os.path.join(pkg_config_path, '*.pc')))
        for pc_file_name in pc_files:
            with open(pc_file_name) as f: data = f.read()
            m = re.search('prefix=(?P<prefix>.*)', data)
            if m:
                data = data.replace('prefix=%s'%m.group('prefix'), 'PREFIX_LINE')
                data = data.replace(m.group('prefix'), '${prefix}')
                data = data.replace('PREFIX_LINE', 'prefix=%s'%m.group('prefix'))
                with open(pc_file_name, 'w') as f: f.write(data)
Beispiel #11
0
    def _set_up_cmake(self):
        """
        Set up the CMake generator so that it can be used in build() and package()
        """

        # Import from helpers/x@ntc/stable
        from platform_helpers import adjustPath

        if 'vtk' in self.deps_cpp_info.deps:
            vtk_major = '.'.join(self.deps_cpp_info['vtk'].version.split('.')[:2])

            # TODO See if we can use self.deps_cpp_info['vtk'].res
            vtk_cmake_rel_dir = f'lib/cmake/vtk-{vtk_major}'
            vtk_cmake_dir = f'{self.deps_cpp_info["vtk"].rootpath}/{vtk_cmake_rel_dir}'

        # Create our CMake generator
        cmake = CMake(self)

        # Boost
        cmake.definitions['BOOST_ROOT:PATH'] = adjustPath(self.deps_cpp_info['boost'].rootpath)

        if 'fPIC' in self.options and self.options.fPIC:
            cmake.definitions['CMAKE_POSITION_INDEPENDENT_CODE:BOOL'] = 'ON'
        if self.options.cxx11:
            cmake.definitions['CMAKE_CXX_STANDARD'] = 11

        cxx_flags = []
        if self.settings.compiler in ['gcc']:
            if not self.settings.get_safe('arch').startswith('arm'):
                cxx_flags.append('-mtune=generic')
            cxx_flags.append('-frecord-gcc-switches')

        if len(cxx_flags):
            cmake.definitions['ADDITIONAL_CXX_FLAGS:STRING'] = ' '.join(cxx_flags)

        # QHull
        # Note: PCL searches for the Release and Debug version of Qhull, and
        # fails if it cannot find the Release version, so, only the release
        # version should be provided.
        if 'qhull' in self.deps_cpp_info.deps:
            cmake.definitions['QHULL_ROOT:PATH'] = adjustPath(self.deps_cpp_info['qhull'].rootpath)

        # GTest
        if 'gtest' in self.deps_cpp_info.deps:
            cmake.definitions['GTEST_ROOT:PATH'] = adjustPath(self.deps_cpp_info['gtest'].rootpath)

        # VTK
        if 'vtk' in self.deps_cpp_info.deps:
            cmake.definitions['VTK_DIR:PATH']    = adjustPath(vtk_cmake_dir)
        else:
            cmake.definitions['WITH_VTK:BOOL'] = 'OFF'

        # Zlib
        cmake.definitions['ZLIB_ROOT:PATH'] = self.deps_cpp_info['zlib'].rootpath

        # PCL Options
        cmake.definitions['BUILD_surface_on_nurbs:BOOL'] = 'ON'
        cmake.definitions['BUILD_SHARED_LIBS:BOOL'] = 'ON' if self.options.shared else 'OFF'
        if 'Windows' == self.settings.os:
            cmake.definitions['PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32:BOOL'] = 'ON' if self.options['boost'].shared else 'OFF'

        if 'qt' in self.deps_cpp_info.deps:
            # Qt exposes pkg-config files (at least on Linux, on Windows there are
            # .prl files *shrugs*, but PCL (pcl_find_qt5.cmake) doesn't use this.
            qt_deps = ['Core', 'Gui', 'OpenGL', 'Widgets']
            if 'vtk' in self.deps_cpp_info.deps and '7' >= Version(str(self.deps_cpp_info['vtk'].version)):
                qt_deps.append('') # VTK 7 wants Qt5Config (note p='' in Qt5{p}Config)
            for p in qt_deps:
                cmake.definitions[f'Qt5{p}_DIR:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['qt'].rootpath, 'lib', 'cmake', f'Qt5{p}'))
            cmake.definitions['QT_QMAKE_EXECUTABLE:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['qt'].rootpath, 'bin', 'qmake'))
        else:
            cmake.definitions['WITH_QT:BOOL'] = 'OFF'

        # Eigen: Despite being provided with pkg-config, and 1.7.2 finding
        # these successfully with pkg-config, cmake evidentially still requires
        # EIGEN_INCLUDE_DIR ... *shrugs*
        cmake.definitions['EIGEN_INCLUDE_DIR:PATH'] = adjustPath(os.path.join(self.deps_cpp_info['eigen'].rootpath, 'include', 'eigen3'))

        # Flann is found via pkg-config

        env_info = {}
        if 'Linux' == self.settings.os:
            # There's an issue when using boost with shared bzip2 where the shared
            # lib path isn't exposed, and as such PCL can't link.  So here we
            # inject the path into our linker path.
            env_info['LD_LIBRARY_PATH'] = os.path.join(self.deps_cpp_info['bzip2'].rootpath, 'lib')

        return cmake, env_info
Beispiel #12
0
    def package_info(self):
        libs = ['avdevice', 'avfilter', 'avformat', 'avcodec', 'swresample', 'swscale', 'avutil']
        if self.options.postproc:
            libs.append('postproc')
        if self.settings.compiler == 'Visual Studio':
            if self.options.shared:
                self.cpp_info.libs = libs
                self.cpp_info.libdirs.append('bin')
            else:
                self.cpp_info.libs = ['lib' + lib for lib in libs]
        else:
            self.cpp_info.libs = libs
        if self.settings.os == "Macos":
            frameworks = ['CoreVideo', 'CoreMedia', 'CoreGraphics', 'CoreFoundation', 'OpenGL', 'Foundation']
            if self.options.appkit:
                frameworks.append('AppKit')
            if self.options.avfoundation:
                frameworks.append('AVFoundation')
            if self.options.coreimage:
                frameworks.append('CoreImage')
            if self.options.audiotoolbox:
                frameworks.append('AudioToolbox')
            if self.options.videotoolbox:
                frameworks.append('VideoToolbox')
            if self.options.vda:
                frameworks.append('VideoDecodeAcceleration')
            if self.options.securetransport:
                frameworks.append('Security')
            for framework in frameworks:
                self.cpp_info.exelinkflags.append("-framework %s" % framework)
            self.cpp_info.sharedlinkflags = self.cpp_info.exelinkflags
        elif self.settings.os == "Linux":
            self.cpp_info.libs.extend(['dl', 'pthread'])
            if self.options.alsa:
                self.cpp_info.libs.append('asound')
            if self.options.jack:
                self.cpp_info.libs.append('jack')
            if self.options.pulse:
                self.cpp_info.libs.append('pulse')
            if self.options.vaapi:
                self.cpp_info.libs.extend(['va', 'va-drm', 'va-x11'])
            if self.options.vdpau:
                self.cpp_info.libs.extend(['vdpau', 'X11'])
            if self.options.xcb:
                self.cpp_info.libs.extend(['xcb', 'xcb-shm', 'xcb-shape', 'xcb-xfixes'])
        elif self.settings.os == "Windows":
            self.cpp_info.libs.extend(['ws2_32', 'secur32', 'shlwapi', 'strmiids', 'vfw32'])

        # Populate the pkg-config environment variables
        with tools.pythonpath(self):
            from platform_helpers import adjustPath, appendPkgConfigPath

            pkg_config_path = os.path.join(self.package_folder, 'lib', 'pkgconfig')
            appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)

            pc_files = glob.glob(adjustPath(os.path.join(pkg_config_path, '*.pc')))
            for f in pc_files:
                p_name = re.sub(r'\.pc$', '', os.path.basename(f))
                p_name = re.sub(r'\W', '_', p_name.upper())
                setattr(self.env_info, f'PKG_CONFIG_{p_name}_PREFIX', adjustPath(self.package_folder))

            appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)