simplify automatic project generation
This commit is contained in:
parent
3a04e10d69
commit
4b57b76ffb
@ -4,47 +4,16 @@
|
|||||||
# Robert Hauck - Enable support for PNG/Freetype
|
# Robert Hauck - Enable support for PNG/Freetype
|
||||||
# Qiangqiang Wu - Add biicode support
|
# Qiangqiang Wu - Add biicode support
|
||||||
|
|
||||||
if(BIICODE)
|
|
||||||
# prepare BII_LIB_SRC
|
|
||||||
set(LIB_SRC ${BII_LIB_SRC})
|
|
||||||
|
|
||||||
foreach(cpp ${BII_LIB_SRC})
|
|
||||||
if(${cpp} MATCHES "/detail/(win32|linux_X11)/.+$")
|
|
||||||
list(APPEND trash_files ${cpp})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
list(REMOVE_ITEM BII_LIB_SRC ${trash_files})
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
file(GLOB_RECURSE platform_files "*/detail/win32/*")
|
|
||||||
list(APPEND BII_LIB_SRC ${platform_files})
|
|
||||||
elseif(APPLE)
|
|
||||||
file(GLOB_RECURSE platform_files "*/detail/macos_X11/*")
|
|
||||||
list(APPEND BII_LIB_SRC ${platform_files})
|
|
||||||
elseif(UNIX)
|
|
||||||
file(GLOB_RECURSE platform_files "*/detail/linux_X11/*")
|
|
||||||
list(APPEND BII_LIB_SRC ${platform_files})
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Only Windows and Unix are supported for the moment (Mac OS is experimental)")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set compile flags
|
# set compile flags
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
|
||||||
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
|
|
||||||
# we'll use the default config file so we can iliminate the following macro definitions
|
|
||||||
if(MSVC)
|
if(BIICODE)
|
||||||
# More MSVC specific compilation flags
|
# prepare BII_LIB_SRC
|
||||||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
set(LIB_SRC ${BII_LIB_SRC})
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
||||||
if(MSVC14)
|
|
||||||
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
|
|
||||||
else()
|
|
||||||
add_definitions(-DNOT_IMPLEMENTED_KEYWORD_noexcept)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_biicode_targets()
|
add_biicode_targets()
|
||||||
|
|
||||||
@ -54,40 +23,16 @@ endif()
|
|||||||
project(nana)
|
project(nana)
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
#Select platform automatically
|
|
||||||
if(WIN32)
|
|
||||||
add_definitions(-DNANA_WINDOWS)
|
|
||||||
add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/win32/platform_spec.hpp>)
|
|
||||||
if(MSVC14)
|
|
||||||
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
|
|
||||||
else()
|
|
||||||
add_definitions(-DNOT_IMPLEMENTED_KEYWORD_noexcept)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#Test if it is MINGW
|
|
||||||
if(MINGW)
|
|
||||||
add_definitions(-DNANA_MINGW)
|
|
||||||
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.1")
|
|
||||||
option(NANA_THREAD_NOT_SUPPORTED "Use this flag if MinGW version is older than 4.8.1" ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(NANA_THREAD_NOT_SUPPORTED)
|
|
||||||
add_definitions(-DSTD_THREAD_NOT_SUPPORTED)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_definitions(-DNANA_MACOS)
|
add_definitions(-DNANA_MACOS)
|
||||||
add_definitions(-DNANA_X11)
|
add_definitions(-DNANA_X11)
|
||||||
add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/macos_X11/platform_spec.hpp>)
|
#add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/macos_X11/platform_spec.hpp>)
|
||||||
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
|
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
|
||||||
include_directories(/opt/X11/include/)
|
include_directories(/opt/X11/include/)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
add_definitions(-DNANA_LINUX)
|
add_definitions(-DNANA_LINUX)
|
||||||
add_definitions(-DNANA_X11)
|
add_definitions(-DNANA_X11)
|
||||||
add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/linux_X11/platform_spec.hpp>)
|
#add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/linux_X11/platform_spec.hpp>)
|
||||||
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
|
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -96,25 +41,26 @@ endif()
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
option(WIN32_USE_MP "Set to ON to build nana with the /MP option (Visual Studio 2005 and above)." ON)
|
option(WIN32_USE_MP "Set to ON to build nana with the /MP option (Visual Studio 2005 and above)." ON)
|
||||||
|
# ??
|
||||||
if(WIN32_USE_MP)
|
if(WIN32_USE_MP)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# More MSVC specific compilation flags
|
# More MSVC specific compilation flags
|
||||||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
#add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
#add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
|
||||||
#Unicode
|
#Unicode
|
||||||
option(NANA_UNICODE "Use Unicode Character Set" ON)
|
option(NANA_UNICODE "Use Unicode Character Set" ON)
|
||||||
if(NANA_UNICODE)
|
#if(NANA_UNICODE)
|
||||||
add_definitions(-DNANA_UNICODE)
|
# add_definitions(-DNANA_UNICODE)
|
||||||
if(WIN32)
|
# if(WIN32)
|
||||||
add_definitions(-DUNICODE -D_UNICODE)
|
# add_definitions(-DUNICODE -D_UNICODE)
|
||||||
endif()
|
# endif()
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
#Find PNG
|
#Find PNG
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
@ -139,15 +85,6 @@ if(NANA_ENABLE_PNG)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#Copy our new config.hpp (with removed defines)
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
|
||||||
-E copy_if_different
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.hpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include/nana/)
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
|
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
|
||||||
set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
|
set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
* This file should not be included by any header files.
|
* This file should not be included by any header files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||||
|
|
||||||
#ifndef NANA_DETAIL_PLATFORM_SPEC_HPP
|
#ifndef NANA_DETAIL_PLATFORM_SPEC_HPP
|
||||||
#define NANA_DETAIL_PLATFORM_SPEC_HPP
|
#define NANA_DETAIL_PLATFORM_SPEC_HPP
|
||||||
|
|
||||||
@ -323,5 +325,9 @@ namespace detail
|
|||||||
|
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
|
|
||||||
|
// .h ward
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
* This file provides basis class and data structrue that required by nana
|
* This file provides basis class and data structrue that required by nana
|
||||||
* This file should not be included by any header files.
|
* This file should not be included by any header files.
|
||||||
*/
|
*/
|
||||||
|
#if defined(NANA_WINDOWS)
|
||||||
|
|
||||||
#ifndef NANA_DETAIL_PLATFORM_SPEC_HPP
|
#ifndef NANA_DETAIL_PLATFORM_SPEC_HPP
|
||||||
#define NANA_DETAIL_PLATFORM_SPEC_HPP
|
#define NANA_DETAIL_PLATFORM_SPEC_HPP
|
||||||
@ -198,4 +199,9 @@ namespace detail
|
|||||||
|
|
||||||
}//end namespace detail
|
}//end namespace detail
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
|
|
||||||
|
// .h ward
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#if defined(NANA_WINDOWS)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -13,6 +13,9 @@
|
|||||||
*
|
*
|
||||||
* http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt
|
* http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||||
|
|
||||||
#include <nana/detail/platform_spec_selector.hpp>
|
#include <nana/detail/platform_spec_selector.hpp>
|
||||||
#include <X11/Xlocale.h>
|
#include <X11/Xlocale.h>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
@ -1411,3 +1414,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
}//end namespace detail
|
}//end namespace detail
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
|
|
||||||
|
|
||||||
|
//#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||||
|
#endif
|
||||||
|
|||||||
@ -11,6 +11,9 @@
|
|||||||
*
|
*
|
||||||
* This file provides basis class and data structrue that required by nana
|
* This file provides basis class and data structrue that required by nana
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(NANA_WINDOWS)
|
||||||
|
|
||||||
#include <nana/detail/platform_spec_selector.hpp>
|
#include <nana/detail/platform_spec_selector.hpp>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -289,3 +292,6 @@ namespace detail
|
|||||||
}
|
}
|
||||||
}//end namespace detail
|
}//end namespace detail
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
|
|
||||||
|
//#if defined(NANA_WINDOWS)
|
||||||
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user