Skip to content

Commit

Permalink
Merge pull request #22 from BerkeleyLab/fix-run-example
Browse files Browse the repository at this point in the history
Fix handling of example-program input arguments in run-fpm.sh script
  • Loading branch information
rouson authored Dec 2, 2022
2 parents 77809ca + e42073d commit 083fbd2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion example/concurrent-inference.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ program concurrent_inferences

if (len(input_files)==0) then
error stop new_line('a') // new_line('a') // &
'Usage: fpm run --example concurrent-inference -- --input-files "<space-delimited-list-of-files>"'
'Usage: ./build/run-fpm.sh run --example concurrent-inference -- --input-files "<space-delimited-list-of-files>"'
end if

print *,"Defining an array of inference_engine_t objects by reading the following files: ", input_files
Expand Down
2 changes: 1 addition & 1 deletion example/construct-and-write.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ program construct_and_write

if (len(output_file_name)==0) then
error stop new_line('a') // new_line('a') // &
'Usage: fpm run --example construct-and-write -- --output-file "<file-name>"'
'Usage: ./build/run-fpm.sh run --example construct-and-write -- --output-file "<file-name>"'
end if

xor = inference_engine_t( &
Expand Down
2 changes: 1 addition & 1 deletion example/read-and-query.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ program read_and_query

if (len(input_file_name)==0) then
error stop new_line('a') // new_line('a') // &
'Usage: fpm run --example read-and-query -- --input-file "<file-name>"'
'Usage: ./build/run-fpm.sh run --example read-and-query -- --input-file "<file-name>"'
end if

print *,"Defining an inference_engine_t object by reading the file '"//input_file_name//"'"
Expand Down
19 changes: 19 additions & 0 deletions scripts/run-fpm.sh-header
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
#-- DO NOT EDIT -- created by inference-engine/setup.sh
export PKG_CONFIG_PATH

fpm_arguments=""
program_arguments=""
while test $# -gt 0
do
case "$1" in
--) program_arguments="$@"
;;
*) if [ -z "$program_arguments" ]; then
fpm_arguments="$fpm_arguments $1"
fi
;;
esac
shift
done

19 changes: 9 additions & 10 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ echo "INFERENCE_ENGINE_FPM_FLAG=\"$FPM_FLAG\"" >> $INFERENCE_ENGINE
echo "Name: inference-engine" >> $INFERENCE_ENGINE_PC
echo "Description: Inference Engine" >> $INFERENCE_ENGINE_PC
echo "URL: https://github.com/berkeleylab/inference-engine" >> $INFERENCE_ENGINE_PC
echo "Version: 0.1.0" >> $INFERENCE_ENGINE_PC
echo "Version: 0.1.1" >> $INFERENCE_ENGINE_PC
if [ $CI = true ]; then
echo "---------------"
echo "cat $INFERENCE_ENGINE_PC"
Expand All @@ -122,16 +122,15 @@ if [ $CI = true ]; then
fi

export PKG_CONFIG_PATH
cp scripts/run-fpm.sh-header build/run-fpm.sh
RUN_FPM_SH="`realpath ./build/run-fpm.sh`"
echo "#!/bin/sh" > $RUN_FPM_SH
echo "#-- DO NOT EDIT -- created by inference-engine/install.sh" >> $RUN_FPM_SH
echo "export PKG_CONFIG_PATH" >> $RUN_FPM_SH
echo "`brew --prefix fpm`/bin/fpm \$@ \\" >> $RUN_FPM_SH
echo "--profile debug \\" >> $RUN_FPM_SH
echo "--c-compiler \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_CC`\" \\" >> $RUN_FPM_SH
echo "--compiler \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_FC`\" \\" >> $RUN_FPM_SH
echo "--flag \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_FLAG`\" \\" >> $RUN_FPM_SH
echo "--link-flag \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_LD_FLAG`\"" >> $RUN_FPM_SH
echo "`which fpm` \$fpm_arguments \\" >> $RUN_FPM_SH
echo "--profile debug \\" >> $RUN_FPM_SH
echo "--c-compiler \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_CC`\" \\" >> $RUN_FPM_SH
echo "--compiler \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_FC`\" \\" >> $RUN_FPM_SH
echo "--flag \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_FLAG`\" \\" >> $RUN_FPM_SH
echo "--link-flag \"`pkg-config inference-engine --variable=INFERENCE_ENGINE_FPM_LD_FLAG`\" \\" >> $RUN_FPM_SH
echo "\$program_arguments" >> $RUN_FPM_SH
chmod u+x $RUN_FPM_SH
if [ $CI = true ]; then
echo "---------------"
Expand Down

0 comments on commit 083fbd2

Please sign in to comment.