Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #69 from TApplencourt/master
Browse files Browse the repository at this point in the history
Ninja build
  • Loading branch information
scemama committed Jun 9, 2015
2 parents dae68ed + ba06580 commit 4dbb2a1
Show file tree
Hide file tree
Showing 61 changed files with 767 additions and 664 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ before_script:
- sudo apt-get install graphviz

script:
- ./setup_environment.sh --robot
- ./setup_environment.py
- source ./quantum_package.rc
- qp_create_ninja.py --production ./config/gfortran_example.cfg
- ninja
Expand Down
8 changes: 4 additions & 4 deletions COMPILE_RUN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ The script to create the dependencies file (aka `build.ninja`) is `create_ninja_

## Compilation Flag

You need to specify all the flag useful for the compilation: like the optimization one, the mkl one .``$QPACKAGE_ROOT/config`` contains ``ifort.cfg`` and ``gfortran.cfg`` files which have the compiler flags that will be used to compile the code. You can edit these files to modify the compiling option. Put the file path when calling `create_ninja_build.py`
You need to specify all the flag useful for the compilation: like the optimization one, the mkl one .``$QP_ROOT/config`` contains ``ifort.cfg`` and ``gfortran.cfg`` files which have the compiler flags that will be used to compile the code. You can edit these files to modify the compiling option. Put the file path when calling `create_ninja_build.py`

## Example to create the Ninja file

`create_ninja_build.py --production $QPACKAGE_ROOT/config/ifort.cfg`
`create_ninja_build.py --production $QP_ROOT/config/ifort.cfg`

# WARNING

For now reload this command if you add a `IRP.f90` or `EZFIO.cfg` file or modify the `NEED_CHILDREN_MODULE`!

## Compile

Just type `ninja` if you are in `$QPACKAGE_ROOT` (or `ninja -f $QPACKAGE_ROOT/build.ninja` elsewhere). The compilation will take approximately 3 min.
Just type `ninja` if you are in `$QP_ROOT` (or `ninja -f $QP_ROOT/build.ninja` elsewhere). The compilation will take approximately 3 min.

If you have set the `--developement` flag in a specific module you can go in the corresponding IRPF90_temp and run `ninja` to only make the module and submodule binaries. (You can use the `-f` option too)

Now go in `$QPACKAGE_ROOT/ocaml` and type `make`
Now go in `$QP_ROOT/ocaml` and type `make`
7 changes: 0 additions & 7 deletions data/Makefile

This file was deleted.

14 changes: 8 additions & 6 deletions doc/code_architecture/Script.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# `ei_handler.py`

This script in located in `$QPACKAGE_ROOT/scripts/ezfio_interface/`.
This script in located in `$QP_ROOT/scripts/ezfio_interface/`.
It provide all the resource need to deal with the `EZFIO.cfg` files :
- The creation of `$MODULE_LOWER_ezfio_config` in `$QPACKAGE_ROOT/ezfio/config`
- The creation of `$MODULE_LOWER_ezfio_config` in `$QP_ROOT/ezfio/config`
- The `ezfio_interface.irp.f` who containt all the provider associate (in `$MODULE/`)
- The `$MODULE_LOWER_ezfio_defaults` in `$QPACKAGE_ROOT/data/`
- The `$MODULE_LOWER_ezfio_defaults` in `$QP_ROOT/data/`
- The `Input_$MODULE_LOWER.ml` for the *qp_edit*

For more information you can type `ei_handler.py -h`

# `module_handler.py`

This script in located in `$QPACKAGE_ROOT/scripts/module/`.
This script in located in `$QP_ROOT/scripts/module/`.
It provide all the resource related to the tree dependancy of the modules.
If more useful as a librairy than a cli.

Expand All @@ -23,19 +23,21 @@ It have some usefull property:
- The dict of the root
- The list reduced tree (For a list of module in input return only the root)

For tree syntax you can check http://en.wikipedia.org/wiki/Tree_%28data_structure%29#Terminologies_used_in_Trees

In the cli mode:
- From a `NEEDED_CHILDREN_MODULE` file you can have all the descendant, and a png
representation who correspond.


# `qp_install_module.py`
This script is located in `$QPACKAGE_ROOT/scripts/module/`.
This script is located in `$QP_ROOT/scripts/module/`.

It is usefull when you need to install a new module. (From the soon to come repo or from scratch).

# `qp_create_ninja.py`

This script is located in `$QPACKAGE_ROOT/scripts/compilation/`.
This script is located in `$QP_ROOT/scripts/compilation/`.
It will create the `build.ninja` file. It will use intersifly the `module_handler.py` module.

To read all the flag for the compilation the module `read_compilation_cfg.py` is used.
Expand Down
Empty file added install/Downloads/.gitignore
Empty file.
Empty file added install/_build/.gitignore
Empty file.
10 changes: 10 additions & 0 deletions install/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -x
# This script should be included

BUILD=_build/${TARGET}
rm -rf -- ${BUILD}
mkdir ${BUILD} || exit 1
tar -zxf Downloads/${TARGET}.tar.gz --strip-components=1 --directory=${BUILD} || exit 1
_install || exit 1
rm -rf -- ${BUILD} _build/${TARGET}.log
exit 0
File renamed without changes.
19 changes: 19 additions & 0 deletions install/scripts/install_curl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -x
TARGET=curl

function _install()
{
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD} || return 1
mv curl.ermine ${QP_ROOT}/bin/curl || return 1
}

BUILD=_build/${TARGET}
rm -rf -- ${BUILD}
mkdir ${BUILD} || exit 1
tar -xvjf Downloads/${TARGET}.tar.bz2 --strip-components=1 --directory=${BUILD} || exit 1
_install || exit 1
rm -rf -- ${BUILD} _build/${TARGET}.log
exit 0
10 changes: 10 additions & 0 deletions install/scripts/install_docopt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -x

TARGET=docopt

function _install()
{
cp -R ${BUILD} . || exit 1
}

source scripts/build.sh
10 changes: 10 additions & 0 deletions install/scripts/install_emsl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -x

TARGET=emsl

function _install()
{
cp -R ${BUILD} . || exit 1
}

source scripts/build.sh
16 changes: 16 additions & 0 deletions install/scripts/install_ezfio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash -x

TARGET=ezfio

function _install()
{
cd ..
QP_ROOT=$PWD
cd -
rm -rf ${QP_ROOT}/EZFIO
cd ${BUILD}/config || return 1
cd -
mv ${BUILD} ${QP_ROOT}/install/EZFIO || return 1
}

source scripts/build.sh
24 changes: 24 additions & 0 deletions install/scripts/install_irpf90.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -x

TARGET=irpf90
function _install()
{
cd ..
QP_ROOT=$PWD
cd -

make -C ${BUILD} || return 1
rm -rf -- ./irpf90
mv ${BUILD} . || return 1
[[ -x ./irpf90/bin/irpf90 ]] || return 1
[[ -x ./irpf90/bin/irpman ]] || return 1
rm -rf -- ../bin/irpf90 ../bin/irpman
echo 'exec ${QP_ROOT}/install/irpf90/bin/irpf90 $@' > ../bin/irpf90 || return 1
echo 'exec ${QP_ROOT}/install/irpf90/bin/irpman $@' > ../bin/irpman || return 1
chmod +x ../bin/irpf90 ../bin/irpman || return 1
return 0
}

source scripts/build.sh


15 changes: 15 additions & 0 deletions install/scripts/install_m4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -x

TARGET=m4

function _install()
{
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD}
./configure && make || exit 1
ln -sf ${PWD}/src/m4 ${QP_ROOT}/bin || exit 1
}

source scripts/build.sh
14 changes: 14 additions & 0 deletions install/scripts/install_ninja.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -x

TARGET=ninja

function _install()
{
cd ${BUILD} || return 1
./configure.py --bootstrap || return 1
cd -
mv ${BUILD}/ninja ../bin/ || return 1
return 0
}

source scripts/build.sh
39 changes: 39 additions & 0 deletions install/scripts/install_ocaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

cd ..
QP_ROOT=$PWD
cd -

# Normal installation
PACKAGES="core cryptokit ocamlfind sexplib"

declare -i i
i=$(gcc -dumpversion | cut -d '.' -f 2)
if [[ i -lt 6 ]]
then
echo "GCC version $(gcc -dumpversion) too old. GCC >= 4.6 required."
exit 1
fi

if [[ -d ${HOME}/.opam ]]
then
source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
fi

cd Downloads || exit 1
chmod +x ocaml.sh || exit 1

echo N | ./ocaml.sh ${QP_ROOT}/bin/ || exit 1

${QP_ROOT}/bin/opam config setup -a -q || exit 1

export LD_LIBRARY_PATH=${QP_ROOT}/lib:${LD_LIBRARY_PATH}
export LIBRARY_PATH=${QP_ROOT}/lib:${LIBRARY_PATH}
export C_INCLUDE_PATH=${QP_ROOT}/lib:${C_INCLUDE_PATH}
source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true

${QP_ROOT}/bin/opam install ${PACKAGES} -y -q || exit 1
rm -f ../_build/ocaml.log
exit 0


19 changes: 19 additions & 0 deletions install/scripts/install_patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -x

TARGET=patch

function _install()
{
mkdir ${TARGET}
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD}
./configure --prefix=${QP_ROOT}/install/${TARGET} && make || exit 1
make install || exit 1
cd -
cp ${TARGET}/bin/${TARGET} ${QP_ROOT}/bin || exit 1
rm -R -- ${TARGET} || exit 1
}

source scripts/build.sh
11 changes: 11 additions & 0 deletions install/scripts/install_resultsFile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -x

TARGET=resultsFile

function _install()
{
cp -R ${BUILD} . || exit 1
}

source scripts/build.sh

19 changes: 19 additions & 0 deletions install/scripts/install_zlib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -x

TARGET=zlib

function _install()
{
rm -rf -- ${TARGET}
mkdir ${TARGET} || exit 1
cd ..
QP_ROOT=$PWD
cd -
cd ${BUILD}
./configure && make || exit 1
make install prefix=$QP_ROOT/install/${TARGET} || exit 1
ln -s -f $QP_ROOT/install/${TARGET}/lib/libz.so $QP_ROOT/lib || exit 1
ln -s -f $QP_ROOT/install/${TARGET}/lib/libz.a $QP_ROOT/lib || exit 1
}

source scripts/build.sh
Empty file added lib/.gitignore
Empty file.
20 changes: 10 additions & 10 deletions ocaml/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.NOPARALLEL:

# Check if QPACKAGE_ROOT is defined
ifndef QPACKAGE_ROOT
# Check if QP_ROOT is defined
ifndef QP_ROOT
$(info -------------------- Error --------------------)
$(info QPACKAGE_ROOT undefined. Source the quantum_package.rc script)
$(info QP_ROOT undefined. Source the quantum_package.rc script)
$(info -----------------------------------------------)
$(error )
endif
Expand Down Expand Up @@ -32,10 +32,10 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore
echo $$i ; \
done > .gitignore

executables: $(QPACKAGE_ROOT)/data/executables
executables: $(QP_ROOT)/data/executables

$(QPACKAGE_ROOT)/data/executables:
$(QPACKAGE_ROOT)/scripts/module/create_executables_list.sh
$(QP_ROOT)/data/executables:
$(QP_ROOT)/scripts/module/create_executables_list.sh

external_libs:
opam install cryptokit core
Expand All @@ -62,17 +62,17 @@ qp_run.native: $(MLFILES) $(MLIFILES) executables
$(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS)
ln -s $*.native $*

ezfio.ml: ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml
cp ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml .
ezfio.ml: ${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml
cp ${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml .

qptypes_generator.byte: qptypes_generator.ml
$(OCAMLBUILD) qptypes_generator.byte -use-ocamlfind

Qptypes.ml: qptypes_generator.byte
./qptypes_generator.byte > Qptypes.ml

${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml:
$(MAKE) -C ${QPACKAGE_ROOT}/src ezfio
${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml:
$(MAKE) -C ${QP_ROOT}/install/src ezfio

Input_auto_generated.ml qp_edit.ml:
ei_handler.py ocaml_global
Expand Down
6 changes: 3 additions & 3 deletions ocaml/Qpackage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ open Qputils;;
(** Variables related to the quantum package installation *)

let root =
match (Sys.getenv "QPACKAGE_ROOT") with
| None -> failwith "QPACKAGE_ROOT environment variable is not set.
match (Sys.getenv "QP_ROOT") with
| None -> failwith "QP_ROOT environment variable is not set.
Please source the quantum_package.rc file."
| Some x -> x
;;
Expand Down Expand Up @@ -59,7 +59,7 @@ let executables = lazy (
|> List.filter ~f:(fun x -> x <> "")
in
match e with
| [a;b] -> (a,String.substr_replace_all ~pattern:"$QPACKAGE_ROOT" ~with_:root b)
| [a;b] -> (a,String.substr_replace_all ~pattern:"$QP_ROOT" ~with_:root b)
| _ -> ("","")
)
in
Expand Down
Loading

0 comments on commit 4dbb2a1

Please sign in to comment.