fix mingw compilation error

This commit is contained in:
qqiangwu
2015-04-05 22:07:57 +08:00
parent e3a82e99c0
commit 86d675fa85
11 changed files with 174 additions and 69 deletions

View File

@@ -2,10 +2,22 @@
# Author: Andrew Kornilov(https://github.com/ierofant)
# Contributor:
# Robert Hauck - Enable support for PNG/Freetype
# Qiangqiang Wu - Add biicode support
project(nana)
cmake_minimum_required(VERSION 2.8)
if(NOT BIICODE)
project(nana)
cmake_minimum_required(VERSION 2.8)
else()
set(LIB_SRC ${BII_LIB_SRC})
foreach(cpp ${BII_LIB_SRC})
if(${cpp} MATCHES "(include/nana|source)/detail/[A-Za-z0-9_]+/.+$")
list(APPEND trash_files ${cpp})
endif()
endforeach()
list(REMOVE_ITEM BII_LIB_SRC ${trash_files})
endif()
#Select platform automatically
if(WIN32)
@@ -21,12 +33,21 @@ if(WIN32)
add_definitions(-DSTD_THREAD_NOT_SUPPORTED)
endif()
endif()
if(BIICODE)
file(GLOB_RECURSE platform_files "*/detail/win32/*")
list(APPEND BII_LIB_SRC ${platform_files})
endif()
endif()
if(UNIX)
add_definitions(-DNANA_LINUX)
add_definitions(-DNANA_X11)
add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/linux_X11/platform_spec.hpp>)
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
if(BIICODE)
file(GLOB_RECURSE platform_files "*/detail/linux_X11/*")
list(APPEND BII_LIB_SRC ${platform_files})
endif()
endif()
@@ -55,73 +76,77 @@ if(NANA_UNICODE)
endif()
#Find PNG
if(UNIX)
find_package(Freetype)
if (FREETYPE_FOUND)
include_directories( ${FREETYPE_INCLUDE_DIRS})
endif()
if(NOT BIICODE)
#Find PNG
if(UNIX)
find_package(Freetype)
if (FREETYPE_FOUND)
include_directories( ${FREETYPE_INCLUDE_DIRS})
endif()
endif()
option(NANA_ENABLE_PNG "Enable the use of PNG" ON)
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()
find_package(PNG)
if (PNG_FOUND)
include_directories( ${PNG_INCLUDE_DIRS})
endif()
endif()
endif()
else()
add_definitions(-DNANA_LIBPNG)
add_definitions(-DNANA_ENABLE_PNG)
endif()
option(NANA_ENABLE_PNG "Enable the use of PNG" ON)
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()
find_package(PNG)
if (PNG_FOUND)
include_directories( ${PNG_INCLUDE_DIRS})
endif()
endif()
endif()
#Copy our new config.hpp (with removed defines)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/build/cmake/config.hpp ${CMAKE_SOURCE_DIR}/include/nana/)
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
endif(CMAKE_COMPILER_IS_GNUCXX)
include_directories(${NANA_INCLUDE_DIR})
aux_source_directory(${NANA_SOURCE_DIR} NANA_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/detail NANA_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/filesystem NANA_FILESYSTEM_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/audio NANA_AUDIO_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/audio/detail NANA_AUDIO_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui NANA_GUI_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui/detail NANA_GUI_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui/widgets NANA_GUI_WIDGETS_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui/widgets/skeletons NANA_GUI_WIDGETS_SKELETONS_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/paint NANA_PAINT_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/paint/detail NANA_PAINT_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/system NANA_SYSTEM_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/threads NANA_THREADS_SOURCE)
if(BIICODE)
add_biicode_targets()
else()
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
add_library(${PROJECT_NAME} ${NANA_SOURCE}
${NANA_DETAIL_SOURCE}
${NANA_FILESYSTEM_SOURCE}
${NANA_AUDIO_SOURCE}
${NANA_AUDIO_DETAIL_SOURCE}
${NANA_GUI_SOURCE}
${NANA_GUI_DETAIL_SOURCE}
${NANA_GUI_WIDGETS_SOURCE}
${NANA_GUI_WIDGETS_SKELETONS_SOURCE}
${NANA_PAINT_SOURCE}
${NANA_PAINT_DETAIL_SOURCE}
${NANA_SYSTEM_SOURCE}
${NANA_THREADS_SOURCE})
include_directories(${NANA_INCLUDE_DIR})
aux_source_directory(${NANA_SOURCE_DIR} NANA_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/detail NANA_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/filesystem NANA_FILESYSTEM_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/audio NANA_AUDIO_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/audio/detail NANA_AUDIO_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui NANA_GUI_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui/detail NANA_GUI_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui/widgets NANA_GUI_WIDGETS_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/gui/widgets/skeletons NANA_GUI_WIDGETS_SKELETONS_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/paint NANA_PAINT_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/paint/detail NANA_PAINT_DETAIL_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/system NANA_SYSTEM_SOURCE)
aux_source_directory(${NANA_SOURCE_DIR}/threads NANA_THREADS_SOURCE)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(DIRECTORY ${NANA_INCLUDE_DIR}/nana DESTINATION include)
add_library(${PROJECT_NAME} ${NANA_SOURCE}
${NANA_DETAIL_SOURCE}
${NANA_FILESYSTEM_SOURCE}
${NANA_AUDIO_SOURCE}
${NANA_AUDIO_DETAIL_SOURCE}
${NANA_GUI_SOURCE}
${NANA_GUI_DETAIL_SOURCE}
${NANA_GUI_WIDGETS_SOURCE}
${NANA_GUI_WIDGETS_SKELETONS_SOURCE}
${NANA_PAINT_SOURCE}
${NANA_PAINT_DETAIL_SOURCE}
${NANA_SYSTEM_SOURCE}
${NANA_THREADS_SOURCE})
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(DIRECTORY ${NANA_INCLUDE_DIR}/nana DESTINATION include)
endif()