Skip to content

Commit

Permalink
Allows to build ACTS analyzers from build sub-command (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvbrt authored Aug 5, 2024
1 parent dae0778 commit fa672d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions man/man1/fccanalysis-build.1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[\fB\-h\fR | \fB\-\-help\fR]
[\fB\-c\fR]
[\fB\-j\fR \fIBUILD_THREADS\fR]
[\fB\-\-acts\-on\fR]
.SH DESCRIPTION
.B fccanalysis\-build
will build the whole FCCAnalyses framework\&.
Expand All @@ -25,6 +26,9 @@ Completely clean build directory before compilation\&.
.TP
\fB\-j\fR \fIBUILD_THREADS\fR, \fB\-\-build\-threads\fR \fIBUILD_THREADS\fR
Specify number of threads used when compiling (equivalent to `make -j`)
.TP
\fB\-\-acts\-on\fR
Enable also ACTS based analyzers to be build\&.
.SH SEE ALSO
fccanalysis(1), fccanalysis\-test(1), cmake(1)
.SH BUGS
Expand Down
13 changes: 9 additions & 4 deletions python/build_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
LOGGER = logging.getLogger('FCCAnalyses.build')


def run_subprocess(command: str, run_dir: str):
def run_subprocess(command: str, run_dir: str) -> None:
'''
Run subprocess in specified directory.
Check only the return value, otherwise keep the subprocess connected to
Expand All @@ -32,11 +32,11 @@ def run_subprocess(command: str, run_dir: str):
sys.exit(0)


def build_analysis(mainparser):
def build_analysis(mainparser) -> None:
'''
Main build steering function
'''
args, _ = mainparser.parse_known_args()
args = mainparser.parse_args()

if 'LOCAL_DIR' not in os.environ:
LOGGER.error('FCCAnalyses environment not set up correctly!\n'
Expand All @@ -46,9 +46,14 @@ def build_analysis(mainparser):
local_dir = os.environ.get('LOCAL_DIR')
build_path = pathlib.Path(local_dir + '/build')
install_path = pathlib.Path(local_dir + '/install')
cmake_args = ['-DCMAKE_INSTALL_PREFIX=../install']

LOGGER.info('Building analysis located in:\n%s', local_dir)

if args.acts_on:
LOGGER.info('Building also ACTS based analyzers...')
cmake_args += ['-DWITH_ACTS=ON']

if args.clean_build:
LOGGER.info('Clearing build and install directories...')
if build_path.is_dir():
Expand All @@ -60,7 +65,7 @@ def build_analysis(mainparser):
LOGGER.info('Creating build directory...')
os.makedirs(build_path)

run_subprocess(['cmake', '-DCMAKE_INSTALL_PREFIX=../install', '..'],
run_subprocess(['cmake'] + cmake_args + ['..'],
local_dir + '/build')

if not install_path.is_dir():
Expand Down
4 changes: 4 additions & 0 deletions python/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def setup_build_parser(parser):
default=1,
help='number of threads when building (equivalent to `make -j`)'
)
build_args.add_argument('--acts-on',
action='store_true',
default=False,
help='enable ACTS based analyzers')


def setup_test_parser(parser):
Expand Down

0 comments on commit fa672d4

Please sign in to comment.