Simplify CMake file and config.h
This commit is contained in:
parent
f9f70cf08b
commit
3ad8f5a641
@ -4,13 +4,13 @@
|
||||
# Robert Hauck - Enable support for PNG/Freetype
|
||||
# Qiangqiang Wu - Add biicode support
|
||||
|
||||
|
||||
# set compile flags
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
|
||||
|
||||
# move this to the end ??
|
||||
if(BIICODE)
|
||||
# prepare BII_LIB_SRC
|
||||
set(LIB_SRC ${BII_LIB_SRC})
|
||||
@ -33,23 +33,25 @@ if(WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
endif()
|
||||
|
||||
# More MSVC specific compilation flags
|
||||
#add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||
#add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
endif(MSVC)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
#Unicode
|
||||
option(NANA_UNICODE "Use Unicode Character Set" ON)
|
||||
#if(NANA_UNICODE)
|
||||
# add_definitions(-DNANA_UNICODE)
|
||||
# if(WIN32)
|
||||
# add_definitions(-DUNICODE -D_UNICODE)
|
||||
# endif()
|
||||
#endif()
|
||||
if(NANA_UNICODE)
|
||||
add_definitions(-DNANA_UNICODE)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_definitions(-DAPPLE)
|
||||
include_directories(/opt/X11/include/)
|
||||
elseif(UNIX)
|
||||
add_definitions(-Dlinux)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
#Find PNG
|
||||
if(UNIX)
|
||||
find_package(Freetype)
|
||||
if (FREETYPE_FOUND)
|
||||
@ -57,21 +59,36 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(NANA_ENABLE_PNG "Enable the use of PNG" ON)
|
||||
|
||||
#Find PNG
|
||||
option(NANA_ENABLE_PNG "Enable the use of PNG" OFF)
|
||||
option(USE_LIBPNG_FROM_OS "Use libpng from operating system." OFF)
|
||||
if(NANA_ENABLE_PNG)
|
||||
add_definitions(-DNANA_ENABLE_PNG)
|
||||
|
||||
option(NANA_LIBPNG "Use the included libpng" ON)
|
||||
if(NANA_LIBPNG)
|
||||
add_definitions(-DNANA_LIBPNG)
|
||||
else()
|
||||
if(USE_LIBPNG_FROM_OS)
|
||||
find_package(PNG)
|
||||
if (PNG_FOUND)
|
||||
include_directories( ${PNG_INCLUDE_DIRS})
|
||||
add_definitions(-DUSE_LIBPNG_FROM_OS)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#Find JPEG
|
||||
option(NANA_ENABLE_JPEG "Enable the use of JPEG" OFF)
|
||||
option(USE_LIBJPEG_FROM_OS "Use libjpeg from operating system." OFF)
|
||||
if(NANA_ENABLE_JPEG)
|
||||
add_definitions(-DNANA_ENABLE_JPEG)
|
||||
if(USE_LIBJPEG_FROM_OS)
|
||||
find_package(JPEG)
|
||||
if (JPEG_FOUND)
|
||||
include_directories( ${JPEG_INCLUDE_DIRS})
|
||||
add_definitions(-DUSE_LIBJPEG_FROM_OS)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
|
||||
set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Nana Configuration
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* @file: nana/config.hpp
|
||||
*/
|
||||
|
||||
#ifndef NANA_CONFIG_HPP
|
||||
#define NANA_CONFIG_HPP
|
||||
|
||||
//All defines have been moved to the CMakelists.txt in the root directory.
|
||||
|
||||
#endif //NANA_CONFIG_HPP
|
||||
@ -3,7 +3,7 @@
|
||||
#include <nana/deploy.hpp>
|
||||
#include <nana/audio/detail/audio_stream.hpp>
|
||||
|
||||
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#if defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#include <nana/std_thread.hpp>
|
||||
#include <nana/std_mutex.hpp>
|
||||
#include <nana/std_condition_variable.hpp>
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
/**
|
||||
* The charset Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* @file: nana/charset.hpp
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NANA_CHARSET_HPP
|
||||
#define NANA_CHARSET_HPP
|
||||
#include <string>
|
||||
@ -13,6 +27,7 @@ namespace nana
|
||||
{
|
||||
class charset_encoding_interface;
|
||||
}
|
||||
|
||||
/// An intelligent charset class for character code conversion.
|
||||
class charset
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
/**
|
||||
* Nana Configuration
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -13,15 +13,21 @@
|
||||
#ifndef NANA_CONFIG_HPP
|
||||
#define NANA_CONFIG_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
// Select platform ......
|
||||
|
||||
// Windows:
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
|
||||
#define NANA_WINDOWS 1
|
||||
|
||||
// compilers in Windows...
|
||||
|
||||
// MSVC++ versions
|
||||
#if defined(_MSC_VER)
|
||||
#define _SCL_SECURE_NO_WARNNGS
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#pragma warning(disable : 4996)
|
||||
|
||||
#if (_MSC_VER < 1900)
|
||||
// is this a good idea?
|
||||
#define NOT_IMPLEMENTED_KEYWORD_noexcept
|
||||
#endif // _MSC_VER < 1900
|
||||
#if (_MSC_VER == 1900)
|
||||
// google: break any code that tries to use codecvt<char16_t> or codecvt<char32_t>.
|
||||
// google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support.
|
||||
@ -30,46 +36,101 @@
|
||||
// google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources.
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
#endif // _MSC_VER == 1900
|
||||
#endif // _MSVC
|
||||
#endif // _MSVC
|
||||
|
||||
//Select platform automatically
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
//Windows:
|
||||
#define NANA_WINDOWS 1
|
||||
|
||||
//Test if it is MINGW
|
||||
// MINGW ...
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#define NANA_MINGW
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
// https://github.com/meganz/mingw-std-threads
|
||||
//#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
||||
//#define _GLIBCXX_HAS_GTHREADS
|
||||
//#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
|
||||
//#define STD_THREAD_NOT_SUPPORTED
|
||||
#if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2)))
|
||||
//Use this flag if MinGW version is older than 4.8.1
|
||||
#if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2)))
|
||||
|
||||
// ??
|
||||
#define UNDEFINED_to_string
|
||||
|
||||
// https://github.com/meganz/mingw-std-threads
|
||||
#define STD_THREAD_NOT_SUPPORTED
|
||||
#define USE_github_com_meganz_mingw_std_threads
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
|
||||
//Linux:
|
||||
|
||||
#endif // MINGW
|
||||
|
||||
// end Windows
|
||||
|
||||
|
||||
// MacOS: who define APPLE ??
|
||||
//#define APPLE
|
||||
#elif defined(APPLE)
|
||||
#define NANA_MACOS 1
|
||||
#define NANA_X11 1
|
||||
// how to add this: include_directories(/opt/X11/include/)
|
||||
// MacOS
|
||||
|
||||
// Linux:
|
||||
#elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
|
||||
|
||||
#define NANA_LINUX 1
|
||||
#define NANA_X11 1
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
#else
|
||||
# static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)");
|
||||
#endif
|
||||
|
||||
#if defined(NANA_MINGW) || defined(NANA_LINUX)
|
||||
// end Linux
|
||||
|
||||
|
||||
#else
|
||||
# static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)");
|
||||
#endif // Select platform
|
||||
|
||||
#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||
#undef NANA_WINDOWS
|
||||
#endif
|
||||
// End Select platform ......
|
||||
|
||||
// compilers ...
|
||||
|
||||
// GCC ...
|
||||
#if defined(__GNU__)
|
||||
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1)
|
||||
|
||||
//GCC 4.7.0 does not implement the <codecvt> and codecvt_utfx classes ??
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
|
||||
//Some functions which are specified in 21.5 Numeric conversions in Strings library have not yet implemented
|
||||
|
||||
//Implement workarounds for GCC/MinGW which version is below 4.8.2
|
||||
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
||||
#endif
|
||||
#endif // GCC
|
||||
// End compilers ...
|
||||
|
||||
|
||||
// Here defines some flags that tell Nana what features will be supported.
|
||||
|
||||
///////////////////
|
||||
//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.
|
||||
#if defined(NANA_ENABLE_PNG)
|
||||
#if not defined(USE_LIBPNG_FROM_OS)
|
||||
#define NANA_LIBPNG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Here defines some flags that tell Nana what features will be supported.
|
||||
///////////////////
|
||||
//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.
|
||||
#if defined(NANA_ENABLE_JPEG)
|
||||
#if not defined(USE_LIBJPEG_FROM_OS)
|
||||
#define NANA_LIBJPEG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//#ifndef NANA_UNICODE
|
||||
// always define NANA_UNICODE ?? it will be deprecated ?.
|
||||
#define NANA_UNICODE
|
||||
|
||||
#if defined(NANA_UNICODE) && defined(NANA_WINDOWS)
|
||||
@ -82,23 +143,5 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
///////////////////
|
||||
//Support for PNG
|
||||
// Define the NANA_ENABLE_PNG to enable the support of PNG.
|
||||
//
|
||||
//#define NANA_ENABLE_PNG //!
|
||||
#if defined(NANA_ENABLE_PNG)
|
||||
#define NANA_LIBPNG //Comment it to use libpng from operating system.
|
||||
#endif
|
||||
|
||||
///////////////////
|
||||
//Support for JPEG
|
||||
// Define the NANA_ENABLE_JPEG to enable the support of JPEG.
|
||||
//
|
||||
//#define NANA_ENABLE_JPEG //!
|
||||
#if defined(NANA_ENABLE_JPEG)
|
||||
#define NANA_LIBJPEG //Comment this whole line to use libjpeg from operating system.
|
||||
#endif
|
||||
|
||||
|
||||
#endif //NANA_CONFIG_HPP
|
||||
|
||||
@ -19,9 +19,7 @@
|
||||
|
||||
#include <nana/config.hpp>
|
||||
#include <nana/charset.hpp>
|
||||
#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||
#undef NANA_WINDOWS
|
||||
#endif
|
||||
|
||||
|
||||
//Implement workarounds for GCC/MinGW which version is below 4.8.2
|
||||
#if defined(STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
|
||||
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#if defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#include <nana/std_mutex.hpp>
|
||||
#else
|
||||
#include <mutex>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include <nana/traits.hpp>
|
||||
#include <nana/config.hpp>
|
||||
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#if defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#include <nana/std_mutex.hpp>
|
||||
#else
|
||||
#include <mutex>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#if defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#include <nana/std_thread.hpp>
|
||||
#include <nana/std_mutex.hpp>
|
||||
#include <nana/std_condition_variable.hpp>
|
||||
@ -29,7 +29,7 @@
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <thread>
|
||||
#endif //NANA_MINGW
|
||||
#endif // STD_THREAD_NOT_SUPPORTED
|
||||
|
||||
namespace nana
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <nana/gui/detail/native_window_interface.hpp>
|
||||
#include <nana/gui/screen.hpp>
|
||||
#if defined(NANA_WINDOWS)
|
||||
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#if defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#include <nana/std_mutex.hpp>
|
||||
#else
|
||||
#include <mutex>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#if defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#include <nana/std_mutex.hpp>
|
||||
#else
|
||||
#include <mutex>
|
||||
|
||||
@ -95,13 +95,13 @@ namespace nana
|
||||
|
||||
std::string pos_str() const
|
||||
{
|
||||
#ifdef NANA_MINGW
|
||||
#ifdef UNDEFINED_to_string
|
||||
std::stringstream ss;
|
||||
ss<<pos();
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_string(pos());
|
||||
#endif // NANA_MINGW
|
||||
#endif // UNDEFINED_to_string
|
||||
}
|
||||
|
||||
token read()
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#if defined(STD_THREAD_NOT_SUPPORTED)
|
||||
#include <nana/std_mutex.hpp>
|
||||
#else
|
||||
#include <mutex>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user