예제 #1
0
 def build(self):
     cmake = CMake(self)
     for option_name in self.options.values.fields:
         activated = getattr(self.options, option_name)
         if option_name == "shared":
             cmake.definitions["POCO_STATIC"] = "OFF" if activated else "ON"
         elif not option_name == "fPIC":
             cmake.definitions[
                 option_name.upper()] = "ON" if activated else "OFF"
     # Cross-compile toolchains
     if self.settings.os == "Android":
         cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = os.path.join(
             os.environ["ANDROID_HOME"],
             "ndk-bundle/build/cmake/android.toolchain.cmake")
     elif self.settings.os == "iOS":
         cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = os.path.join(
             os.environ["TRAVIS_BUILD_DIR"], "ios.toolchain.cmake")
     self.output.info(cmake.definitions)
     os.mkdir(".build")
     # Build debug & release
     if cmake.is_multi_configuration:
         cmake.configure(source_folder="poco", build_folder=".build")
         for config in ("Debug", "Release"):
             self.output.info("Building {}".format(config))
             cmake.build_type = config
             cmake.build()
     else:
         for config in ("Debug", "Release"):
             self.output.info("Building {}".format(config))
             cmake.build_type = config
             cmake.configure(source_folder="poco", build_folder=".build")
             cmake.build()
             shutil.rmtree(".build/CMakeFiles")
             os.remove(".build/CMakeCache.txt")
예제 #2
0
    def _configure_cmake(self):
        cmake = CMake(self)

        if self.settings.build_type=="Release":
            cmake.build_type = 'RelWithDebInfo'

        if ("fPIC" in self.options.fields and self.options.fPIC == True):
            cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = True

        if self.settings.os == "Windows" and self.settings.build_type == "Debug":
            cmake.definitions["TBB_USE_DEBUG_BUILD"] = True # link against tbb_debug.lib/a

        cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared

        cmake.definitions["PXR_BUILD_ALEMBIC_PLUGIN"] = True
        cmake.definitions["PXR_ENABLE_HDF5_SUPPORT"] = True
        cmake.definitions["USE_STATIC_HDF5"] = True
        #cmake.definitions["PXR_BUILD_OPENIMAGEIO_PLUGIN"] = True
        #cmake.definitions["PXR_BUILD_OPENCOLORIO_PLUGIN"] = True
        #cmake.definitions["PXR_ENABLE_PTEX_SUPPORT"] = True
        cmake.definitions["PXR_BUILD_MATERIALX_PLUGIN"] = True

        cmake.definitions["PXR_BUILD_TESTS"] = False
        cmake.definitions["PXR_BUILD_USDVIEW"] = False
        cmake.definitions["PXR_BUILD_IMAGING"] = False
        cmake.definitions["PXR_ENABLE_GL_SUPPORT"] = False
        cmake.definitions["PXR_ENABLE_PYTHON_SUPPORT"] = False

        cmake.configure(source_dir="USD-%s" % self.version)
        return cmake
예제 #3
0
    def build_cmake(self):
        defs = {"CMAKE_VERBOSE_MAKEFILE:BOOL": "ON", "ENABLE_CONAN:BOOL": "ON"}
        if self.settings.os == "Windows":
            cmake = CMake(self, generator="Ninja")
            defs.update({k: os.environ.get(k) for k in ["CMAKE_PREFIX_PATH"]})
            defs["Boost_USE_STATIC_LIBS"] = "ON"
        else:
            cmake = CMake(self, generator=None)
            defs.update({"GTIRB_PPRINTER_STRIP_DEBUG_SYMBOLS:BOOL": "ON"})

        revision = os.environ.get("CI_COMMIT_SHORT_SHA")
        if revision:
            defs["GTIRB_PPRINTER_BUILD_REVISION"] = revision

        if self.settings.build_type == "Release":
            cmake.build_type = "RelWithDebInfo"
        self.add_dep_lib_path("capstone")
        cmake.configure(source_folder=".", defs=defs)
        cmake.build()
        # The tests need the built gtirb-pprinter on the path
        bin_dir = os.path.join(os.getcwd(), "bin")
        os.environ["PATH"] = os.pathsep.join([os.environ["PATH"], bin_dir])
        cmake.test(output_on_failure=True)
        cmake.install()
        # The patch_config_paths() function will change absolute paths in the
        # exported cmake config files to use the appropriate conan variables
        # instead.
        # It is an experimental feature of conan, however, so if you're having
        # trouble with paths in the cmake of the conan package, it could that
        # this function is no longer doing what we want.
        cmake.patch_config_paths()
