diff --git a/CHANGELOG b/CHANGELOG index 8d6b12d7..ec37d15b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e85e755..73e2dc15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) @@ -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}) diff --git a/VERSION b/VERSION index ccbccc3d..c043eea7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.0 +2.2.1 diff --git a/cmake/ncrystal-config.in b/cmake/ncrystal-config.in index 49ee59eb..540ce520 100644 --- a/cmake/ncrystal-config.in +++ b/cmake/ncrystal-config.in @@ -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, diff --git a/ncrystal_core/include/NCrystal/NCVersion.hh b/ncrystal_core/include/NCrystal/NCVersion.hh index c5d3ae98..3b05ba01 100644 --- a/ncrystal_core/include/NCrystal/NCVersion.hh +++ b/ncrystal_core/include/NCrystal/NCVersion.hh @@ -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 diff --git a/ncrystal_core/include/NCrystal/ncrystal.h b/ncrystal_core/include/NCrystal/ncrystal.h index aac4fa48..4126058d 100644 --- a/ncrystal_core/include/NCrystal/ncrystal.h +++ b/ncrystal_core/include/NCrystal/ncrystal.h @@ -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 */ diff --git a/ncrystal_core/src/NCPluginMgmt.cc b/ncrystal_core/src/NCPluginMgmt.cc index ad1f54bf..c638cfec 100644 --- a/ncrystal_core/src/NCPluginMgmt.cc +++ b/ncrystal_core/src/NCPluginMgmt.cc @@ -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: diff --git a/ncrystal_mcstas/NCrystal_sample.comp b/ncrystal_mcstas/NCrystal_sample.comp index 85d2bf4d..2fc9549d 100644 --- a/ncrystal_mcstas/NCrystal_sample.comp +++ b/ncrystal_mcstas/NCrystal_sample.comp @@ -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 diff --git a/ncrystal_python/__init__.py b/ncrystal_python/__init__.py index 804048d9..f6835978 100644 --- a/ncrystal_python/__init__.py +++ b/ncrystal_python/__init__.py @@ -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__