Commit 428e677a authored by Henderson, Shane's avatar Henderson, Shane
Browse files

Merge branch 'WheelFromCmake' into 'master'

Wheel from cmake

See merge request neams/saline!14
parents e41f1a29 20f08751
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ linux_gcc83_testing:
    - linux
    - gcc
  script:
    - git clone https://github.com/lefebvre/TriBITS.git TriBITS
    - ./TriBITS/tribits/ci_support/clone_extra_repos.py 
    - SRC_DIR=`pwd`
    - BLD_DIR="/tmp/$CI_PIPELINE_ID/$BLD_NAME"
    - mkdir -p $BLD_DIR
+22 −83
Original line number Diff line number Diff line
@@ -3,91 +3,30 @@
#             SALINE TriBITS Project and Package CMakeLists.txt File           #
#             Molten Salt Thermophysical Properties Interpolation              #
################################################################################
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(saline
  VERSION 0.0.1
  DESCRIPTION "MSTDB-TP API"
  LANGUAGES CXX
)

# Supported standards
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Configure the library
add_subdirectory(src)

# Testing is enabled unless explicitly turned off
if (NOT DEFINED saline_ENABLE_tests )
  set(saline_ENABLE_tests ON)
endif()
if (saline_ENABLE_tests )
  include(CTest)
  add_subdirectory(tests)
endif()

#
# Incorporate GitLab CI Traceability 
# 
if(DEFINED ENV{CI_PROJECT_URL})
    message(STATUS "GitLab CI Job Info:  $ENV{CI_PROJECT_URL}/-/jobs/$ENV{CI_JOB_ID}")
endif()

IF(NOT DEFINED SALINE_DEBUG_OUTPUT)
   SET(SALINE_DEBUG_OUTPUT 0 CACHE STRING "Display debug output.")
ENDIF()
IF(SALINE_DEBUG_OUTPUT)
   ADD_DEFINITIONS("-DSALINE_DEBUG_OUTPUT=${SALINE_DEBUG_OUTPUT}")
ENDIF()

IF(NOT DEFINED SALINE_TIMING)
   SET(SALINE_TIMING 0 CACHE STRING "Timing setting.")
ENDIF()
IF(SALINE_TIMING)
   ADD_DEFINITIONS("-DSALINE_TIMING=${SALINE_TIMING}")
ENDIF()

IF(NOT DEFINED SALINE_DBC)
   SET(SALINE_DBC 0 CACHE STRING "DBC setting.")
ENDIF()
IF(SALINE_DBC)
   ADD_DEFINITIONS("-DSALINE_DBC=${SALINE_DBC}")
ENDIF()
IF(BUILD_SHARED_LIBS)
   ADD_DEFINITIONS("-DBUILD_SHARED")
ENDIF()

SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

