Skip to content

Commit 9416fa7

Browse files
authored
[QC-515] Fix analysis json generation in Example and stop polluting src dir (#584)
1 parent a5f0049 commit 9416fa7

2 files changed

Lines changed: 10 additions & 32 deletions

File tree

Modules/Example/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,19 @@ install(TARGETS QcExample
2525
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
2626
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2727

28+
# ---- Workflows for analysis ----
29+
2830
# Install the config files for the analysis.
2931
# The command "install" cannot be used because it would be executed after o2_add_qc_workflow which relies on
3032
# the config files being already installed in the right place.
33+
# Note: There is an issue with ninja when a "configured" file is deleted. https://gitlab.kitware.com/cmake/cmake/-/issues/18985
34+
# The set_property should fix it.
3135
configure_file("etc/analysisDirect.json" "${CMAKE_INSTALL_PREFIX}/etc/analysisDirect.json")
36+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_INSTALL_PREFIX}/etc/analysisDirect.json")
3237
configure_file("etc/analysisDerived.json" "${CMAKE_INSTALL_PREFIX}/etc/analysisDerived.json")
38+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_INSTALL_PREFIX}/etc/analysisDerived.json")
3339

34-
# ---- Workflows for analysis ----
35-
40+
# We cannot point to the json files in the source dir because the path will be reused in the produced json.
3641
o2_add_qc_workflow(WORKFLOW_NAME o2-qc-example-analysis-direct CONFIG_FILE_PATH ${CMAKE_INSTALL_PREFIX}/etc/analysisDirect.json)
3742
o2_add_qc_workflow(WORKFLOW_NAME o2-qc-example-analysis-derived CONFIG_FILE_PATH ${CMAKE_INSTALL_PREFIX}/etc/analysisDerived.json)
3843

cmake/AddQCWorkflow.cmake

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,6 @@ include_guard()
1919
# under share/dpl directory
2020
#
2121

22-
#function(o2_add_qc_workflow workflowName configurationFile)
23-
#
24-
# set(jsonDumpFile ${workflowName}.json)
25-
# set(qcExecutable o2-qc)
26-
#
27-
# install(CODE "message(\"Generating a workflow dump with the command: ${CMAKE_INSTALL_PREFIX}/bin/${qcExecutable} -b --config json:/${CMAKE_INSTALL_PREFIX}/${configurationFile} --dump-workflow --dump-workflow-file ${CMAKE_CURRENT_BINARY_DIR}/${jsonDumpFile}\")")
28-
# install(CODE "execute_process(
29-
# COMMAND ${CMAKE_INSTALL_PREFIX}/bin/${qcExecutable} -b --config json:/${CMAKE_INSTALL_PREFIX}/${configurationFile} --dump-workflow --dump-workflow-file ${CMAKE_CURRENT_BINARY_DIR}/${jsonDumpFile}
30-
# )")
31-
## install(CODE "execute_process(
32-
## COMMAND echo 'QUALITYCONTROL_ROOT: ${QUALITYCONTROL_ROOT}'
33-
## )")
34-
## install(CODE "execute_process(
35-
## COMMAND pwd
36-
## )")
37-
## install(CODE "execute_process(
38-
## COMMAND which bin/o2-qc
39-
## )")
40-
# install(
41-
# FILES ${CMAKE_CURRENT_BINARY_DIR}/${jsonDumpFile}
42-
# DESTINATION ${CMAKE_INSTALL_DATADIR}/dpl)
43-
#
44-
#endfunction()
45-
4622
function(o2_add_qc_workflow)
4723

4824
cmake_parse_arguments(
@@ -56,10 +32,8 @@ function(o2_add_qc_workflow)
5632
if(NOT PARSED_ARGS_WORKFLOW_NAME OR NOT PARSED_ARGS_CONFIG_FILE_PATH)
5733
message(FATAL_ERROR "You must provide a workflow name and a config file path")
5834
endif()
59-
message(STATUS "o2_add_qc_workflow called with config file ${PARSED_ARGS_CONFIG_FILE_PATH} to generate ${PARSED_ARGS_WORKFLOW_NAME}")
60-
61-
set(jsonDumpFile ${CMAKE_CURRENT_SOURCE_DIR}/${PARSED_ARGS_WORKFLOW_NAME}.json)
62-
message(STATUS "jsonDumpFile: ${jsonDumpFile}" )
35+
set(jsonDumpFile ${CMAKE_CURRENT_BINARY_DIR}/${PARSED_ARGS_WORKFLOW_NAME}.json)
36+
message(STATUS "o2_add_qc_workflow called with config file ${PARSED_ARGS_CONFIG_FILE_PATH} to generate ${jsonDumpFile}")
6337
set(qcExecutable o2-qc)
6438

6539
add_custom_command(
@@ -73,7 +47,6 @@ function(o2_add_qc_workflow)
7347
add_custom_target(${filename} ALL DEPENDS ${jsonDumpFile})
7448

7549
# will install the rootmap and pcm files alongside the target's lib
76-
install(FILES ${jsonDumpFile}
77-
DESTINATION ${CMAKE_INSTALL_DATADIR}/dpl)
50+
install(FILES ${jsonDumpFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/dpl)
7851

7952
endfunction()

0 commit comments

Comments
 (0)