update CMakeLists for new configuration structure

This commit is contained in:
Jinhao 2016-02-01 00:16:40 +08:00
parent 397096f60e
commit ce7b044186
3 changed files with 21 additions and 36 deletions

View File

@ -7,10 +7,9 @@
#https://cmake.org/cmake-tutorial/
#https://cmake.org/cmake/help/v3.3/module/CMakeDependentOption.html?highlight=cmakedependentoption
# use CACHE FORCE or set(USE_meganz_mingw_std_threads ON) or delete CMakecache.txt or the entirely build dir
# use CACHE FORCE or set(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ ON) or delete CMakecache.txt or the entirely build dir
# if your changes don't execute
option(USE_meganz_mingw_std_threads "replaced boost.thread with meganz's mingw-std-threads." OFF)
option(USE_UNICODE "Use Unicode Character Set" ON)
option(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ "replaced boost.thread with meganz's mingw-std-threads." OFF)
option(ENABLE_PNG "Enable the use of PNG" OFF)
option(LIBPNG_FROM_OS "Use libpng from operating system." ON)
option(ENABLE_JPEG "Enable the use of JPEG" OFF)
@ -18,15 +17,12 @@ option(LIBJPEG_FROM_OS "Use libjpeg from operating system." ON)
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)
option(CMAKE_STD_make_unique_NOT_SUPPORTED "Add support for make_unique<>()." OFF)
#set(CMAKE_STD_make_unique_NOT_SUPPORTED OFF)
# 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
@ -40,6 +36,7 @@ endif(BIICODE)
project(nana)
cmake_minimum_required(VERSION 2.8)
add_definitions(-DNANA_IGNORE_CONF)
if(WIN32)
add_definitions(-DWIN32)
@ -54,22 +51,13 @@ if(WIN32)
endif(MSVC)
if(MINGW)
add_definitions(-DMINGW)
#Find PNG
if(USE_meganz_mingw_std_threads)
add_definitions(-DUSE_github_com_meganz_mingw_std_threads)
# remove_definitions()
endif(USE_meganz_mingw_std_threads)
if(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
add_definitions(-DNANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
endif(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
endif(MINGW)
endif(WIN32)
#Unicode
if(USE_UNICODE)
add_definitions(-DNANA_UNICODE)
endif(USE_UNICODE)
if(APPLE)
add_definitions(-DAPPLE)
include_directories(/opt/X11/include/)
@ -117,11 +105,6 @@ if(CMAKE_VERBOSE_PREPROCESSOR)
add_definitions(-DVERBOSE_PREPROCESSOR)
endif(CMAKE_VERBOSE_PREPROCESSOR)
# STD_make_unique_NOT_SUPPORTED
if(CMAKE_STD_make_unique_NOT_SUPPORTED)
add_definitions(-DSTD_make_unique_NOT_SUPPORTED)
endif(CMAKE_STD_make_unique_NOT_SUPPORTED)
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)

View File

@ -34,10 +34,6 @@
* - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* - STD_TO_STRING_NOT_SUPPORTED (MinGW with GCC < 4.8)
* - VERBOSE_PREPROCESSOR, STOP_VERBOSE_PREPROCESSOR
* - STD_make_unique_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* or __cpp_lib_make_unique
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0096r0.html#detail.cpp14.n3656
*/
#ifndef NANA_CXX_DEFINES_INCLUDED
@ -172,13 +168,4 @@
#endif
#endif
#if !defined(VERBOSE_PREPROCESSOR)
//#define VERBOSE_PREPROCESSOR
#endif
#if !defined(STOP_VERBOSE_PREPROCESSOR)
#define STOP_VERBOSE_PREPROCESSOR
#endif
#endif // NANA_CXX_DEFINES_INCLUDED

View File

@ -14,6 +14,9 @@
* External libraries:
* - NANA_LIBPNG, USE_LIBPNG_FROM_OS
* - NANA_LIBJPEG, USE_LIBJPEG_FROM_OS
*
* messages:
* - VERBOSE_PREPROCESSOR, STOP_VERBOSE_PREPROCESSOR
*/
#ifndef NANA_CONFIG_HPP
@ -21,6 +24,10 @@
#include "c++defines.hpp"
//The basic configurations are ignored when NANA_IGNORE_CONF is defined.
//The NANA_IGNORE_CONF may be specified by CMake generated makefile.
#ifndef NANA_IGNORE_CONF
// Here defines some flags that tell Nana what features will be supported.
@ -60,5 +67,13 @@
#endif
#endif
#if !defined(VERBOSE_PREPROCESSOR)
//#define VERBOSE_PREPROCESSOR
#endif
#if !defined(STOP_VERBOSE_PREPROCESSOR)
#define STOP_VERBOSE_PREPROCESSOR
#endif
#endif // NANA_IGNORE_CONFIG
#endif // NANA_CONFIG_HPP