IF (NOT TRIBITS_PROCESSING_PACKAGE)
  # This CMakeLists.txt file is being processed as the saline TriBITS projects's base
  # CMakeLists.txt file!  (See comments at bottom of this file.)
  CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR)
  INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/ProjectName.cmake")
  PROJECT(${PROJECT_NAME} NONE)
  # enable C++11 by default
  SET(saline_ENABLE_CXX11 ON CACHE BOOL "Compile using the C++11 standard" FORCE)
  # disable generating HTML dependencies webpage and xml files
  SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE OFF CACHE BOOL "")
  # disable TriBITS export system to save time configuring
  SET(${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES OFF CACHE BOOL "")
  SET(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES OFF CACHE BOOL "")
  SET(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/TriBITS/tribits" CACHE PATH "")
  INCLUDE("${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake")
  SET(${PROJECT_NAME}_ENABLE_TESTS ON CACHE BOOL "Enable tests by default.")
  # default fortran support off
  IF(NOT ${PROJECT_NAME}_ENABLE_Fortran)
     SET(${PROJECT_NAME}_ENABLE_Fortran OFF CACHE BOOL "Enable fortran support")
  ENDIF()
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none")
  # default MPI support off
  IF(NOT TPL_ENABLE_MPI)
    SET(TPL_ENABLE_MPI OFF CACHE BOOL "Enable MPI support")
  ENDIF()
  #
  # For windows with BUILD_SHARED_LIBS we must use CMAKE_RUNTIME_OUTPUT_DIRECTORY
  # to place all *dll and *exe in the same directory so unit tests will work
  IF("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND BUILD_SHARED_LIBS)
    IF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
      SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cmake_runtime_output" CACHE STRING "")
    ENDIF()
  ENDIF()

  TRIBITS_PROJECT_ENABLE_ALL()
ELSE()
  # This CMakeLists.txt file is being processed as the TriBITS package file.
  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
  # include binary directory for configured includes
  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
  TRIBITS_PACKAGE_DECL(saline)
  #
  # Process subpackages
  #
  TRIBITS_PROCESS_SUBPACKAGES()
  TRIBITS_PACKAGE_DEF()
  TRIBITS_PACKAGE_POSTPROCESS()
ENDIF()

# NOTE: In order to allow the `saline/` directory to be both a TriBITS
# package (for inclusion in other TriBITS projects) and to be a TriBITS
# project itself, you only have to put in a simple if statement in this
# top-level CMakeLists.txt file.  That is all!

PackagesList.cmake

deleted100644 → 0
+0 −25
Original line number Diff line number Diff line
##---------------------------------------------------------------------------##
## saline/PackagesList.cmake
##---------------------------------------------------------------------------##
#
# See documentation in TriBITS https://tribits.org


##---------------------------------------------------------------------------##
## PACKAGES PROVIDED
##---------------------------------------------------------------------------##

TRIBITS_REPOSITORY_DEFINE_PACKAGES(
  googletest googletest/googletest PT
  testframework testframework PT
  saline  . PT
)

TRIBITS_ALLOW_MISSING_EXTERNAL_PACKAGES(
   googletest
   testframework
)

##---------------------------------------------------------------------------##
##                     end of saline/PackagesList.cmake
##---------------------------------------------------------------------------##
+87 −42
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ All properties are evualted as saturated liquid.
  - Conductivity  - Watts per Meter-Kelvin (W/m K)
  - Pressure      - Kilopascal (kPa)
  - Temperature   - Kelvin (K)
*   Enthalpy      - Joule per mole (J/mole)
  - Enthalpy      - Joule per mole (J/mole)
  - Viscosity     - Centipoise (cP) or milli Newton-second per square Meter (mN.s/m^2)
  - Specific Heat - Joules per Kelvin Mole (J/K mole)
  - Density       - Grams per Cubic Centimeter (g/cc)
@@ -22,7 +22,7 @@ The [`Thermophysical_Properties`](./src/thermophysical_properties.hh) class wrap

The `Data_Store` interface provides an integration point for data and the data format and type (e.g.,CSV vs HDF5, functional vs tabular).

The Data_Store has a convience class `View` to insulate Data_Store access.
The Data_Store has a convenience class `View` to insulate Data_Store access.


>Note:: Pressure parameters are ignored, currently.
@@ -35,51 +35,96 @@ For individuals wanting to compile the code from source, below are the tested re

## Requirements
* C/C++ compiler C++11 compliant/capable
      * GCC-6.4 tested on Mac OS
    * Git 2.15+
    * CMake 3.1 or newer
* CMake 3.16 or newer
* Git 2.15+ (Recommended)

## Configuration and Compilation

* Save the ssh-key in [code-int.ornl.gov](https://code-int.ornl.gov/profile/keys).
* Clone saline `git clone git@code-int.ornl.gov:lefebvre/saline.git ~/saline`
The Paths used below, `~/saline` and `~/build/saline`, are totally arbitrary. Feel free to chose paths that work for your workflow.

* Obtain local copy of source code
  * Via ssh (Requires [XCAMS](https://xcams.ornl.gov/xcams/) account)
    * [Setup ssh access](https://docs.gitlab.com/ee/user/ssh.html) (if not already completed)
      * Generate ssh key
      * Save ssh key to Gitlab profile [code.ornl.gov](https://code.ornl.gov/-/profile/keys)
    * Clone saline `git clone git@code.ornl.gov:NEAMS/saline.git ~/saline`
  * Via https:
    * Clone saline `https://code.ornl.gov/neams/saline.git ~/saline`
* Change directory into saline `cd ~/saline`
* Clone TriBITS `git clone https://github.com/lefebvre/TriBITS.git TriBITS` [TriBITS documentation](https://tribits.org/doc/TribitsDevelopersGuide.html)
* Clone extra repos `./TriBITS/tribits/ci_support/clone_extra_repos.py`
* Create a build directory `mkdir -p ~/build/saline`
* Change into the build `cd ~/build/saline`
* Create a configuration script in ~/build/. Let's call it `../configure.sh` (linux)

* Change into the build directory `cd ~/build/saline`
* Configure the build:
  * Linux/Macos:
  ```
#!/bin/bash
# Linux bash file example
rm -rf CMake*
    cmake \
      -DBUILD_SHARED_LIBS:BOOL=ON \
      -DCMAKE_BUILD_TYPE:STRING=RELEASE \
 -D saline_ENABLE_ALL_PACKAGES:BOOL=ON \
      -Dsaline_ENABLE_TESTS:BOOL=ON \
 -D CMAKE_INSTALL_PREFIX=`pwd`/install \
 -G "Unix Makefiles" \
      ~/saline
    make
  ```
  * Windows
  ```
    cmake \
      -DBUILD_SHARED_LIBS:BOOL=ON \
      -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=BOOL=ON \
      ~\saline
    cmake --build .\ --target ALL_BUILD --config Release
  ```
  * Additional Saline specific configuration options will be covered as they are added.
* Run tests using `ctest`
  * A satisfactory build should yield test results like this (total number of tests may change at any time)
  ```
  100% tests passed, 0 tests failed out of 18

Lastly, perform the following commands

```bash
../configure.sh    # execute the configuration script
make -j8 install   # compile and install the library and tests
ctest -V -j 8      # execute the tests (verbosely) 
  Total Test time (real) =   0.46 sec
  ```
  >Note:: Testing is enabled by default and has a dependency on[googletest](https://github.com/google/googletest).
  Cmake resolves this dependency at configuration time using [FetchContent](https://cmake.org/cmake/help/v3.16/module/FetchContent.html).

  The option `-Dsaline_ENABLE_TESTS:BOOL=OFF` will disable testing if desired.

### Enabling Fortran Support
### Language Extension

To enable Fortran, export saline_ENABLE_Fortran=ON. 
Wrappers are generated for the [`Thermophysical_Properties`](./src/thermophysical_properties.hh) and the [`Default_Data_Store`](./src/default_data_store.hh) classes.

An experimental feature [`r_kister_data_store`](./src/r_kister_data_store.hh) is also wrapped, but casual users are discouraged from using this feature at this time.

#### Enabling Fortran Support

Fortran wrappers are currently generated during the development cycle. Unfortunately this process is not public at this time.

The Fortran compiler must be 2003 compliant and support the ISO_C_BINDINGS.

```bash
export saline_ENABLE_Fortran=ON # Enable the Fortran library and bindings
../configure.sh    # execute the configuration script
make -j8 install   # compile and install the library and tests
ctest -V -j 8      # execute the tests (verbosely) 
To enable Fortran, pass the option `-Dsaline_ENABLE_Fortran:BOOL=ON` as in:
```
    cmake \
      -DBUILD_SHARED_LIBS:BOOL=ON \
      -DCMAKE_BUILD_TYPE:STRING=RELEASE \
      -Dsaline_ENABLE_TESTS:BOOL=ON \
      -Dsaline_ENABLE_Fortran:BOOL=ON \
      ~/saline
```

#### Enabling Python Support

Python Wrappers are generated using [SWIG-4.0.2](https://www.swig.org/download.html).

To enable Python, pass the option `-Dsaline_ENABLE_Python:BOOL=ON` as in:
```
    cmake \
      -DBUILD_SHARED_LIBS:BOOL=ON \
      -DCMAKE_BUILD_TYPE:STRING=RELEASE \
      -Dsaline_ENABLE_TESTS:BOOL=ON \
      -Dsaline_ENABLE_Python:BOOL=ON \
      ~/saline
```

#### Additional Languages

Wrappers are added on an as needed basis. Thanks to [SWIG](https://www.swig.org) this process is relatively painless. Different languages have different requirements though, so mileage varies.

# Contributions

At this time the main development repository is protected. Users with [XCAMS](https://xcams.ornl.gov/xcams/) accounts are welcome to join this project and submit issues/branches to this repository for consideration.
Contributors with UCAMS accounts may be invited to join the development repository directly.
Users without UCAMS or [XCAMS](https://xcams.ornl.gov/xcams/) access should contact mstdb@ornl.gov for guidance on comment submission.

TPLsList.cmake

deleted100644 → 0
+0 −61
Original line number Diff line number Diff line
##---------------------------------------------------------------------------##
## saline/TPLsList.cmake
##---------------------------------------------------------------------------##
#
# Define the list of TPLs, their find module names, and their classification
#
# TPL_NAME:
#
#   The name of the TPL used in the CMake cache variables TPL_ENABLE_${TPL_NAME}
#
# TPL_FINDMOD:
#
#   The name of the find module under that is used to get the names of the
#   TPLs.  If ends in '/' then this gives the directory and the standard module
#   name will be used which is FindTPL${TPL_NAME}.cmake.
#
# TPL_CLASSIFICATION:
#
#   PS: Primary Stable TPL
#
#     Primary Stable TPLs are those TPLs that a Trilinos developer must have
#     installed on their machine in order to be able to do Trilinos
#     development.  For example, we require that you have BLAS, LAPACK, and
#     MPI installed in order to do Trilinos development.  These are
#     fundamental dependencies that are needed in order to do precheckin
#     testing.
#
#   SS: Secondary Stable TPL
#
#     Secondary Stable TPLs are those TPLs that are not required in order to
#     be able to develop and test Trilinos before checkins but are none the
#     less offically supported.  Support for SS TPLs is tested as part of the
#     nightly testing process.
#
#   TS: Tertiary Stable TPL
#
#     Tertiary Stable TPLs are those TPLs that are supported TPLs but can not
#     be included in the set of SS TPLs because they may conflicit with other
#     SS Code.  For example, METIS is listed as a TS TPL because it conflicts
#     with ParMETIS which is declared as a SS TPL.
#
#   EX: Experimental TPL
#
#     Experimental TPLs are not offically supported.  They represent
#     experimental capabilities of Trilinos packages.  Support for EX TPLs is
#     never tested as part of the main nightly testing process.  However,
#     package developers are encouraged to set up their own nightly testing
#     for their EX TPLs for their packages.
#
# The default enable for all TPLs is empty "" reguardless of the category.
# The idea is that the enabling of the TPL will be done by the package and
# other enables that the user has to set.
#

SET(saline_TPLS_FINDMODS_CLASSIFICATIONS
# LAPACK "TriBITS/tribits/common_tpls/FindTPLLAPACK.cmake" PT
)

##---------------------------------------------------------------------------##
##                      end of saline/TPLsList.cmake
##---------------------------------------------------------------------------##
Loading