Skip to content

Commit

Permalink
import from dgcode git: version 2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tkittel committed Dec 2, 2020
1 parent b3bc23a commit d0b5f56
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 23 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
v2.2.0 2020-12-01
v2.2.1 2020-12-02
* Bugfix restoring support for .nxs/.laz/.lau files which was accidentally
disabled in v2.2.0.
* Modify CMake code slightly to avoid warnings or unset CMAKE_BUILD_TYPE
under certain conditions where NCrystal is included as a sub-project.

v2.2.0 2020-12-02
* Support plugins (github issue #50)! Such plugins can be externally
developed (for instance on GitHub), and either loaded dynamically at
run-time by NCrystal or statically compiled into the NCrystal library
Expand Down
40 changes: 29 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,46 @@
# #
##################################################################################

# We require cmake 3.10.0. This is intended to strike a balance between features
# We require cmake 3.10. This is intended to strike a balance between features
# and availability. Of popular platforms, a lower number would only have helped
# NCrystal usage on a few slightly older distributions such as Ubuntu 16.04 (has
# 3.5.1), Debian oldstable (has 3.7.2 as of Nov2020). CentOS6 and CentOS7 have
# CMake 2.8.12 which is clearly below any sensible threshold, so users on these
# platforms can already be expected to be used to install custom versions of
# tools like CMake (for instance CentOS7 provides cmake3 as a separate package,
# providing CMake 3.11). In any case, on platforms lacking CMake 3.10.0+, one
# providing CMake 3.11). In any case, on platforms lacking CMake 3.10, one
# must install a newer cmake somehow (this is usually rather simple). See also:
# https://cliutils.gitlab.io/modern-cmake/chapters/intro/installing.html
#
# The maximum value is the maximum value with which we have tested. The reason
# for specifying this maximum value is that it affects the default values of
# cmake policies, depending on which version introduced them.

cmake_minimum_required(VERSION 3.10.0)
cmake_minimum_required(VERSION 3.10...3.19)

# Respect value of CMAKE_BUILD_TYPE if already defined, otherwise fall back to
# Release. In any case, expose CMAKE_BUILD_TYPE as an explicit cache variable
# (gives drop-down list in gui). This must come before the call to project(..).
if(DEFINED CMAKE_BUILD_TYPE)
set(_def_cbt ${CMAKE_BUILD_TYPE})
else()
set(_def_cbt Release)
if(NOT DEFINED NCRYSTAL_NOTOUCH_CMAKE_BUILD_TYPE)
if(DEFINED CMAKE_BUILD_TYPE)
set(_def_cbt ${CMAKE_BUILD_TYPE})
else()
set(_def_cbt Release)
endif()
set(CMAKE_BUILD_TYPE ${_def_cbt} CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel and None (None means that CMAKE_CXX_FLAGS or CMAKE_C_FLAGS are used)." )
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel None )
endif()
set(CMAKE_BUILD_TYPE ${_def_cbt} CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel and None (None means that CMAKE_CXX_FLAGS or CMAKE_C_FLAGS are used)." )
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel None )

#Setup project:
project(NCrystal VERSION 2.2.0 LANGUAGES CXX C)
project(NCrystal VERSION 2.2.1 LANGUAGES CXX C)

if(NOT DEFINED NCRYSTAL_NOTOUCH_CMAKE_BUILD_TYPE)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
#This can happen if parent project called the project(..) function before
#doing the song and dance we did above.
set(CMAKE_BUILD_TYPE Release)
endif()
endif()

#Options:
option( BUILD_EXAMPLES "Whether to build examples." ON )
Expand Down Expand Up @@ -388,7 +402,11 @@ foreach(pluginentry ${BUILTIN_PLUGIN_LIST})
include(FetchContent)
endif()
message("---- Trying to install plugin via remote git repo: ${pluginentry_remoteurl} (gitref ${pluginentry_remoteref})")
FetchContent_Declare( ${pluginid} GIT_REPOSITORY "${pluginentry_remoteurl}" GIT_TAG "${pluginentry_remoteref}" GIT_SHALLOW TRUE )
FetchContent_Declare( ${pluginid}
GIT_REPOSITORY "${pluginentry_remoteurl}"
GIT_TAG "${pluginentry_remoteref}"
GIT_SHALLOW ON
)
FetchContent_GetProperties(${pluginid})
if(NOT ${pluginid}_POPULATED)
FetchContent_Populate(${pluginid})
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0
2.2.1
2 changes: 1 addition & 1 deletion cmake/ncrystal-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import os
import shlex
import shutil

cmakebool = lambda s : bool(s.lower() in ['1','on','yes','y'] or (s.isdigit() and int(s)>1))
cmakebool = lambda s : bool(s.lower() in ['1','on','yes','y','true'] or (s.isdigit() and int(s)>1))
#Information filled out by CMake (todo: put all logic below on cmake-side?):
installation_info = dict( libdir = '@NCrystal_relpath_BINDIR2LIBDIR@',
datadir = '@NCrystal_relpath_BINDIR2DATAROOT@/data' if cmakebool('@INSTALL_DATA@') else None,
Expand Down
6 changes: 3 additions & 3 deletions ncrystal_core/include/NCrystal/NCVersion.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

#define NCRYSTAL_VERSION_MAJOR 2
#define NCRYSTAL_VERSION_MINOR 2
#define NCRYSTAL_VERSION_PATCH 0
#define NCRYSTAL_VERSION 2002000 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "2.2.0"
#define NCRYSTAL_VERSION_PATCH 1
#define NCRYSTAL_VERSION 2002001 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "2.2.1"

#include "NCrystal/ncapi.h"
#include <stdexcept>
Expand Down
6 changes: 3 additions & 3 deletions ncrystal_core/include/NCrystal/ncrystal.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ extern "C" {
/* NCrystal version info: */
#define NCRYSTAL_VERSION_MAJOR 2
#define NCRYSTAL_VERSION_MINOR 2
#define NCRYSTAL_VERSION_PATCH 0
#define NCRYSTAL_VERSION 2002000 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "2.2.0"
#define NCRYSTAL_VERSION_PATCH 1
#define NCRYSTAL_VERSION 2002001 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "2.2.1"
NCRYSTAL_API int ncrystal_version(); /* returns NCRYSTAL_VERSION */
NCRYSTAL_API const char * ncrystal_version_str(); /* returns NCRYSTAL_VERSION_STR */

Expand Down
2 changes: 1 addition & 1 deletion ncrystal_core/src/NCPluginMgmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void NCP::ensurePluginsLoaded()
loadBuiltinPlugin("stdncmat",ncrystal_register_ncmat_factory);
#endif
#ifdef NCRYSTAL_ENABLE_NXSLAZ
loadBuiltinPlugin("nxslaz",ncrystal_register_ncmat_factory);//TODO: As external plugin?
loadBuiltinPlugin("nxslaz",ncrystal_register_nxslaz_factories);//TODO: As external plugin?
#endif

//Static custom (builtin) plugins:
Expand Down
2 changes: 1 addition & 1 deletion ncrystal_mcstas/NCrystal_sample.comp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* %I
*
* Written by: NCrystal developers
* Version: 2.2.0
* Version: 2.2.1
* Origin: NCrystal Developers (European Spallation Source ERIC and DTU Nutech)
*
* McStas sample component for the NCrystal scattering library. Find more
Expand Down
2 changes: 1 addition & 1 deletion ncrystal_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
################################################################################

__license__ = "Apache 2.0, http://www.apache.org/licenses/LICENSE-2.0"
__version__ = '2.2.0'
__version__ = '2.2.1'
__status__ = "Production"
__author__ = "NCrystal developers (Thomas Kittelmann, Xiao Xiao Cai)"
__copyright__ = "Copyright 2015-2020 %s"%__author__
Expand Down

0 comments on commit d0b5f56

Please sign in to comment.