Implement #29: Add support for --create-dev-env

This commit is contained in:
Anirudha Bose 2014-08-18 01:59:51 +05:30 committed by sftnight
parent aa4a20c3ab
commit b9f5ccf55c
2 changed files with 44 additions and 10 deletions

View File

@ -163,7 +163,8 @@ usage: cpt.py [-h] [-c] [--current-dev CURRENT_DEV]
[--dmg-tag DMG_TAG] [--with-llvm-url WITH_LLVM_URL]
[--with-clang-url WITH_CLANG_URL]
[--with-cling-url WITH_CLING_URL] [--no-test]
[--with-workdir WITH_WORKDIR] [--make-proper MAKE_PROPER]
[--create-dev-env CREATE_DEV_ENV] [--with-workdir WITH_WORKDIR]
[--make-proper MAKE_PROPER]
Cling Packaging Tool
@ -195,10 +196,13 @@ optional arguments:
--with-cling-url WITH_CLING_URL
Specify an alternate URL of Cling repo
--no-test Do not run test suite of Cling
--create-dev-env CREATE_DEV_ENV
Set up a release/debug environment
--with-workdir WITH_WORKDIR
Specify an alternate working directory for CPT
--make-proper MAKE_PROPER
Internal option to support calls from build system
```
If you want CPT to build a package by detecting your platform automatically,
use the value 'pkg'.

View File

@ -293,21 +293,33 @@ def compile(arg):
if platform.system() == 'Windows':
CMAKE = os.path.join(TMP_PREFIX, 'bin', 'cmake', 'bin', 'cmake.exe')
box_draw("Configure Cling with CMake and generate Visual Studio 11 project files")
exec_subprocess_call('%s -G "Visual Studio 11" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%s ..\%s'%(CMAKE, TMP_PREFIX, os.path.basename(srcdir)), LLVM_OBJ_ROOT)
if args['create_dev_env'] == 'debug':
box_draw("Configure Cling with CMake and generate Visual Studio 11 project files")
exec_subprocess_call('%s -G "Visual Studio 11" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=%s ..\%s'%(CMAKE, TMP_PREFIX, os.path.basename(srcdir)), LLVM_OBJ_ROOT)
box_draw("Building Cling (using %s cores)"%(cores))
exec_subprocess_call('%s --build . --target clang --config Release'%(CMAKE), LLVM_OBJ_ROOT)
box_draw("Building Cling (using %s cores)"%(cores))
exec_subprocess_call('%s --build . --target clang --config Debug'%(CMAKE), LLVM_OBJ_ROOT)
exec_subprocess_call('%s --build . --target cling --config Release'%(CMAKE), LLVM_OBJ_ROOT)
exec_subprocess_call('%s --build . --target cling --config Debug'%(CMAKE), LLVM_OBJ_ROOT)
box_draw("Install compiled binaries to prefix (using %s cores)"%(cores))
exec_subprocess_call('%s --build . --target INSTALL --config Release'%(CMAKE), LLVM_OBJ_ROOT)
else:
box_draw("Configure Cling with CMake and generate Visual Studio 11 project files")
exec_subprocess_call('%s -G "Visual Studio 11" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%s ..\%s'%(CMAKE, TMP_PREFIX, os.path.basename(srcdir)), LLVM_OBJ_ROOT)
box_draw("Building Cling (using %s cores)"%(cores))
exec_subprocess_call('%s --build . --target clang --config Release'%(CMAKE), LLVM_OBJ_ROOT)
exec_subprocess_call('%s --build . --target cling --config Release'%(CMAKE), LLVM_OBJ_ROOT)
box_draw("Install compiled binaries to prefix (using %s cores)"%(cores))
exec_subprocess_call('%s --build . --target INSTALL --config Release'%(CMAKE), LLVM_OBJ_ROOT)
else:
box_draw("Configure Cling with GNU Make")
if OS == 'Darwin' and REV.startswith('10.8'):
exec_subprocess_call('%s/configure --disable-compiler-version-checks --with-python=%s --enable-targets=host --prefix=%s --enable-optimized=yes'%(srcdir, PYTHON, TMP_PREFIX), LLVM_OBJ_ROOT)
if args['create_dev_env'] == 'debug':
exec_subprocess_call('%s/configure --disable-compiler-version-checks --with-python=%s --enable-targets=host --prefix=%s --enable-cxx11'%(srcdir, PYTHON, TMP_PREFIX), LLVM_OBJ_ROOT)
else:
exec_subprocess_call('%s/configure --disable-compiler-version-checks --with-python=%s --enable-targets=host --prefix=%s --enable-optimized=yes --enable-cxx11'%(srcdir, PYTHON, TMP_PREFIX), LLVM_OBJ_ROOT)
@ -1264,6 +1276,7 @@ parser.add_argument('--with-clang-url', action='store', help='Specify an alterna
parser.add_argument('--with-cling-url', action='store', help='Specify an alternate URL of Cling repo', default='http://root.cern.ch/git/cling.git')
parser.add_argument('--no-test', help='Do not run test suite of Cling', action='store_true')
parser.add_argument('--create-dev-env', help='Set up a release/debug environment')
if platform.system() != 'Windows':
parser.add_argument('--with-workdir', action='store', help='Specify an alternate working directory for CPT', default=os.path.expanduser(os.path.join('~', 'ec', 'build')))
@ -1670,6 +1683,23 @@ if args['dmg_tag']:
make_dmg()
cleanup()
if args['create_dev_env']:
fetch_llvm()
fetch_clang()
fetch_cling('master')
set_version()
if OS == 'Windows':
get_win_dep()
compile(os.path.join(workdir, 'cling-win-' + platform.machine().lower() + '-' + VERSION))
else:
if DIST == 'Scientific Linux CERN SLC':
compile(os.path.join(workdir, 'cling-SLC-' + REV + '-' + platform.machine().lower() + '-' + VERSION))
else:
compile(os.path.join(workdir, 'cling-' + DIST + '-' + REV + '-' + platform.machine().lower() + '-' + VERSION))
install_prefix()
if args['no_test'] != True:
test_cling()
if args['make_proper']:
# This is an internal option in CPT, meant to be integrated into Cling's build system.
with open(os.path.join(LLVM_OBJ_ROOT, 'config.log'), 'r') as log: