Commit 7a8bf394 authored by juan rodriguez-carvajal's avatar juan rodriguez-carvajal
Browse files

New linux scripts to be used with fpm

parent b9e56341
Pipeline #12461 failed with stages
in 6 minutes and 5 seconds
...@@ -10,8 +10,11 @@ fi ...@@ -10,8 +10,11 @@ fi
# #
# Arguments # Arguments
# #
win="N" _WIN="win"
_CHANGEX="xxx"
_CHANGEF="f90"
to_change="xxx" to_change="xxx"
win="N"
for arg in "$@" for arg in "$@"
do do
case "$arg" in case "$arg" in
...@@ -26,8 +29,12 @@ do ...@@ -26,8 +29,12 @@ do
;; ;;
esac esac
done done
echo "to_change:" $to_change
if [ $to_change == "xxx" ]; then echo " _CHANGEX:" $_CHANGEX
echo " win:" $win
# Space between [ and comparison are essential!
if [ $to_change == $_CHANGEX ]
then
echo "---- Changing the extension of some *.f90 files to *.xxx to maintain compatibility with FPM" echo "---- Changing the extension of some *.f90 files to *.xxx to maintain compatibility with FPM"
mv CFML_Export_Vtk_LF95.f90 CFML_Export_Vtk_LF95.xxx mv CFML_Export_Vtk_LF95.f90 CFML_Export_Vtk_LF95.xxx
mv CFML_FlipR_Mod.f90 CFML_FlipR_Mod.xxx mv CFML_FlipR_Mod.f90 CFML_FlipR_Mod.xxx
...@@ -35,45 +42,49 @@ if [ $to_change == "xxx" ]; then ...@@ -35,45 +42,49 @@ if [ $to_change == "xxx" ]; then
mv CFML_GlobalDeps_Linux_Intel.f90 CFML_GlobalDeps_Linux_Intel.xxx mv CFML_GlobalDeps_Linux_Intel.f90 CFML_GlobalDeps_Linux_Intel.xxx
mv CFML_GlobalDeps_MacOS.f90 CFML_GlobalDeps_MacOS.xxx mv CFML_GlobalDeps_MacOS.f90 CFML_GlobalDeps_MacOS.xxx
mv CFML_GlobalDeps_MacOS_Intel.f90 CFML_GlobalDeps_MacOS_Intel.xxx mv CFML_GlobalDeps_MacOS_Intel.f90 CFML_GlobalDeps_MacOS_Intel.xxx
mv CFML_GlobalDeps_Windows_gfortran.f90 CFML_GlobalDeps_Windows_gfortran.xxx mv CFML_GlobalDeps_Windows.f90 CFML_GlobalDeps_Windows.xxx
mv CFML_GlobalDeps_Windows_Intel.f90 CFML_GlobalDeps_Windows_Intel.xxx mv CFML_GlobalDeps_Windows_Intel.f90 CFML_GlobalDeps_Windows_Intel.xxx
mv CFML_HDF5.f90 CFML_HDF5.xxx mv CFML_HDF5.f90 CFML_HDF5.xxx
mv CFML_ILL_Instrm_Data_LF.f90 CFML_ILL_Instrm_Data_LF.xxx mv CFML_ILL_Instrm_Data_LF.f90 CFML_ILL_Instrm_Data_LF.xxx
mv CFML_IO_MessagesRW.f90 CFML_IO_MessagesRW.xxx mv CFML_IO_MessagesRW.f90 CFML_IO_MessagesRW.xxx
if [ $win == "win"]; then if [ $win == $_WIN ]
mv CFML_IO_Messages.f90 CFML_IO_Messages.xxx then
mv CFML_IO_MessagesWin.f90 CFML_IO_Messages.f90 mv CFML_IO_Messages.f90 CFML_IO_Messages.xxx
mv CFML_IO_MessagesWin.f90 CFML_IO_Messages.f90
else else
mv CFML_IO_MessagesWin.f90 CFML_IO_MessagesWin.xxx mv CFML_IO_MessagesWin.f90 CFML_IO_MessagesWin.xxx
fi fi
mv CFML_String_Utilities_gf.f90 CFML_String_Utilities_gf.xxx mv CFML_String_Utilities_gf.f90 CFML_String_Utilities_gf.xxx
mv CFML_String_Utilities_LF.f90 CFML_String_Utilities_LF.xxx mv CFML_String_Utilities_LF.f90 CFML_String_Utilities_LF.xxx
mv f2kcli.f90 f2kcli.xxx mv f2kcli.f90 f2kcli.xxx
exit exit
fi fi
if [ $to_change == "f90" ]; then #
if [ $to_change == $_CHANGEF ]
then
echo "---- Changing the extension of *.xxx files to *.f90 to maintain compatibility with CMake" echo "---- Changing the extension of *.xxx files to *.f90 to maintain compatibility with CMake"
mv CFML_Export_Vtk_LF95.xxx CFML_Export_Vtk_LF95.f90 mv CFML_Export_Vtk_LF95.xxx CFML_Export_Vtk_LF95.f90
mv CFML_FlipR_Mod.xxx CFML_FlipR_Mod.f90 mv CFML_FlipR_Mod.xxx CFML_FlipR_Mod.f90
mv CFML_GlobalDeps_Linux.xxx CFML_GlobalDeps_Linux.f90 mv CFML_GlobalDeps_Linux.xxx CFML_GlobalDeps_Linux.f90
mv CFML_GlobalDeps_Linux_Intel.xxx CFML_GlobalDeps_Linux_Intel.f90 mv CFML_GlobalDeps_Linux_Intel.xxx CFML_GlobalDeps_Linux_Intel.f90
mv CFML_GlobalDeps_MacOS.xxx CFML_GlobalDeps_MacOS.f90 mv CFML_GlobalDeps_MacOS.xxx CFML_GlobalDeps_MacOS.f90
mv CFML_GlobalDeps_MacOS_Intel.xxx CFML_GlobalDeps_MacOS_Intel.f90 mv CFML_GlobalDeps_MacOS_Intel.xxx CFML_GlobalDeps_MacOS_Intel.f90
mv CFML_GlobalDeps_Windows_gfortran.xxx CFML_GlobalDeps_Windows_gfortran.f90 mv CFML_GlobalDeps_Windows.xxx CFML_GlobalDeps_Windows.f90
mv CFML_GlobalDeps_Windows_Intel.xxx CFML_GlobalDeps_Windows_Intel.f90 mv CFML_GlobalDeps_Windows_Intel.xxx CFML_GlobalDeps_Windows_Intel.f90
mv CFML_HDF5.xxx CFML_HDF5.f90 mv CFML_HDF5.xxx CFML_HDF5.f90
mv CFML_ILL_Instrm_Data_LF.xxx CFML_ILL_Instrm_Data_LF.f90 mv CFML_ILL_Instrm_Data_LF.xxx CFML_ILL_Instrm_Data_LF.f90
mv CFML_IO_MessagesRW.xxx CFML_IO_MessagesRW.f90 mv CFML_IO_MessagesRW.xxx CFML_IO_MessagesRW.f90
mv CFML_IO_MessagesWin.xxx CFML_IO_MessagesWin.f90 mv CFML_IO_MessagesWin.xxx CFML_IO_MessagesWin.f90
if [ $win == "win"]; then if [ $win == $_WIN ]
mv CFML_IO_Messages.f90 CFML_IO_MessagesWin.f90 then
mv CFML_IO_Messages.xxx CFML_IO_Messages.f90 mv CFML_IO_Messages.f90 CFML_IO_MessagesWin.f90
mv CFML_IO_Messages.xxx CFML_IO_Messages.f90
else else
mv CFML_IO_MessagesWin.f90 CFML_IO_MessagesWin.xxx mv CFML_IO_MessagesWin.xxx CFML_IO_MessagesWin.f90
fi fi
mv CFML_String_Utilities_gf.xxx CFML_String_Utilities_gf.f90 mv CFML_String_Utilities_gf.xxx CFML_String_Utilities_gf.f90
mv CFML_String_Utilities_LF.xxx CFML_String_Utilities_LF.f90 mv CFML_String_Utilities_LF.xxx CFML_String_Utilities_LF.f90
mv f2kcli.xxx f2kcli.f90 mv f2kcli.xxx f2kcli.f90
exit exit
else else
echo "---- NOTHING DONE! This script should be invoked with argument xxx or f90 and optionally a second argument win!" echo "---- NOTHING DONE! This script should be invoked with argument xxx or f90 and optionally a second argument win!"
......
#!/bin/bash
#
#
# Attempt to create a unified build method for CrysFML using fmp
#
echo "---- Construction of the CrysFML library for 64 bits using gfortran, ifort or ifx (oneAPI) ---- "
echo "---- The building procedure installs also some executable programs of the Program_Examples subdirectory"
echo " Default: ifort compiler in release mode. Equivalent to the first example below"
echo " Examples of using the script:"
echo " make_CrysFML_fpm.sh ifort"
echo " make_CrysFML_fpm.sh ifort debug"
echo " make_CrysFML_fpm.sh gfortran"
echo " make_CrysFML_fpm.sh gfortran debug"
echo " make_CrysFML_fpm.sh ifx"
echo " make_CrysFML_fpm.sh ifx debug"
echo " For using the Winteracter library add the word "win" as the last argument (without quotes)"
echo "----"
if [ -z "$1" ]; then
cat << !
Syntax : make_CrysFML_fpm.sh xxx or make_CrysFML_fpm.sh f90
or make_CrysFML_fpm.sh xxx win make_CrysFML_fpm.sh f90 win
!
exit
fi
#
# Default values for Arguments
#
COMP=""
DEBUG="N"
CONS="Y"
WINT="N"
#
for arg in "$@"
do
case "$arg" in
"ifort")
COMP=$arg
;;
"ifx")
COMP=$arg
;;
"gfortran")
COMP=$arg
;;
"debug")
DEBUG="Y"
;;
"win")
WINT=$arg
;;
esac
done
#
# Select the proper fpm.toml file depending on win
#
if [ $WINT == "Y" ]; then
echo "Copying ./toml/fpm_linmac_win.toml to fpm.toml"
cp ./toml/fpm_linmac_win.toml fpm.toml
else
echo Copying ./toml/fpm_linmac_con.toml to fpm.toml
cp ./toml/fpm_windows_con.toml fpm.toml
fi
#
# First change the extensions of files that are optionally used in fpm to "xxx" by
# invoking the tochange.bat script in the Src directory.
#
cd ./Src
if [ $WINT == "win" ]; then
tochange.sh xxx win
else
tochange.sh xxx
fi
cd ..
#
# Block if-then-else for compiler "ifort"
#
#
if [ $COMP == "ifort" ]; then
cd ./Src
mv CFML_GlobalDeps_Linux_Intel.xxx CFML_GlobalDeps.f90
cd ..
if [ $WINT == "win" ]; then
if [ $DEBUG == "Y" ];then
fpm @./rsp/ifort_debug_win
else
fpm @./rsp/ifort_release_win
fi
else
if [ $DEBUG == "Y" ]; then
fpm @./rsp/ifort_debug
else
fpm @./rsp/ifort_release
fi
fi
cd ./Src
mv CFML_GlobalDeps.f90 CFML_GlobalDeps_Linux_Intel.xxx
cd ..
fi
#
# Block if-then-else for compiler "ifx"
#
#
if [ $COMP == "ifx" ]; then
cd ./Src
mv CFML_GlobalDeps_Linux_Intel.xxx CFML_GlobalDeps.f90
cd ..
if [ $WINT == "win" ]; then
if [ $DEBUG == "Y" ]; then
fpm @./rsp/ifx_debug_win
else
fpm @./rsp/ifx_release_win
fi
else
if [ $DEBUG == "Y" ]; then
fpm @./rsp/ifx_debug
else
fpm @./rsp/ifx_release
fi
fi
cd ./Src
mv CFML_GlobalDeps.f90 CFML_GlobalDeps_Linux_Intel.xxx
cd ..
fi
#
# Block if-then-else for compiler "gfortran"
#
#
if [ $COMP == "gfortran" ]; then
cd ./Src
mv CFML_GlobalDeps_Linux.xxx CFML_GlobalDeps.f90
cd ..
if [ $WINT == "win" ]; then
if [ $DEBUG == "Y" ]; then
fpm @./rsp/gfortran_debug_win
else
fpm @./rsp/gfortran_release_win
fi
else
if [ $DEBUG == "Y" ]; then
fpm @./rsp/gfortran_debug
else
fpm @./rsp/gfortran_release
fi
fi
cd ./Src
mv CFML_GlobalDeps.f90 CFML_GlobalDeps_Linux.xxx
cd ..
fi
#
# Undo the changes in extensions of files that were change above
#
cd ./Src
if [ $WINT == "win" ]; then
tochange.sh f90 win
else
tochange.sh f90
fi
cd ..
# This is the manifest file for building CrysFML with fpm
# It is better to comment the part corresponding to executables in order to construct
# the library totally independent of the programs using it.
#
name = "CrysFML"
version = "0.1.0"
license = "LGPL"
author = "Juan Rodriguez-Carvajal, Javier Gonzalez-Platas, Nebil A. Katcho"
maintainer = "jrc@ill.eu"
copyright = "Copyright 2022, Juan Rodriguez-Carvajal, Javier Gonzalez-Platas, Nebil A. Katcho"
[library]
source-dir = "Src"
include-dir = "Src"
[build]
auto-executables = false
auto-tests = false
auto-examples = false
[install]
library = true
#
# The lines above are enough for building the library using the scripts make_CrysFML_fpm.bat/make_CrysFML_fpm.sh
#
#==============================================================================================
# WARNING! For building the executables uncomment the lines below once the library is installed
#==============================================================================================
#
# Some executables from Program_Examples
#
#[[executable]]
#executable = [
# { name = "cryscalcon", source-dir = "Program_Examples/Cryst_calculator_console", main = "cryscalc_con.f90"},
# { name = "hkl_gen", source-dir = "Program_Examples/hkl_gen", main = "hkl_gen.f90"},
# { name = "Formal_Charges", source-dir = "Program_Examples/BondStr/FormalCharges", main = "Formal_Charges.f90"},
# { name = "Bond_Str", source-dir = "Program_Examples/BondStr/Src", main = "Bond_Str.f90"}
#]
[[executable]]
name="cryscalcon"
source-dir="Program_Examples/Cryst_calculator_console"
main="cryscalc_con.f90"
[[executable]]
name="hkl_gen"
source-dir="Program_Examples/hkl_gen"
main="hkl_gen.f90"
[[executable]]
name="Formal_Charges"
source-dir="Program_Examples/BondStr/FormalCharges"
main="Formal_Charges.f90"
[[executable]]
name="Bond_Str"
source-dir="Program_Examples/BondStr/Src"
main="Bond_Str.f90"
[[executable]]
name="Similar"
source-dir="Program_Examples/SimilarityTransformations"
main="Similar.f90"
[[executable]]
name="space_group_info"
source-dir="Program_Examples/SpaceGroups"
main="space_group_info.f90"
[[executable]]
name="subgroups"
source-dir="Program_Examples/SpaceGroups"
main="subgroups.f90"
#
# Structure factors
#
[[executable]]
name="Calc_mSfac"
source-dir="Program_Examples/StructureFactors"
main="Calc_mSfac.f90"
[[executable]]
name="Calc_Sfac"
source-dir="Program_Examples/StructureFactors"
main="Calc_Sfac.f90"
#
# Structures_GlobalOptimization
#
[[executable]]
name="GLOpSAnn"
source-dir="Program_Examples/Structures_GlobalOptimization/Src"
main="GLOpSAnn.f90"
#
# Metric
#
[[executable]]
name="Get_Conv_Cell"
source-dir="Program_Examples/Metrics"
main="Get_Conv_Cell.f90"
[[executable]]
name="search_cellrelations"
source-dir="Program_Examples/Metrics"
main="search_cellrelations.f90"
#
# Magnetic examples, polarimetry
#
[[executable]]
name="MagPolar3D"
source-dir="Program_Examples/Magnetism"
main="MagPolar3D.f90"
[[executable]]
name="magref"
source-dir="Program_Examples/Magnetism"
main="magref.f90"
################### Warning! ifx in mode release is unable to compile Schwinger: hn = real(hkl%ref(i)%h,kind=cp)
[[executable]]
name="Schwinger"
source-dir="Program_Examples/Magnetism"
main="Schwinger.f90"
[[executable]]
name="Moment"
source-dir="Program_Examples/Magnetism/Moment"
main="moment.f90"
[[executable]]
name="MagOptim"
source-dir="Program_Examples/Magnetism/MagOptim_v4"
main="MagOptim.f90"
#
# Magnetic package Simbo, EnerMag, Phase_Diagram and MC_Mag
#
[[executable]]
name="Simbo"
source-dir="Program_Examples/Simbo-Enermag"
main="Simbo.f90"
[[executable]]
name="EnerMag"
source-dir="Program_Examples/Simbo-Enermag"
main="EnerMag.f90"
[[executable]]
name="Phase_Diagram"
source-dir="Program_Examples/Simbo-Enermag"
main="Phase_Diagram.f90"
[[executable]]
name="MC_Mag"
source-dir="Program_Examples/Simbo-Enermag/MC_Mag"
main="mc_mag.f90"
#
# Faults Program
#
[[executable]]
name="DIFFaX2FAULTS"
source-dir="Program_Examples/Faults/DIFFaX2FAULTS"
main="DIFFaX2FAULTS.f90"
[[executable]]
name="Faults"
source-dir="Program_Examples/Faults/Src"
main="Faults.f90"
#
# Powder Patterns
#
[[executable]]
name="Simple_Calc_Mag_Powder"
source-dir="Program_Examples/PowderPattern"
main="Simple_Calc_Mag_Powder.f90"
[[executable]]
name="Calc_Powder"
source-dir="Program_Examples/PowderPattern"
main="calc_powder.f90"
[[executable]]
name="Simple_Calc_Powder"
source-dir="Program_Examples/PowderPattern"
main="Simple_calc_powder.f90"
[[executable]]
name="Correct_Cells"
source-dir="Program_Examples/PowderPattern"
main="corr_cells.f90"
[[executable]]
name="Laue_Powder"
source-dir="Program_Examples/PowderPattern"
main="Laue_powder.f90"
#
# Single X-tal diffractometry
#
[[executable]]
name="d10_flat_cone"
source-dir="Program_Examples/SXtal_Diffractometry"
main="d10_flat_cone.f90"
[[executable]]
name="get_UB_from2ref"
source-dir="Program_Examples/SXtal_Diffractometry"
main="get_UB_from2ref.f90"
# This is the manifest file for building CrysFML with fpm
# It is better to comment the part corresponding to executables in order to construct
# the library totally independent of the programs using it.
#
name = "CrysFML"
version = "1.0.0"
license = "LGPL"
author = "Juan Rodriguez-Carvajal, Javier Gonzalez-Platas, Nebil A. Katcho"
maintainer = "jrc@ill.eu"
copyright = "Copyright 2022, Juan Rodriguez-Carvajal, Javier Gonzalez-Platas, Nebil A. Katcho"
[library]
source-dir = "Src"
include-dir = "/usr/local/wint/lib.i64"
[build]
auto-executables = false
auto-tests = false
auto-examples = false
external-modules = "winteracter"
link=["winter","user32", "gdi32", "comdlg32", "winspool", "winmm", "shell32", "advapi32", "htmlhelp"]
[install]
library = true
#
# The lines above are enough for building the library using the scripts make_CrysFML_fpm.bat/make_CrysFML_fpm.sh
#
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment