Make CMake-setup for python sources work

This commit is contained in:
Gaute Lindkvist
2021-01-21 08:41:37 +01:00
committed by Magne Sjaastad
parent 80bae6df45
commit 861577922a
2 changed files with 43 additions and 95 deletions

View File

@@ -355,22 +355,24 @@ endforeach()
# Generate Python code in a target that is part of ALL_BUILD and depends on
# ResInsight
if(RESINSIGHT_ENABLE_GRPC)
set(GENERATED_CLASSES_FILE ${CMAKE_SOURCE_DIR}/GrpcInterface/Python/rips/generated/resinsight_classes.py)
add_custom_command(
OUTPUT
${CMAKE_SOURCE_DIR}/GrpcInterface/Python/rips/generated/resinsight_classes.py
${GENERATED_CLASSES_FILE}
COMMAND
ResInsight ARGS --console --generate
${CMAKE_SOURCE_DIR}/GrpcInterface/Python/rips/generated/resinsight_classes.py
${GENERATED_CLASSES_FILE}
DEPENDS ResInsight
COMMENT
"Generating ${CMAKE_SOURCE_DIR}/GrpcInterface/Python/rips/generated/resinsight_classes.py"
"Generating ${GENERATED_CLASSES_FILE}"
)
add_custom_target(
ResInsightPythonClasses ALL
DEPENDS
${CMAKE_SOURCE_DIR}/GrpcInterface/Python/rips/generated/resinsight_classes.py
RipsGeneratedPythonClasses ALL
SOURCES
${GENERATED_CLASSES_FILE}
)
add_dependencies(ResInsightPythonClasses ResInsight)
source_group("Source Files" ${GENERATED_CLASSES_FILE})
add_dependencies(RipsGeneratedPythonClasses ResInsight)
endif(RESINSIGHT_ENABLE_GRPC)