Beispiel #1
0
    def _install_cmake(self):
        self.cmake_path = None
        cmake_executable = 'cmake' + self.env.platform_exe_suffix
        CMAKE_VERSION = '2.8.5'
        if utils.find_executable(cmake_executable):
            cmake_version = subprocess.Popen(
                [cmake_executable, '--version'], stdout=subprocess.PIPE
            ).communicate()[0].strip()
            if self.extract_version_as_int(cmake_version, r".* (\d+).(\d+).(\d+)") >= \
                    self.extract_version_as_int(CMAKE_VERSION):
                log.info('Found system cmake')
                return
            else:
                log.info('Warning, Your installed version of CMAKE is tool old.')
        log.info('Installing cmake')

        CMAKE_URL_BASE = 'http://www.cmake.org/files/v2.8/'
        if self.env.platform == 'win':
            url = '%scmake-%s-win32-x86.zip' % (CMAKE_URL_BASE, CMAKE_VERSION)
            self._download(url, 'ef536e5148aacf559735df893b40a1f4')
            created_dir = self._extract(url, self.env.c.thirdparty_dir)
            self.cmake_path = join(self.env.c.thirdparty_dir, created_dir, 'bin')
        else:
            cmake_install_path = join(self.env.c.thirdparty_dir, 'cmake')
            cmake_src_path = join(
                self.env.c.thirdparty_dir, 'cmake-%s' % CMAKE_VERSION)
            self.cmake_path = join(cmake_install_path, 'bin')

            if (os.path.isdir(cmake_src_path) and
                os.path.isdir(cmake_install_path)):
                return

            url = '%scmake-%s.tar.gz' % (CMAKE_URL_BASE, CMAKE_VERSION)
            self._download(url, '3c5d32cec0f4c2dc45f4c2e84f4a20c5')
            created_dir = self._extract(url, self.env.c.thirdparty_dir)

            log.info('Building cmake')
            utils.RemoveDirectory(cmake_install_path)

            cmake_src = join(self.env.c.thirdparty_dir, created_dir)
            utils.call(
                [join(cmake_src, 'configure'),  '--prefix=' +
                    cmake_install_path],
                cwd=cmake_src)
            utils.call(
                ['make', '-j%i' % self.env.c.parallel_build, 'install'],
                cwd=cmake_src)
Beispiel #2
0
    def _install_cmake(self):
        self.cmake_path = None
        cmake_executable = "cmake" + self.env.platform_exe_suffix
        CMAKE_VERSION = "2.8.5"
        if utils.find_executable(cmake_executable):
            cmake_version = (
                subprocess.Popen([cmake_executable, "--version"], stdout=subprocess.PIPE).communicate()[0].strip()
            )
            if self.extract_version_as_int(cmake_version, r".* (\d+).(\d+).(\d+)") >= self.extract_version_as_int(
                CMAKE_VERSION
            ):
                log.info("Found system cmake")
                return
            else:
                log.info("Warning, Your installed version of CMAKE is tool old.")
        log.info("Installing cmake")

        CMAKE_URL_BASE = "http://www.cmake.org/files/v2.8/"
        if self.env.platform == "win":
            url = "%scmake-%s-win32-x86.zip" % (CMAKE_URL_BASE, CMAKE_VERSION)
            self._download(url, "ef536e5148aacf559735df893b40a1f4")
            created_dir = self._extract(url, self.env.c.thirdparty_dir)
            self.cmake_path = join(self.env.c.thirdparty_dir, created_dir, "bin")
        else:
            cmake_install_path = join(self.env.c.thirdparty_dir, "cmake")
            cmake_src_path = join(self.env.c.thirdparty_dir, "cmake-%s" % CMAKE_VERSION)
            self.cmake_path = join(cmake_install_path, "bin")

            if os.path.isdir(cmake_src_path) and os.path.isdir(cmake_install_path):
                return

            url = "%scmake-%s.tar.gz" % (CMAKE_URL_BASE, CMAKE_VERSION)
            self._download(url, "3c5d32cec0f4c2dc45f4c2e84f4a20c5")
            created_dir = self._extract(url, self.env.c.thirdparty_dir)

            log.info("Building cmake")
            utils.RemoveDirectory(cmake_install_path)

            cmake_src = join(self.env.c.thirdparty_dir, created_dir)
            utils.call([join(cmake_src, "configure"), "--prefix=" + cmake_install_path], cwd=cmake_src)
            utils.call(["make", "-j%i" % self.env.c.parallel_build, "install"], cwd=cmake_src)