예제 #4
0
    def build(self):
        cmake = CMake(self, set_cmake_flags=True)
        cmake.generator = "Ninja"
        cmake.verbose = False
        cmake.definitions["QT_CONAN_DIR"] = self.build_folder
        cmake.definitions["QT_CONAN_FILE"] = __file__

        # if self.options.use_ccache:
        #    cmake.definitions["CMAKE_C_COMPILER_LAUNCHER"] = "ccache"
        #    cmake.definitions["CMAKE_CXX_COMPILER_LAUNCHER"] = "ccache"

        if self.options.qt:
            cmake.definitions["Qt5_DIR"] = os.path.join(
                str(self.options.qt), "lib", "cmake", "Qt5")
            self.output.info("Qt5 directory:" + cmake.definitions["Qt5_DIR"])

        if self.options.build_type:
            cmake.build_type = str(self.options.build_type)

        if self.options.cmakeargs:
            cmake_flags = shlex.split(str(self.options.cmakeargs))
        else:
            cmake_flags = None

        if "CONAN_CPU_COUNT" in os.environ:
            os.environ['NINJAFLAGS'] = '-j ' + os.environ['CONAN_CPU_COUNT']

        if "NINJAFLAGS" in os.environ:
            parser = argparse.ArgumentParser()
            parser.add_argument('-j', default=None, type=int)
            jarg, ninja_flags = parser.parse_known_args(
                shlex.split(os.environ["NINJAFLAGS"]))
            if jarg.j:
                os.environ['CONAN_CPU_COUNT'] = str(jarg.j)
            ninja_flags.insert(0, '--')
        else:
            ninja_flags = None

        if self.options.install_prefix:
            cmake.definitions["CMAKE_INSTALL_PREFIX"] = str(
                self.options.install_prefix)
        else:
            del cmake.definitions["CMAKE_INSTALL_PREFIX"]

        cmake.configure(args=cmake_flags)
        cmake.build(args=ninja_flags)
        cmake.build()
        cmake.install()
예제 #5
0
    def build_cmake(self):
        defs = {"CMAKE_VERBOSE_MAKEFILE:BOOL": "ON", "ENABLE_CONAN:BOOL": "ON"}
        if self.settings.os == "Windows":
            cmake = CMake(self, generator="Ninja", parallel=False)
            defs.update({
                k: os.environ.get(k)
                for k in [
                    "CMAKE_PREFIX_PATH",
                    "SOUFFLE_INCLUDE_DIR",
                    "PYTHON",
                ]
            })
            defs["Boost_USE_STATIC_LIBS"] = "ON"
            defs[
                "CMAKE_CXX_FLAGS"] = "/DBOOST_ALL_NO_LIB /DBOOST_UUID_FORCE_AUTO_LINK"
        else:
            cmake = CMake(self, generator=None, parallel=False)
            defs.update({"GTIRB_PPRINTER_STRIP_DEBUG_SYMBOLS:BOOL": "ON"})
            self.add_dep_bin_path("mcpp")

        revision = os.environ.get("CI_COMMIT_SHORT_SHA")
        if revision:
            defs["DDISASM_BUILD_REVISION"] = revision

        if self.settings.build_type == "Release":
            cmake.build_type = "RelWithDebInfo"
        self.add_dep_bin_path("gtirb-pprinter")
        self.add_dep_lib_path("gtirb-pprinter", "gtirb", "capstone")
        bin_dir = os.path.join(os.getcwd(), "bin")
        os.environ["PATH"] = os.pathsep.join([os.environ["PATH"], bin_dir])

        cmake.configure(source_folder=".", defs=defs)
        cmake.build()

        # Using the CMAKE_CTEST_ARGUMENTS environment variable to pass args to
        # ctest would allow us to use `cmake.test()` and `--verbose`, but it
        # is new in CMake 3.17 (newer than what is available in our Windows
        # test runner). As a workaround, we run ctest directly.
        # https://cmake.org/cmake/help/latest/variable/CMAKE_CTEST_ARGUMENTS.html#cmake-ctest-arguments
        if self.settings.build_type == "Release":
            with tools.vcvars(self.settings, arch="x86_64"):
                self.run(["ctest", "--verbose"], cwd=cmake.build_folder)
            # FIXME: https://github.com/conan-io/conan/issues/3673
            # Remove environment variable to force vcvars configuration.
            os.environ.pop("VisualStudioVersion", None)
            with tools.vcvars(self.settings, arch="x86"):
                self.run(["ctest", "--verbose"], cwd=cmake.build_folder)
예제 #6
0
    def _configure_cmake(self):
        """Configure CMake."""
        cmake = CMake(self)

        if self.options.debug_symbols and self.settings.build_type == "Release":
            cmake.build_type = 'RelWithDebInfo'

        definition_dict = {
            "BUILD_SHARED_LIBS": self.options.shared,
            "PXR_BUILD_ALEMBIC_PLUGIN": True,
            "PXR_BUILD_DOCUMENTATION": False,
            "PXR_BUILD_DRACO_PLUGIN": False,
            "PXR_BUILD_EMBREE_PLUGIN": False,
            "PXR_BUILD_HOUDINI_PLUGIN": False,
            "PXR_BUILD_IMAGING": True,
            "PXR_BUILD_KATANA_PLUGIN": False,
            "PXR_BUILD_MATERIALX_PLUGIN": True,
            "PXR_BUILD_OPENCOLORIO_PLUGIN": True,
            "PXR_BUILD_OPENIMAGEIO_PLUGIN": True,
            "PXR_BUILD_PRMAN_PLUGIN": False,
            "PXR_BUILD_TESTS": False,
            "PXR_BUILD_USD_IMAGING": True,
            "PXR_BUILD_USDVIEW": False,
            "PXR_ENABLE_GL_SUPPORT": False,
            "PXR_ENABLE_HDF5_SUPPORT": True,
            "PXR_ENABLE_OPENVDB_SUPPORT": False,
            "PXR_ENABLE_OSL_SUPPORT": False,
            "PXR_ENABLE_PTEX_SUPPORT": True,
            "PXR_ENABLE_PYTHON_SUPPORT": False,
            "TBB_USE_DEBUG_BUILD": self.settings.build_type == "Debug",
            "HDF5_USE_STATIC_LIBRARIES": not self.options["hdf5"].shared
        }

        # Boost default find package is not great... give it a hand.
        #boost_libs = ['atomic', 'chrono', 'container', 'context', 'contract', 'coroutine', 'date_time', 'exception', 'fiber', 'filesystem', 'graph', 'graph_parallel', 'iostreams', 'locale', 'log', 'math', 'mpi', 'program_options', 'python', 'random', 'regex', 'serialization', 'stacktrace', 'system', 'test', 'thread', 'timer', 'type_erasure', 'wave']
        boost_libs = ['program_options']
        for searched_lib in boost_libs:
            for built_lib in self.deps_cpp_info["boost"].libs:
                if built_lib.find(searched_lib) != -1:
                    definition_dict["Boost_%s_FOUND" %
                                    searched_lib.upper()] = True
                    definition_dict["Boost_%s_LIBRARY" %
                                    searched_lib.upper()] = built_lib

        cmake.configure(defs=definition_dict,
                        source_folder=self._source_subfolder)
        return cmake