Commit 7702eef3 authored by Michael Turner's avatar Michael Turner
Browse files

Merge branch 'feature/remove-loki' into 'master'

Remove Loki as a dependency, require C++11 support in library

See merge request !767
parents e598a95c 99e251fc
......@@ -11,6 +11,6 @@ AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
IndentCaseLabels: true
Standard: Cpp03
Standard: Cpp11
AccessModifierOffset: -4
BinPackParameters: true
......@@ -5,14 +5,34 @@ RelWithDebInfo MinSizeRel.")
PROJECT(Nektar++ C CXX)
# Nektar++ requires C++11. Try to infer this for older CMake versions (less than
# 3.1.0)
IF ("${CMAKE_VERSION}" VERSION_LESS "3.1")
IF (NOT MSVC)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
IF (COMPILER_SUPPORTS_CXX11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSE()
MESSAGE(FATAL_ERROR "Nektar++ requires a compiler with C++11 support.")
ENDIF()
ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
MESSAGE(FATAL_ERROR "Nektar++ requires full C++11 support: please upgrade to Visual Studio 2013 or later")
ENDIF()
ELSE()
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
ENDIF()
INCLUDE(CheckLanguage)
CHECK_LANGUAGE(Fortran)
IF(CMAKE_Fortran_COMPILER)
ENABLE_LANGUAGE(Fortran)
ENABLE_LANGUAGE(Fortran)
ELSE()
MESSAGE(STATUS "No Fortran support")
MESSAGE(STATUS "No Fortran support")
ENDIF()
# Helps organize projects in IDEs.
......@@ -222,7 +242,6 @@ ENDIF ()
# Find ThirdParty libraries and headers.
INCLUDE (ThirdPartyTinyxml)
INCLUDE (ThirdPartyLoki)
INCLUDE (ThirdPartyMetis)
INCLUDE (ThirdPartyHDF5)
INCLUDE (ThirdPartyScotch)
......
......@@ -50,10 +50,6 @@ SET(Boost_LIBRARY_DIRS "@Boost_CONFIG_LIBRARY_DIR@")
SET(NEKTAR++_TP_LIBRARIES
${NEKTAR++_TP_LIBRARIES} ${Boost_LIBRARIES})
SET(LOKI_INCLUDE_DIRS "@LOKI_CONFIG_INCLUDE_DIR@")
SET(NEKTAR++_TP_INCLUDE_DIRS
${NEKTAR++_TP_INCLUDE_DIRS} ${LOKI_INCLUDE_DIRS})
SET(TINYXML_INCLUDE_DIRS "@TINYXML_CONFIG_INCLUDE_DIR@")
SET(NEKTAR++_TP_INCLUDE_DIRS
${NEKTAR++_TP_INCLUDE_DIRS} ${TINYXML_INCLUDE_DIRS})
......
########################################################################
#
# ThirdParty configuration for Nektar++
#
# Loki headers library
#
########################################################################
# Try to find system Loki headers. Hint /opt/local/include for MacPorts
# (although there is no Portfile for Loki currently).
FIND_PATH(LOKI_INCLUDE_DIR loki/Singleton.h PATHS /opt/local/include)
IF (LOKI_INCLUDE_DIR)
SET(BUILD_LOKI OFF)
ELSE()
SET(BUILD_LOKI ON)
ENDIF()
OPTION(THIRDPARTY_BUILD_LOKI
"Download and extract Loki library to ThirdParty." ${BUILD_LOKI})
IF (THIRDPARTY_BUILD_LOKI)
# Download Loki if it doesn't already exist.
IF (NOT EXISTS ${TPSRC}/loki-0.1.3.tar.bz2)
FILE(DOWNLOAD ${TPURL}/loki-0.1.3.tar.bz2 ${TPSRC}/loki-0.1.3.tar.bz2)
ENDIF()
# TODO: Check hashes.
# Extract.
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E tar jxf ${TPSRC}/loki-0.1.3.tar.bz2
WORKING_DIRECTORY ${TPSRC}
)
# Set LOKI_INCLUDE_DIR.
FILE(COPY ${TPSRC}/loki-0.1.3/include/loki/ DESTINATION ${TPDIST}/include/loki/)
SET(LOKI_INCLUDE_DIR ${TPDIST}/include CACHE PATH "" FORCE)
MESSAGE(STATUS "Build Loki: ${LOKI_INCLUDE_DIR}")
SET(LOKI_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
MESSAGE(STATUS "Found Loki: ${LOKI_INCLUDE_DIR}")
SET(LOKI_CONFIG_INCLUDE_DIR ${LOKI_INCLUDE_DIR})
ENDIF()
INCLUDE_DIRECTORIES(SYSTEM ${LOKI_INCLUDE_DIR})
MARK_AS_ADVANCED(LOKI_INCLUDE_DIR)
......@@ -25,7 +25,7 @@ IF( NEKTAR_USE_MPI )
IF (NOT "${HAVE_MPI_H}" OR NOT "${HAVE_MPI_SEND}")
FIND_PACKAGE(MPI REQUIRED)
INCLUDE_DIRECTORIES( ${MPI_CXX_INCLUDE_PATH} )
INCLUDE_DIRECTORIES(SYSTEM ${MPI_CXX_INCLUDE_PATH} )
MESSAGE(STATUS "Found MPI: ${MPI_CXX_LIBRARIES}")
ELSE()
SET(MPI_BUILTIN ON)
......
......@@ -36,6 +36,9 @@ IF( NEKTAR_USE_VTK )
FIND_PACKAGE(VTK)
IF (VTK_FOUND)
MESSAGE(STATUS "Found VTK: ${VTK_USE_FILE}")
IF (VTK_MAJOR_VERSION EQUAL 6 AND VTK_MINOR_VERSION EQUAL 0 AND VTK_BUILD_VERSION EQUAL 0)
ADD_DEFINITIONS(-DNEKTAR_HAS_VTK_6_0_0)
ENDIF()
ELSE (VTK_FOUND)
MESSAGE(FATAL_ERROR "VTK not found")
ENDIF (VTK_FOUND)
......
......@@ -640,10 +640,6 @@ automatically built during the \nekpp build process. Below are the choices of X:
(MPI-only) Parallel communication library.
\item \inlsh{LOKI}
An implementation of a singleton.
\item \inlsh{METIS}
A graph partitioning library used for substructuring of matrices and mesh
......
......@@ -33,7 +33,6 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <loki/Singleton.h>
#include <Collections/Operator.h>
#include <Collections/Collection.h>
......
......@@ -33,7 +33,6 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <loki/Singleton.h>
#include <Collections/Operator.h>
#include <Collections/Collection.h>
#include <Collections/IProduct.h>
......
......@@ -33,7 +33,6 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <loki/Singleton.h>
#include <Collections/Operator.h>
#include <Collections/Collection.h>
#include <Collections/IProduct.h>
......
......@@ -33,7 +33,6 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <loki/Singleton.h>
#include <Collections/Operator.h>
#include <Collections/Collection.h>
......@@ -109,11 +108,8 @@ Operator::~Operator()
*/
OperatorFactory& GetOperatorFactory()
{
typedef Loki::SingletonHolder<OperatorFactory,
Loki::CreateUsingNew,
Loki::NoDestroy,
Loki::SingleThreaded> Type;
return Type::Instance();
static OperatorFactory instance;
return instance;
}
......
......@@ -33,7 +33,6 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <loki/Singleton.h>
#include <Collections/Operator.h>
#include <Collections/Collection.h>
......
......@@ -43,6 +43,4 @@
#define FIELD_UTILS_EXPORT
#endif
#define LOKI_CLASS_LEVEL_THREADING
#endif // NEKTAR_FIELD_UTILS_DECLSPEC_H
......@@ -48,10 +48,8 @@ namespace FieldUtils
*/
ModuleFactory &GetModuleFactory()
{
typedef Loki::SingletonHolder<ModuleFactory, Loki::CreateUsingNew,
Loki::NoDestroy, Loki::SingleThreaded>
Type;
return Type::Instance();
static ModuleFactory instance;
return instance;
}
/**
......
......@@ -48,10 +48,8 @@ bool Mapping::m_isDefined = false;
MappingFactory& GetMappingFactory()
{
typedef Loki::SingletonHolder<MappingFactory,
Loki::CreateUsingNew,
Loki::NoDestroy > Type;
return Type::Instance();
static MappingFactory instance;
return instance;
}
Mapping::Mapping(const LibUtilities::SessionReaderSharedPtr& pSession,
......
......@@ -43,8 +43,6 @@
#include <LibUtilities/BasicUtils/FieldIO.h>
#include <LibUtilities/BasicUtils/FileSystem.h>
#include <loki/Singleton.h>
#include <fstream>
#include <set>
......@@ -73,10 +71,8 @@ std::string fldCmdFormat = SessionReader::RegisterCmdLineArgument(
*/
FieldIOFactory &GetFieldIOFactory()
{
typedef Loki::
SingletonHolder<FieldIOFactory, Loki::CreateUsingNew, Loki::NoDestroy,
Loki::ClassLevelLockable> Type;
return Type::Instance();
static FieldIOFactory instance;
return instance;
}
/// Enumerator for auto-detection of FieldIO types.
......
......@@ -69,11 +69,8 @@ namespace Nektar
{
MeshPartitionFactory& GetMeshPartitionFactory()
{
typedef Loki::SingletonHolder<MeshPartitionFactory,
Loki::CreateUsingNew,
Loki::NoDestroy,
Loki::SingleThreaded> Type;
return Type::Instance();
static MeshPartitionFactory instance;
return instance;
}
MeshPartition::MeshPartition(const LibUtilities::SessionReaderSharedPtr& pSession) :
......
......@@ -48,11 +48,8 @@ namespace Thread
*/
ThreadManagerFactory& GetThreadManagerFactory()
{
typedef Loki::SingletonHolder<ThreadManagerFactory,
Loki::CreateUsingNew,
Loki::NoDestroy,
Loki::SingleThreaded> Type;
return Type::Instance();
static ThreadManagerFactory instance;
return instance;
}
/**
......@@ -142,11 +139,8 @@ ThreadMaster::~ThreadMaster()
*/
ThreadMaster& GetThreadMaster()
{
typedef Loki::SingletonHolder<ThreadMaster,
Loki::CreateUsingNew,
Loki::NoDestroy,
Loki::SingleThreaded> Type;
return Type::Instance();
static ThreadMaster instance;
return instance;
}
......
......@@ -45,7 +45,6 @@
#include <boost/enable_shared_from_this.hpp>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <loki/Singleton.h>
namespace Nektar
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment