From 186be4a99b08bfd3d4b7abde7b581f743834d6e4 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 16 Feb 2016 11:53:27 +0100 Subject: [PATCH] CMAKE_BOOST_FILESYSTEM_AVAILABLE --- CMakeLists.txt | 29 ++++++++++++++++++++++++++++- include/nana/config.hpp | 37 ++++++++++++++++++++++++++----------- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55ab1c01..f4b6ec4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,37 @@ option(ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF) option(CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." OFF) option(CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." OFF) - +# The ISO C++ File System Technical Specification is optional. +# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf +# This is not a workaround, but an user option. +# The library maybe available in the std library in use or from Boost (almost compatible) +# http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/index.htm +# or you can choose to use the (partial, but functional) implementation provided by nana. +# If you include the file +# The selected option will be set by nana into std::experimental::filesystem +# By default Nana will use the ISO TS if available, or nana if not. +# Boost will be use only if you change one of the following: +option(CMAKE_BOOST_FILESYSTEM_AVAILABLE "Is Boost filesystem available?" OFF) +option(NANA_BOOST_FILESYSTEM_PREFERRED "Is Boost filesystem preferred over nana?" OFF) +option(CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if available (over ISO)?" OFF) +option(CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find ?" "../") +option(CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs") set(NANA_LINKS) +if (CMAKE_BOOST_FILESYSTEM_AVAILABLE) + if (CMAKE_BOOST_FILESYSTEM_PREFERED OR CMAKE_BOOST_FILESYSTEM_FORCE) + add_definitions(-DNANA_BOOST_FILESYSTEM_AVAILABLE) + if (CMAKE_BOOST_FILESYSTEM_FORCE) + add_definitions(-DNANA_BOOST_FILESYSTEM_FORCE) + else() + add_definitions(-DNANA_BOOST_FILESYSTEM_PREFERED) + endif() + include_directories("${CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT}") + list(APPEND NANA_LINKS "${CMAKE_BOOST_FILESYSTEM_LIB}") + endif (CMAKE_BOOST_FILESYSTEM_PREFERED OR CMAKE_BOOST_FILESYSTEM_FORCE) +endif (CMAKE_BOOST_FILESYSTEM_AVAILABLE) + project(nana) cmake_minimum_required(VERSION 2.8) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index f27e1763..6335f2e2 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -31,22 +31,37 @@ // Here defines some flags that tell Nana what features will be supported. - -//Support of std::thread -//Boost.Thread is preferred. -//NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is only available on MinGW when STD_THREAD_NOT_SUPPORTED is defined. -//if NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is enabled, Boost.Thread will be replaced with meganz's mingw-std-threads. -//https://github.com/meganz/mingw-std-threads +/////////////////////////// +// Support of std::thread +// Boost.Thread is preferred. +// NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is only available on MinGW when STD_THREAD_NOT_SUPPORTED is defined. +// if NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is enabled, Boost.Thread will be replaced with meganz's mingw-std-threads. +// https://github.com/meganz/mingw-std-threads //#define NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ +//////////////////////////// +// The ISO C++ File System Technical Specification is optional. +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf +// This is not a workaround, but an user option. +// The library maybe available in the std library in use or from Boost (almost compatible) +// http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/index.htm +// or you can choose to use the (partial, but functional) implementation provided by nana. +// If you include the file +// The selected option will be set by nana into std::experimental::filesystem +// By default Nana will use the ISO TS if available, or nana if not. +// Boost will be use only if you change one of the following (set the includes and link correspondly): +//#define NANA_BOOST_FILESYSTEM_AVAILABLE // "Is Boost filesystem available?" +//#define NANA_BOOST_FILESYSTEM_PREFERRED // "Is Boost filesystem preferred over nana?" +//#define NANA_BOOST_FILESYSTEM_FORCE // "Force use of Boost filesystem if available (over ISO)? + /////////////////// -//Support of PCM playback +// Support of PCM playback // #define NANA_ENABLE_AUDIO /////////////////// -//Support for PNG -// Define the NANA_ENABLE_PNG to enable the support of PNG. +// Support for PNG +// Define the NANA_ENABLE_PNG to enable the support of PNG. // //#define NANA_ENABLE_PNG //! //#define USE_LIBPNG_FROM_OS // Un-Comment it to use libpng from operating system. @@ -57,8 +72,8 @@ #endif /////////////////// -//Support for JPEG -// Define the NANA_ENABLE_JPEG to enable the support of JPEG. +// Support for JPEG +// Define the NANA_ENABLE_JPEG to enable the support of JPEG. // //#define NANA_ENABLE_JPEG //! //#define USE_LIBJPEG_FROM_OS // Un-Comment it to use libjpeg from operating system.