Skip to content

Commit

Permalink
Merge branch 'master' into config_refactoring_next
Browse files Browse the repository at this point in the history
  • Loading branch information
geofjamg committed Nov 8, 2016
2 parents 82f9467 + 8b70c4c commit 80f066c
Show file tree
Hide file tree
Showing 32 changed files with 1,738 additions and 2,308 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -69,3 +69,6 @@
# Matlab projects
/dymola-adapter/bin/
/dynamic-indexes/*/bin/

# iPST compilation settings
install.cfg
46 changes: 24 additions & 22 deletions CMakeLists.txt
Expand Up @@ -12,24 +12,28 @@ set(BUILD_MATLAB false CACHE BOOL "")
set(BUILD_EUROSTAG false CACHE BOOL "")
set(BUILD_DYMOLA false CACHE BOOL "")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -std=c++0x -fPIC")

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)

set(USE_STATIC_LIBS true CACHE BOOL "")
set(Boost_USE_STATIC_LIBS ${USE_STATIC_LIBS})

set(CMAKE_VERBOSE_MAKEFILE off)

# thirdparty libraries location
if (DEFINED thirdparty_prefix)
message("thirdparty_prefix=${thirdparty_prefix}")
if (DEFINED thirdparty_prefix AND IS_DIRECTORY "${thirdparty_prefix}")
message(STATUS "Found thirdparty libraries: ${thirdparty_prefix}")
else()
message(FATAL_ERROR "thirdparty_prefix is NOT defined")
message(FATAL_ERROR "Thirdparty libraries not found. The variable thirdparty_prefix is NOT set or is NOT a valid directory.")
endif()
set(PROTOBUF_HOME ${thirdparty_prefix}/protobuf)
set(LIBARCHIVE_HOME ${thirdparty_prefix}/libarchive)
set(BOOST_HOME ${thirdparty_prefix}/boost)
set(BOOST_ROOT ${thirdparty_prefix}/boost)
set(LOG4CPP_HOME ${thirdparty_prefix}/log4cpp)
set(SZIP_HOME ${thirdparty_prefix}/szip)
set(ZLIB_HOME ${thirdparty_prefix}/zlib)
Expand All @@ -39,32 +43,30 @@ set(MATIO_HOME ${thirdparty_prefix}/matio)
add_subdirectory(mpi-communication)

if(BUILD_EUROSTAG)
message(STATUS "BUILD_EUROSTAG = " ${BUILD_EUROSTAG} ": eurostag-indexes and wp43adapter binaries will be compiled.")
add_subdirectory(eurostag-indexes)
add_subdirectory(wp43adapter)
message(STATUS "Eurostag based components (eurostag-indexes and wp43adapter) will be compiled.")
add_subdirectory(eurostag-indexes)
add_subdirectory(wp43adapter)
else()
message(STATUS "BUILD_EUROSTAG = " ${BUILD_EUROSTAG} ": eurostag-indexes and wp43adapter binaries will not be compiled.")
message(STATUS "Eurostag based components (eurostag-indexes and wp43adapter) will not be compiled.")
endif()

if(BUILD_MATLAB)
message(STATUS "BUILD_MATLAB = " ${BUILD_MATLAB} ": Matlab based components will be compiled.")
add_subdirectory(sampling)
add_subdirectory(mcla)
add_subdirectory(dynamic-indexes)
if(BUILD_DYMOLA)
message(STATUS "BUILD_DYMOLA = " ${BUILD_DYMOLA} ": matlab based dymola adapters will be compiled.")
add_subdirectory(dymola-adapter)
else()
message(STATUS "BUILD_DYMOLA = " ${BUILD_DYMOLA} ": matlab based dymola adapters will not be compiled.")
endif()
message(STATUS "Matlab based components (sampling, mcla and dynamic-indexes) will be compiled.")
add_subdirectory(sampling)
add_subdirectory(mcla)
add_subdirectory(dynamic-indexes)
if(BUILD_DYMOLA)
message(STATUS "Dymola/Matlab based components (dymola-adapter) will be compiled.")
add_subdirectory(dymola-adapter)
else()
message(STATUS "Dymola/Matlab based components (dymola-adapter) will not be compiled.")
endif()
else()
message(STATUS "BUILD_MATLAB = " ${BUILD_MATLAB} ": Matlab based components will not be compiled.")
message(STATUS "Matlab based components (sampling, mcla and dynamic-indexes) will not be compiled.")
endif()

find_package(Doxygen)

if(DOXYGEN_FOUND)

set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(doxyfile ${CMAKE_BINARY_DIR}/Doxyfile)

Expand Down
111 changes: 110 additions & 1 deletion README.md
@@ -1,8 +1,117 @@
[![Build Status](https://travis-ci.org/itesla/ipst.svg?branch=master)](https://travis-ci.org/itesla/ipst)
[![Coverage Status](https://coveralls.io/repos/github/itesla/ipst/badge.svg?branch=master)](https://coveralls.io/github/itesla/ipst?branch=master)
[![MPL-2.0 License](https://img.shields.io/badge/license-MPL_2.0-blue.svg)](https://www.mozilla.org/en-US/MPL/2.0/)

# iTESLA
http://www.itesla-project.eu/

http://www.itesla-pst.org

## Environment requirements
In order to build iPST you need:
* JDK *(1.8 or greater)*
* Maven
* CMake *(2.6 or greater)*
* Recent C++ compiler (GNU g++ or Clang)
* OpenMPI *(1.8.3 or greater)*

Optional C++ modules requires:
* Intel Fortran Compiler
* Matlab
* Dymola
* Eurostag

### OpenMPI (required)
In order to support the MPI modules, you need to compile and install the [OpenMPI](https://www.open-mpi.org/) library.
```
$> wget http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.3.tar.bz2
$> tar xjf openmpi-1.8.3.tar.bz2
$> cd openmpi-1.8.3
$> ./configure --prefix=<INSTALL_DIR> --enable-mpi-thread-multiple
$> make install
$> export PATH=$PATH:<INSTALL_DIR>/bin
```

### Intel Fortran Compiler
To compile Eurostag dependant modules, you have to set your INTEL_HOME environment variable to the root of the
Intel Fortran Compiler installation.

## Install
To easily compile iPST, you can use the toolchain:
```
$> git clone https://github.com/itesla/ipst.git
$> ./install.sh
```
By default, the toolchain will:
* download and compile all external packages from the Internet
* compile C++ and Java modules
* install iPST

### Targets

| Target | Description |
| ------ | ----------- |
| clean | Clean iPST modules |
| clean-thirdparty | Clean the thirdparty libraries |
| compile | Compile iPST modules |
| package | Compile iPST modules and create a distributable package |
| __install__ | __Compile iPST modules and install it__ |
| docs | Generate the documentation (Doxygen/Javadoc) |
| help | Display this help |

### Options

The toolchain options are saved in the *install.cfg* configuration file. This configuration file is loaded and updated
each time you use the toolchain.

#### iPST

| Option | Description | Default value |
| ------ | ----------- | ------------- |
| --help | Display this help | |
| --prefix | Set the installation directory | $HOME/itesla |
| --package-type | Set the package format. The supported formats are zip, tar, tar.gz and tar.bz2 | zip |

#### C++ modules

| Option | Description | Default value |
| ------ | ----------- | ------------- |
| --with-dymola | Enable the compilation of Dymola dependant modules | $DYMOLA_HOME |
| --without-dymola | Disable the compilation of Dymola dependant modules | |
| --with-eurostag | Enable the compilation of Eurostag dependant modules | $EUROSTAG_SDK_HOME |
| --without-eurostag | Disable the compilation of Eurostag dependant modules | |
| --with-matlab | Enable the compilation of Matlab dependant modules | $MATLAB_HOME |
| --without-matlab | Disable the compilation of Matlab dependant modules | |

#### Third-parties

| Option | Description | Default value |
| ------ | ----------- | ------------- |
| --with-thirdparty | Enable the compilation of thirdparty libraries | |
| --without-thirdparty | Disable the compilation of thirdparty libraries | |
| --thirdparty-prefix | Set the thirdparty installation directory | $HOME/itesla_thirdparty |
| --thirdparty-download | Sets false to compile thirdparty libraries from a local repository | true |
| --thirdparty-packs | Sets the thirdparty libraries local repository | $HOME/itesla_packs |

### Default configuration file
```
ipst_prefix=$HOME/itesla
ipst_package_type=zip
# -- iPST C++ modules options --
eurostag_build=false
eurostag_home=$EUROSTAG_SDK_HOME
dymola_build=false
dymola_home=$DYMOLA_HOME
matlab_build=false
matlab_home=$MATLAB_HOME
# -- iPST thirdparty libraries --
thirdparty_build=true
thirdparty_prefix=$HOME/itesla_thirdparty
thirdparty_download=true
thirdparty_packs=$HOME/itesla_packs
```

## License
https://www.mozilla.org/en-US/MPL/2.0/
https://www.mozilla.org/en-US/MPL/2.0/
24 changes: 24 additions & 0 deletions cmake/FindDymola.cmake
@@ -0,0 +1,24 @@
# - Find Dymola
#
# Dymola_FOUND True if Dymola exists, false otherwise
#
# =============================================================================
# Copyright (c) 2016, RTE (http://www.rte-france.com)
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# =============================================================================

if (NOT DYMOLA_HOME AND NOT $ENV{DYMOLA_HOME} STREQUAL "")
set(DYMOLA_HOME $ENV{DYMOLA_HOME})
endif()

if (NOT DYMOLA_HOME AND NOT $ENV{DYMOLA_ROOT} STREQUAL "")
set(DYMOLA_HOME $ENV{DYMOLA_ROOT})
endif()

if (NOT DYMOLA_HOME OR NOT IS_DIRECTORY "${DYMOLA_HOME}")
message(FATAL_ERROR "Dymola not found. The variable DYMOLA_HOME is NOT set or is NOT a valid directory")
endif()

set(Dymola_FOUND TRUE)
64 changes: 64 additions & 0 deletions cmake/FindEurostag.cmake
@@ -0,0 +1,64 @@
# - Find Eurostag
#
# Eurostag_FOUND True if Eurostag exists, false otherwise
# Eurostag_INCLUDE_DIRS Include path
# Eurostag_LIBRARIES Eurostag libraries
#
# =============================================================================
# Copyright (c) 2016, RTE (http://www.rte-france.com)
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# =============================================================================

if (NOT EUROSTAG_SDK_HOME AND NOT $ENV{EUROSTAG_SDK_HOME} STREQUAL "")
set(EUROSTAG_SDK_HOME $ENV{EUROSTAG_SDK_HOME})
endif()

if (NOT EUROSTAG_SDK_HOME AND NOT $ENV{EUROSTAG_SDK_ROOT} STREQUAL "")
set(EUROSTAG_SDK_HOME $ENV{EUROSTAG_SDK_ROOT})
endif()

if (NOT EUROSTAG_SDK_HOME)
message(FATAL_ERROR "Eurostag SDK not found. The variable EUROSTAG_SDK_HOME is NOT set or is NOT a valid directory")
endif()

find_path(Eurostag_INCLUDE_DIR NAME api_eurostag.h HINTS ${EUROSTAG_SDK_HOME}/include)
mark_as_advanced(Eurostag_INCLUDE_DIR)

set(components
eustag_esg eustag_cpt
eustag_a light_lib_a_t
eustag_i
eustag_s light_lib_s
eustag_lf
light_lib_t_s light_lib_t
eustag_bld
util klu amd
)

include(FindPackageHandleStandardArgs)
foreach(component ${components})
string(TOUPPER ${component} COMPONENT)
set(Eurostag_${component}_FIND_QUIETLY true)

find_library(Eurostag_${component}_LIBRARY lib${component}.a HINTS ${EUROSTAG_SDK_HOME}/lib)
mark_as_advanced(Eurostag_${component}_LIBRARY)
find_package_handle_standard_args(Eurostag_${component} DEFAULT_MSG Eurostag_${component}_LIBRARY)

if (EUROSTAG_${COMPONENT}_FOUND)
set(Eurostag_LIBRARIES ${Eurostag_LIBRARIES} ${Eurostag_${component}_LIBRARY})
else()
message(FATAL_ERROR "Eurostag library not found: ${component}")
endif()

unset(EUROSTAG_${COMPONENT}_FOUND)
unset(COMPONENT)
unset(Eurostag_${component}_FIND_QUIETLY)
unset(Eurostag_${component}_LIBRARY)
endforeach()

set(Eurostag_FOUND true)
set(Eurostag_INCLUDE_DIRS ${Eurostag_INCLUDE_DIR})
message(STATUS "Eurostag SDK found: ${EUROSTAG_SDK_HOME}")

60 changes: 60 additions & 0 deletions cmake/FindHDF5.cmake
@@ -0,0 +1,60 @@
# - Find HDF5
#
# HDF5_FOUND True if HDF5 exists, false otherwise
# HDF5_INCLUDE_DIRS Include path
# HDF5_LIBRARIES HDF5 libraries
# HDF5_VERSION_STRING Library version
# HDF5_VERSION_MAJOR Library version (major version)
# HDF5_VERSION_MINOR Library version (minor version)
# HDF5_VERSION_PATCH Library version (patch level)
#
# =============================================================================
# Copyright (c) 2016, RTE (http://www.rte-france.com)
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# =============================================================================

if (NOT HDF5_HOME AND NOT $ENV{HDF5_HOME} STREQUAL "")
set(HDF5_HOME $ENV{HDF5_HOME})
endif()

if (NOT HDF5_HOME AND NOT $ENV{HDF5_ROOT} STREQUAL "")
set(HDF5_HOME $ENV{HDF5_ROOT})
endif()

if (NOT HDF5_HOME)
message(FATAL_ERROR "HDF5 libraries not found. The variable HDF5_HOME is NOT set or is NOT a valid directory")
endif()

find_path(HDF5_INCLUDE_DIR NAME hdf5.h H5pubconf.h HINTS ${HDF5_HOME}/include)
if (USE_STATIC_LIBS)
find_library(HDF5_LIBRARY libhdf5.a HINTS ${HDF5_HOME}/lib)
else()
find_library(HDF5_LIBRARY hdf5 HINTS ${HDF5_HOME}/lib)
endif()

mark_as_advanced(HDF5_INCLUDE_DIR HDF5_LIBRARY)

if (HDF5_INCLUDE_DIR AND EXISTS "${HDF5_INCLUDE_DIR}/H5pubconf.h")
set(_HDF5_VERSION_REGEX "^#define[ ^t]+H5_VERSION[ \t]+\"([^\"]+)\".*$")
file(STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" _HDF5_VERSION_STRING LIMIT_COUNT 1 REGEX ${_HDF5_VERSION_REGEX})
if (_HDF5_VERSION_STRING)
string(REGEX REPLACE "${_HDF5_VERSION_REGEX}" "\\1" HDF5_VERSION_STRING "${_HDF5_VERSION_STRING}")
endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HDF5 DEFAULT_MSG HDF5_LIBRARY HDF5_INCLUDE_DIR)
if (HDF5_FOUND)
if (DEFINED HDF5_FIND_VERSION)
if (${HDF5_FIND_VERSION} VERSION_GREATER ${HDF5_VERSION_STRING})
message(FATAL_ERROR "HDF5 ${HDF5_VERSION_STRING} found but ${HDF5_FIND_VERSION} is required")
endif()
endif()

set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
set(HDF5_LIBRARIES ${HDF5_LIBRARY})

message(STATUS "HDF5 version: ${HDF5_VERSION_STRING}")
endif()

0 comments on commit 80f066c

Please sign in to comment.