Skip to content

Instantly share code, notes, and snippets.

@zachlewis
Last active January 24, 2021 06:27
Show Gist options
  • Save zachlewis/b7e6b85cb3d1b948405c5a0061533db9 to your computer and use it in GitHub Desktop.
Save zachlewis/b7e6b85cb3d1b948405c5a0061533db9 to your computer and use it in GitHub Desktop.
cmake rez package
# -*- coding: utf-8 -*-
name = 'cmake'
version = '3.17.2'
description = 'Cross-platform make system'
tools = [
'ccmake',
'cmake',
'cmake-gui',
'cpack',
'ctest',
]
@early()
def uuid():
import uuid
return str(uuid.uuid5(uuid.NAMESPACE_DNS, name))
@early()
def variants():
from rez.package_py_utils import expand_requires
requires = ["platform-**", "arch-**", "os-**"]
return [expand_requires(*requires)]
private_build_requires = ['gcc']
def pre_build_commands():
source_tar = 'cmake-%s.tar.gz' % this.version
url_root = 'https://github.com/Kitware/CMake/releases/download/v$REZ_BUILD_PROJECT_VERSION/'
compile_flags = ' '.join([
'-O2', '-g', '-pipe', '-Wall', '-Wp,-D_FORTIFY_SOURCE=2', '-fexceptions',
'-fstack-protector-strong', '--param=ssp-buffer-size=4', '-grecord-gcc-switches',
'-m64', '-mtune=generic'
])
configure_flags = ' '.join([
'--prefix=$REZ_BUILD_INSTALL_PATH',
#'--qt-gui',
'--parallel=$REZ_BUILD_THREAD_COUNT',
'--system-curl',
])
env.CFLAGS = '%s $CFLAGS' % compile_flags
env.CXXFLAGS = '%s $CXXFLAGS' % compile_flags
env.CC = '$REZ_GCC_ROOT/bin/gcc'
env.REZ_BUILD_DOWNLOAD_CMD = 'wget %s/%s -O %s' % (url_root, source_tar, source_tar)
env.REZ_BUILD_UNTAR_CMD = 'tar -xvf %s --strip 1' % source_tar
env.REZ_BUILD_CONFIGURE_CMD = './bootstrap %s' % configure_flags
build_command = """
$REZ_BUILD_DOWNLOAD_CMD
$REZ_BUILD_UNTAR_CMD
$REZ_BUILD_CONFIGURE_CMD
make {install} -j$REZ_BUILD_THREAD_COUNT
"""
def commands():
env.PATH.prepend('{root}/bin')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment