From fd831f933dd0c0e0a119f7ab337ef56c84029d33 Mon Sep 17 00:00:00 2001 From: Olivier Marsden Date: Sat, 22 Feb 2025 09:09:15 +0000 Subject: [PATCH 1/2] Increase robustness of venv installation. * Without this export, in some cases wrong python interpreter is found. --- cmake/fckit_install_venv.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/fckit_install_venv.cmake b/cmake/fckit_install_venv.cmake index 39a4567..0e13bbe 100644 --- a/cmake/fckit_install_venv.cmake +++ b/cmake/fckit_install_venv.cmake @@ -15,6 +15,7 @@ macro( fckit_install_venv ) # Make the virtualenv portable by automatically deducing the VIRTUAL_ENV path from # the 'activate' script's location in the filesystem + set (ENV{VIRTUAL_ENV} "${VENV_PATH}") execute_process( COMMAND sed -i "s/^VIRTUAL_ENV=\".*\"$/VIRTUAL_ENV=\"$(cd \"$(dirname \"$(dirname \"\${BASH_SOURCE[0]}\" )\")\" \\&\\& pwd)\"/" "${VENV_PATH}/bin/activate" From a6b100cbde38071cd187861668d096541dd50e4e Mon Sep 17 00:00:00 2001 From: Olivier Marsden Date: Sat, 22 Feb 2025 09:10:56 +0000 Subject: [PATCH 2/2] Simplify fypp preprocessing invocation. * remove superfluous arguments, and remove unnecessary fckit-eval script leading to much shorter command string * without this, custom_command string length problems can occur --- cmake/add_fctest.cmake | 4 ++-- cmake/fckit-import.cmake.in | 2 +- cmake/fckit_preprocess_fypp.cmake | 27 +++++---------------------- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/cmake/add_fctest.cmake b/cmake/add_fctest.cmake index 7271bcf..ae6cac7 100644 --- a/cmake/add_fctest.cmake +++ b/cmake/add_fctest.cmake @@ -43,7 +43,7 @@ cmake_policy( SET CMP0064 NEW ) # Recognize ``TEST`` as operator for the ``if()` set( options ) set( single_value_args TARGET ) - set( multi_value_args ) + set( multi_value_args INCLUDEDIRS ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) @@ -55,7 +55,7 @@ cmake_policy( SET CMP0064 NEW ) # Recognize ``TEST`` as operator for the ``if()` get_filename_component( base ${TESTSUITE} NAME_WE ) ### Preprocess files with extension ".fypp.F90" - fckit_target_preprocess_fypp( ${_PAR_TARGET} ) + fckit_target_preprocess_fypp( ${_PAR_TARGET} INCLUDEDIRS ${_PAR_INCLUDEDIRS} ) ### Remove TESTSUITE from target get_target_property( test_sources ${_PAR_TARGET} SOURCES ) diff --git a/cmake/fckit-import.cmake.in b/cmake/fckit-import.cmake.in index 11a8538..5213400 100644 --- a/cmake/fckit-import.cmake.in +++ b/cmake/fckit-import.cmake.in @@ -18,7 +18,7 @@ else() elseif( @HAVE_FCKIT_VENV@ ) set( _fckit_eval_script ${fckit_BASE_DIR}/libexec/fckit-eval.sh ) set( FCKIT_VENV_EXE ${fckit_BASE_DIR}/@rel_venv_exe_path@ ) - set( FYPP ${_fckit_eval_script} ${FCKIT_VENV_EXE} -m fypp ) + set( FYPP ${FCKIT_VENV_EXE} -m fypp ) else() set( FYPP ${fckit_BASE_DIR}/libexec/fckit-eval.sh ${fckit_BASE_DIR}/libexec/fckit-fypp.py ) diff --git a/cmake/fckit_preprocess_fypp.cmake b/cmake/fckit_preprocess_fypp.cmake index ed8c36f..bd21978 100644 --- a/cmake/fckit_preprocess_fypp.cmake +++ b/cmake/fckit_preprocess_fypp.cmake @@ -20,27 +20,6 @@ function( fckit_target_append_fypp_args output target ) set( valid_target FALSE ) endif() endif() - if( valid_target ) - if( CMAKE_VERSION VERSION_LESS 3.12 ) # Hopefully we can remove this soon - foreach( include_property INCLUDE_DIRECTORIES;INTERFACE_INCLUDE_DIRECTORIES ) - set( prop "$" ) - list( APPEND _args "$<$:-I $>" ) - endforeach() - foreach( definitions_property COMPILE_DEFINITIONS;INTERFACE_COMPILE_DEFINITIONS ) - set( prop "$" ) - list( APPEND _args "$<$:-D $>" ) - endforeach() - else() - foreach( include_property INCLUDE_DIRECTORIES;INTERFACE_INCLUDE_DIRECTORIES ) - set( prop "$<$:$>" ) - list( APPEND _args "$<$:-I $>" ) - endforeach() - foreach( definitions_property COMPILE_DEFINITIONS;INTERFACE_COMPILE_DEFINITIONS ) - set( prop "$<$:$>" ) - list( APPEND _args "$<$:-D $>" ) - endforeach() - endif() - endif() # Append to output and set in parent scope if( _args ) set(${output} ${${output}} ${_args} PARENT_SCOPE) @@ -192,7 +171,7 @@ function( fckit_target_preprocess_fypp _PAR_TARGET ) set( options NO_LINE_NUMBERING ) set( single_value_args "" ) - set( multi_value_args FYPP_ARGS FYPP_ARGS_EXCLUDE DEPENDS ) + set( multi_value_args FYPP_ARGS FYPP_ARGS_EXCLUDE DEPENDS INCLUDEDIRS ) cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} ) if( TARGET ${_PAR_TARGET} ) @@ -245,6 +224,10 @@ function( fckit_target_preprocess_fypp _PAR_TARGET ) set( _NO_LINE_NUMBERING NO_LINE_NUMBERING ) endif() + foreach( dir ${_PAR_INCLUDEDIRS} ) + list( APPEND args -I ${dir} ) + endforeach() + fckit_preprocess_fypp_sources( preprocessed_sources SOURCES ${sources_to_be_preprocessed} ${_NO_LINE_NUMBERING}