s/--init/--update/
This commit is contained in:
parent
d0c5daf0ae
commit
7f197b6199
15
README.md
15
README.md
@ -1,23 +1,28 @@
|
||||
[](https://travis-ci.org/scisoft/autocmake/builds)
|
||||
|
||||
|
||||
# Autocmake
|
||||
|
||||
A CMake plugin composer.
|
||||
|
||||
|
||||
## Projects using Autocmake
|
||||
|
||||
- [Numgrid](https://github.com/rbast/numgrid)
|
||||
|
||||
|
||||
## Bootstrapping a new project
|
||||
|
||||
Bootstrap a Autocmake infrastructure out of "nothing":
|
||||
Download the ``bootstrap.py`` and execute it to fetch other infrastructure files
|
||||
which will be needed to build the project:
|
||||
|
||||
mkdir cmake # does not have to be called "cmake" - take the name you prefer
|
||||
cd cmake
|
||||
wget https://github.com/scisoft/autocmake/raw/master/bootstrap.py
|
||||
python bootstrap.py --init
|
||||
python bootstrap.py --update
|
||||
|
||||
This downloads and creates the following files:
|
||||
This creates (or updates) the following files (an existing ``autocmake.cfg`` is
|
||||
not overwritten by the script):
|
||||
|
||||
cmake/
|
||||
├── bootstrap.py # no need to edit
|
||||
@ -29,10 +34,11 @@ This downloads and creates the following files:
|
||||
If you use version control, then now is a good moment to status/diff/add
|
||||
the newly created files.
|
||||
|
||||
|
||||
## Creating the CMake infrastructure
|
||||
|
||||
Then edit ``autocmake.cfg`` and run the ``bootstrap.py`` script which
|
||||
creates ``CMakeLists.txt`` and ``setup.py`` in the path specified (here ".."):
|
||||
creates ``CMakeLists.txt`` and ``setup.py`` in the build path:
|
||||
|
||||
python bootstrap.py ..
|
||||
|
||||
@ -55,6 +61,7 @@ the project:
|
||||
cd build
|
||||
make
|
||||
|
||||
|
||||
## Customizing the CMake modules
|
||||
|
||||
The CMake modules can be customized directly inside ``modules/`` but this is
|
||||
|
30
bootstrap.py
30
bootstrap.py
@ -4,7 +4,6 @@ import os
|
||||
import sys
|
||||
import urllib
|
||||
import shutil
|
||||
import tempfile
|
||||
from collections import OrderedDict
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
@ -244,22 +243,18 @@ def main(argv):
|
||||
Main function.
|
||||
"""
|
||||
if len(argv) != 2:
|
||||
sys.stderr.write("\nYou can bootstrap a project in two steps.\n")
|
||||
sys.stderr.write("First step is typically done only once.\n")
|
||||
sys.stderr.write("Second step can be repeated many time without re-running the first step.\n\n")
|
||||
sys.stderr.write("Step 1:\n")
|
||||
sys.stderr.write("Create an example autocmake.cfg and other infrastructure files\n")
|
||||
sys.stderr.write("which will be needed to configure and build the project:\n")
|
||||
sys.stderr.write("$ %s --init\n\n" % argv[0])
|
||||
sys.stderr.write("Step 2:\n")
|
||||
sys.stderr.write("Create CMakeLists.txt and setup.py in PROJECT_ROOT:\n")
|
||||
sys.stderr.write("$ %s PROJECT_ROOT\n" % argv[0])
|
||||
sys.stderr.write("example:\n")
|
||||
sys.stderr.write("$ %s ..\n" % argv[0])
|
||||
sys.stderr.write("\nYou can bootstrap a project in two steps.\n\n")
|
||||
sys.stderr.write("Step 1: Update or create infrastructure files\n")
|
||||
sys.stderr.write(" which will be needed to configure and build the project:\n")
|
||||
sys.stderr.write(" $ %s --update\n\n" % argv[0])
|
||||
sys.stderr.write("Step 2: Create CMakeLists.txt and setup.py in PROJECT_ROOT:\n")
|
||||
sys.stderr.write(" $ %s <PROJECT_ROOT>\n" % argv[0])
|
||||
sys.stderr.write(" example:\n")
|
||||
sys.stderr.write(" $ %s ..\n" % argv[0])
|
||||
sys.exit(-1)
|
||||
|
||||
if argv[1] == '--init':
|
||||
# empty project, create infrastructure files
|
||||
if argv[1] == '--update':
|
||||
# update infrastructure files
|
||||
if not os.path.isfile('autocmake.cfg'):
|
||||
print('- fetching example autocmake.cfg')
|
||||
fetch_url(
|
||||
@ -276,6 +271,11 @@ def main(argv):
|
||||
src='https://github.com/docopt/docopt/raw/master/docopt.py',
|
||||
dst='lib/docopt.py'
|
||||
)
|
||||
print('- fetching bootstrap.py')
|
||||
fetch_url(
|
||||
src='%s/raw/master/bootstrap.py' % AUTOCMAKE_GITHUB_URL,
|
||||
dst='bootstrap.py'
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
project_root = argv[1]
|
||||
|
@ -16,7 +16,7 @@ def exe(command):
|
||||
def test_cxx():
|
||||
os.chdir(os.path.join(HERE, 'cxx', 'cmake'))
|
||||
stdout, stderr = exe('wget https://github.com/scisoft/autocmake/raw/master/bootstrap.py')
|
||||
stdout, stderr = exe('python bootstrap.py --init')
|
||||
stdout, stderr = exe('python bootstrap.py --update')
|
||||
stdout, stderr = exe('python bootstrap.py ..')
|
||||
os.chdir(os.path.join(HERE, 'cxx'))
|
||||
stdout, stderr = exe('python setup.py --cxx=g++')
|
||||
|
Loading…
x
Reference in New Issue
Block a user