Beispiel #3
0
    def _generate_build_system(self):
        if self.config.clear_cmake_cache:
            utils.maybe_remove(join(self.env.env_path, 'CMakeCache.txt'))

        args = [self.get_cmake_tool_path('cmake'), self.env.source_path]

        # Use ccache on Linux if available
        if self.env.platform == 'lin' and utils.find_executable('ccache'):
            os.environ['CXX'] = 'ccache g++'
            os.environ['CC'] = 'ccache gcc'

        if self.env.platform == 'win':
            # TODO: This shouldn't be hardcoded.
            args.extend(['-G', 'Visual Studio 9 2008' + (' Win64' if self.env.c.x64 else '')])

        if self.with_mysql:
            args.append('-DWITH_MYSQL=1')
            if self.mysql_dir:
                os.environ['MYSQL_DIR'] = self.mysql_dir

        args.append('-DCMAKE_BUILD_TYPE=' + self.env.build_type)

        # TODO: maybe change optimization flags in debug mode:
        # -DCMAKE_CXX_FLAGS=-O0

        # Add a suffix to the install dir to allow
        # different SYNTHESE to run on the same server
        if self.env.config.prefix_with_svnrelease:
            git_info = utils.GITInfo(self.env.source_path, None)
            revision_path = '-r{0}'.format(git_info.version)
            self.config.prefix += revision_path

        if self.config.prefix:
            args.append('-DCMAKE_INSTALL_PREFIX=' + self.config.prefix)
        if self.config.mysql_params:
            args.append('-DSYNTHESE_MYSQL_PARAMS=' + self.config.mysql_params)

        args.append('-DBOOST_VERSION=' + BOOST_VER)

        env = os.environ.copy()
        if self.boost_dir:
            env['BOOST_ROOT'] = self.boost_dir
        if self.boost_lib_dir:
            env['BOOST_LIBRARYDIR'] = self.boost_lib_dir

        # Enable subdirs
        args.append('-DWITH_TEST:BOOL=ON')
        if self.config.do_not_build_python:
            args.append('-DWITH_PACKAGES:BOOL=OFF')
            args.append('-DWITH_PROJECTS:BOOL=OFF')
            args.append('-DWITH_TOOLS:BOOL=OFF')
            args.append('-DWITH_UTILS:BOOL=OFF')
        else:
            args.append('-DWITH_PACKAGES:BOOL=ON')
            args.append('-DWITH_PROJECTS:BOOL=ON')
            args.append('-DWITH_TOOLS:BOOL=ON')
            args.append('-DWITH_UTILS:BOOL=ON')

        # TODO: check that Python Cygwin is not in the path?

        if not os.path.isdir(self.env.env_path):
            os.makedirs(self.env.env_path)
        utils.call(args, cwd=self.env.env_path, env=env)

        # Hack to disable incremental build on XP (it fails with:
        # LINK : fatal error LNK1210: exceeded internal ILK size limit; link with /INCREMENTAL:NO)
        # I didn't find a way to to this in CMakeLists.txt
        # (http://www.cmake.org/pipermail/cmake/2010-February/035174.html didn't work)
        if self.env.platform == 'win' and platform.release() == 'XP':
            cmake_cache = join(self.env.env_path, 'CMakeCache.txt')
            cache_content = open(cmake_cache).read()
            cache_content = cache_content.replace(
                'INCREMENTAL:YES', 'INCREMENTAL:NO')
            open(cmake_cache, 'wb').write(cache_content)
Beispiel #4
0
    def _generate_build_system(self):
        if self.config.clear_cmake_cache:
            utils.maybe_remove(join(self.env.env_path, "CMakeCache.txt"))

        args = [self.get_cmake_tool_path("cmake"), self.env.source_path]

        # Use ccache on Linux if available
        if self.env.platform == "lin" and utils.find_executable("ccache"):
            os.environ["CXX"] = "ccache g++"
            os.environ["CC"] = "ccache gcc"

        if self.env.platform == "win":
            # TODO: This shouldn't be hardcoded.
            args.extend(["-G", "Visual Studio 9 2008" + (" Win64" if self.env.c.x64 else "")])

        if self.with_mysql:
            args.append("-DWITH_MYSQL=1")
            if self.mysql_dir:
                os.environ["MYSQL_DIR"] = self.mysql_dir

        args.append("-DCMAKE_BUILD_TYPE=" + self.env.build_type)

        # TODO: maybe change optimization flags in debug mode:
        # -DCMAKE_CXX_FLAGS=-O0

        # Add a suffix to the install dir to allow
        # different SYNTHESE to run on the same server
        if self.env.config.prefix_with_svnrelease:
            svn_info = utils.SVNInfo(self.env.source_path)
            revision_path = "-r{0}".format(svn_info.version)
            self.config.prefix += revision_path

        if self.config.prefix:
            args.append("-DCMAKE_INSTALL_PREFIX=" + self.config.prefix)
        if self.config.mysql_params:
            args.append("-DSYNTHESE_MYSQL_PARAMS=" + self.config.mysql_params)

        args.append("-DBOOST_VERSION=" + BOOST_VER)

        env = os.environ.copy()
        if self.boost_dir:
            env["BOOST_ROOT"] = self.boost_dir
        if self.boost_lib_dir:
            env["BOOST_LIBRARYDIR"] = self.boost_lib_dir

        # Enable subdirs
        args.append("-DWITH_TEST:BOOL=ON")
        if self.config.do_not_build_python:
            args.append("-DWITH_PACKAGES:BOOL=OFF")
            args.append("-DWITH_PROJECTS:BOOL=OFF")
            args.append("-DWITH_TOOLS:BOOL=OFF")
            args.append("-DWITH_UTILS:BOOL=OFF")
        else:
            args.append("-DWITH_PACKAGES:BOOL=ON")
            args.append("-DWITH_PROJECTS:BOOL=ON")
            args.append("-DWITH_TOOLS:BOOL=ON")
            args.append("-DWITH_UTILS:BOOL=ON")

        # TODO: check that Python Cygwin is not in the path?

        if not os.path.isdir(self.env.env_path):
            os.makedirs(self.env.env_path)
        utils.call(args, cwd=self.env.env_path, env=env)

        # Hack to disable incremental build on XP (it fails with:
        # LINK : fatal error LNK1210: exceeded internal ILK size limit; link with /INCREMENTAL:NO)
        # I didn't find a way to to this in CMakeLists.txt
        # (http://www.cmake.org/pipermail/cmake/2010-February/035174.html didn't work)
        if self.env.platform == "win" and platform.release() == "XP":
            cmake_cache = join(self.env.env_path, "CMakeCache.txt")
            cache_content = open(cmake_cache).read()
            cache_content = cache_content.replace("INCREMENTAL:YES", "INCREMENTAL:NO")
            open(cmake_cache, "wb").write(cache_content)