Merge branch 'master' into develop
This commit is contained in:
commit
e195ae8469
2
.gitignore
vendored
2
.gitignore
vendored
@ -41,4 +41,4 @@ CMakeFiles/
|
||||
.idea/
|
||||
cmake_install.cmake
|
||||
*.DS_Store
|
||||
.idea/
|
||||
|
||||
|
35
.travis.yml
35
.travis.yml
@ -14,26 +14,48 @@ matrix:
|
||||
packages:
|
||||
- g++-5
|
||||
- libjpeg8-dev
|
||||
- libpng-dev
|
||||
- libasound2-dev
|
||||
- alsa-utils
|
||||
- alsa-oss
|
||||
sources: &sources
|
||||
- libx11-dev
|
||||
- libxft-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise
|
||||
- llvm-toolchain-precise-3.7
|
||||
- llvm-toolchain-precise-3.6
|
||||
- env: CXX=g++-4.9 CC=gcc-4.9
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
- libjpeg8-dev
|
||||
- libpng-dev
|
||||
- libasound2-dev
|
||||
- alsa-utils
|
||||
- alsa-oss
|
||||
sources: *sources
|
||||
- libx11-dev
|
||||
- libxft-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
allow_failures:
|
||||
- env: CXX=clang++-3.8 CC=clang-3.8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
- libjpeg8-dev
|
||||
- libpng-dev
|
||||
- libasound2-dev
|
||||
- alsa-utils
|
||||
- alsa-oss
|
||||
- libx11-dev
|
||||
- libxft-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise
|
||||
|
||||
before_install:
|
||||
- git clone --depth=50 --branch=master https://github.com/qPCR4vir/nana-demo.git nana-demo
|
||||
- export PATH="$HOME/bin:$PATH"
|
||||
- mkdir ~/bin
|
||||
- wget --no-check-certificate --no-clobber -O /tmp/tools/cmake https://cmake.org/files/v3.4/cmake-3.4.0-rc3-Linux-x86_64.sh || true
|
||||
@ -47,5 +69,6 @@ before_script :
|
||||
- cd bld
|
||||
|
||||
script:
|
||||
- cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON
|
||||
- cmake -G"Unix Makefiles" .. -DENABLE_JPEG=ON -DENABLE_PNG=OFF -DBUILD_NANA_DEMOS=ON -DENABLE_AUDIO=OFF
|
||||
|
||||
- make
|
||||
|
256
CMakeLists.txt
256
CMakeLists.txt
@ -18,21 +18,36 @@ 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 <nana/filesystem/filesystem_selector.hpp>
|
||||
# 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 <boost/filesystem.hpp>?" "../")
|
||||
option(CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs")
|
||||
|
||||
# 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")
|
||||
set(NANA_LINKS)
|
||||
|
||||
# move this to the end ??
|
||||
if(BIICODE)
|
||||
# prepare BII_LIB_SRC
|
||||
set(LIB_SRC ${BII_LIB_SRC})
|
||||
|
||||
add_biicode_targets()
|
||||
|
||||
return()
|
||||
endif(BIICODE)
|
||||
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)
|
||||
@ -47,8 +62,8 @@ add_definitions(-DNANA_IGNORE_CONF)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DWIN32)
|
||||
|
||||
#Global MSVC definitions
|
||||
set(BUILD_FreeMe ON) #"Build FreeMe only on Windows."
|
||||
#Global MSVC definitions. You may prefer the hand-tuned sln and projects from the nana repository.
|
||||
if(MSVC)
|
||||
option(WIN32_USE_MP "Set to ON to build nana with the /MP option (Visual Studio 2005 and above)." ON)
|
||||
# ??
|
||||
@ -62,28 +77,36 @@ if(WIN32)
|
||||
add_definitions(-DNANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
|
||||
endif(ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
|
||||
endif(MINGW)
|
||||
elseif(WIN32)
|
||||
set(BUILD_FreeMe OFF)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
add_definitions(-DAPPLE)
|
||||
include_directories(/opt/X11/include/)
|
||||
list(APPEND NANA_LINKS -L/opt/X11/lib/ -liconv)
|
||||
set(ENABLE_AUDIO OFF)
|
||||
elseif(UNIX)
|
||||
add_definitions(-Dlinux)
|
||||
message("added -D linux")
|
||||
endif(APPLE)
|
||||
|
||||
|
||||
|
||||
if(UNIX)
|
||||
list(APPEND NANA_LINKS -lX11 )
|
||||
find_package(Freetype)
|
||||
if (FREETYPE_FOUND)
|
||||
include_directories( ${FREETYPE_INCLUDE_DIRS})
|
||||
list(APPEND NANA_LINKS -lXft )
|
||||
endif(FREETYPE_FOUND)
|
||||
endif(UNIX)
|
||||
|
||||
#Find PNG
|
||||
if(ENABLE_PNG)
|
||||
add_definitions(-DNANA_ENABLE_PNG)
|
||||
#set(NANA_PNG_LIB "png")
|
||||
list(APPEND NANA_LINKS -lpng )
|
||||
if(LIBPNG_FROM_OS)
|
||||
find_package(PNG)
|
||||
if (PNG_FOUND)
|
||||
@ -96,6 +119,8 @@ endif(ENABLE_PNG)
|
||||
#Find JPEG
|
||||
if(ENABLE_JPEG)
|
||||
add_definitions(-DNANA_ENABLE_JPEG)
|
||||
#set(NANA_JPEG_LIB "jpeg")
|
||||
list(APPEND NANA_LINKS -ljpeg )
|
||||
if(LIBJPEG_FROM_OS)
|
||||
find_package(JPEG)
|
||||
if (JPEG_FOUND)
|
||||
@ -108,9 +133,10 @@ endif(ENABLE_JPEG)
|
||||
if(ENABLE_AUDIO)
|
||||
add_definitions(-DNANA_ENABLE_AUDIO)
|
||||
if(UNIX)
|
||||
find_package(asound)
|
||||
find_package(ASOUND)
|
||||
if (ASOUND_FOUND)
|
||||
include_directories( ${ASOUND_INCLUDE_DIRS})
|
||||
list(APPEND NANA_LINKS -lasound )
|
||||
else(ASOUND_FOUND)
|
||||
message(FATAL_ERROR "libasound is not found")
|
||||
endif(ASOUND_FOUND)
|
||||
@ -130,10 +156,6 @@ 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)
|
||||
if(NOT APPLE)
|
||||
aux_source_directory(${NANA_SOURCE_DIR}/audio NANA_AUDIO_SOURCE)
|
||||
aux_source_directory(${NANA_SOURCE_DIR}/audio/detail NANA_AUDIO_DETAIL_SOURCE)
|
||||
endif()
|
||||
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)
|
||||
@ -142,11 +164,14 @@ 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(ENABLE_AUDIO)
|
||||
aux_source_directory(${NANA_SOURCE_DIR}/audio NANA_AUDIO_SOURCE)
|
||||
aux_source_directory(${NANA_SOURCE_DIR}/audio/detail NANA_AUDIO_DETAIL_SOURCE)
|
||||
endif()
|
||||
|
||||
#To show .h files in Visual Studio, add them to the list of sources in add_executable / add_library
|
||||
#and Use SOURCE_GROUP if all your sources are in the same directory
|
||||
|
||||
if(NOT APPLE)
|
||||
add_library(${PROJECT_NAME} ${NANA_SOURCE}
|
||||
${NANA_DETAIL_SOURCE}
|
||||
${NANA_FILESYSTEM_SOURCE}
|
||||
@ -160,28 +185,11 @@ add_library(${PROJECT_NAME} ${NANA_SOURCE}
|
||||
${NANA_PAINT_DETAIL_SOURCE}
|
||||
${NANA_SYSTEM_SOURCE}
|
||||
${NANA_THREADS_SOURCE})
|
||||
endif (NOT APPLE)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
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})
|
||||
#Headers: use INCLUDE_DIRECTORIES
|
||||
# Libraries: use FIND_LIBRARY and link with the result of it (try to avoid LINK_DIRECTORIES
|
||||
target_link_libraries(${PROJECT_NAME} -L/opt/X11/lib/ -lX11 -lXft -lpng -liconv)
|
||||
target_link_libraries(${PROJECT_NAME} ${NANA_LINKS})
|
||||
|
||||
endif(APPLE)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
ARCHIVE DESTINATION lib
|
||||
@ -191,28 +199,29 @@ install(DIRECTORY ${NANA_INCLUDE_DIR}/nana DESTINATION include)
|
||||
|
||||
set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 )
|
||||
|
||||
|
||||
# TODO: move this nana-demo section to the nana demo repository, and here only include that cmake file
|
||||
|
||||
if (BUILD_NANA_DEMOS)
|
||||
set (CMAKE_INSTALL_PREFIX ${DEMO_BIN})
|
||||
set(DEMO_BIN ${NANA_SOURCE_DIR}../nana-demo/bin)
|
||||
set(CMAKE_INSTALL_PREFIX )
|
||||
add_executable(file_explorer ../nana-demo/file_explorer.cpp)
|
||||
set_property( TARGET file_explorer PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(file_explorer ${PROJECT_NAME})
|
||||
install(TARGETS file_explorer RUNTIME DESTINATION &{DEMO_BIN})
|
||||
|
||||
|
||||
add_executable(calculator ../nana-demo/calculator.cpp)
|
||||
set_property( TARGET calculator PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(calculator ${PROJECT_NAME})
|
||||
target_link_libraries(calculator ${PROJECT_NAME} )
|
||||
install(TARGETS calculator RUNTIME DESTINATION &{DEMO_BIN})
|
||||
|
||||
add_executable(FreeMe ../nana-demo/FreeMe.cpp)
|
||||
set_property( TARGET FreeMe PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(FreeMe ${PROJECT_NAME})
|
||||
install(TARGETS FreeMe RUNTIME DESTINATION &{DEMO_BIN})
|
||||
if (BUILD_FreeMe)
|
||||
add_executable(FreeMe ../nana-demo/FreeMe.cpp)
|
||||
set_property( TARGET FreeMe PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(FreeMe ${PROJECT_NAME} )
|
||||
install(TARGETS FreeMe RUNTIME DESTINATION &{DEMO_BIN})
|
||||
endif (BUILD_FreeMe)
|
||||
|
||||
add_executable(notepad ../nana-demo/notepad.cpp)
|
||||
set_property( TARGET notepad PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(notepad ${PROJECT_NAME})
|
||||
target_link_libraries(notepad ${PROJECT_NAME} )
|
||||
install(TARGETS notepad RUNTIME DESTINATION &{DEMO_BIN})
|
||||
|
||||
add_executable(widget_show ../nana-demo/widget_show.cpp)
|
||||
@ -225,6 +234,17 @@ if (BUILD_NANA_DEMOS)
|
||||
target_link_libraries(widget_show2 ${PROJECT_NAME})
|
||||
install(TARGETS widget_show2 RUNTIME DESTINATION &{DEMO_BIN})
|
||||
|
||||
if (OFF) # temporal: we need to adapt the use of filesystem to nana v1.03 (no file iterator)
|
||||
|
||||
add_executable(file_explorer ../nana-demo/file_explorer.cpp)
|
||||
set_property( TARGET file_explorer PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(file_explorer ${PROJECT_NAME} )
|
||||
install(TARGETS file_explorer RUNTIME DESTINATION &{DEMO_BIN})
|
||||
|
||||
|
||||
|
||||
endif(OFF)
|
||||
|
||||
add_executable(a_group_impl ../nana-demo/Examples/a_group_impl.cpp)
|
||||
set_property( TARGET a_group_impl PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(a_group_impl ${PROJECT_NAME})
|
||||
@ -233,15 +253,105 @@ if (BUILD_NANA_DEMOS)
|
||||
set_property( TARGET animate-bmp PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(animate-bmp ${PROJECT_NAME})
|
||||
|
||||
add_executable(audio_player ../nana-demo/Examples/audio_player.cpp)
|
||||
set_property( TARGET audio_player PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(audio_player ${PROJECT_NAME})
|
||||
add_executable(background-effects ../nana-demo/Examples/background-effects.cpp)
|
||||
set_property( TARGET background-effects PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(background-effects ${PROJECT_NAME})
|
||||
|
||||
add_executable(categ ../nana-demo/Examples/categ.cpp)
|
||||
set_property( TARGET categ PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(categ ${PROJECT_NAME})
|
||||
|
||||
#add_executable(nana_test test.cpp)
|
||||
#set_property( TARGET nana_test PROPERTY CXX_STANDARD 14 )
|
||||
#target_link_libraries(nana_test ${PROJECT_NAME})
|
||||
add_executable(clicked ../nana-demo/Examples/clicked.cpp)
|
||||
set_property( TARGET clicked PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(clicked ${PROJECT_NAME})
|
||||
|
||||
add_executable(decore ../nana-demo/Examples/decore.cpp)
|
||||
set_property( TARGET decore PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(decore ${PROJECT_NAME})
|
||||
|
||||
add_executable(dock ../nana-demo/Examples/dock.cpp)
|
||||
set_property( TARGET dock PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(dock ${PROJECT_NAME})
|
||||
|
||||
add_executable(drag-button ../nana-demo/Examples/drag-button.cpp)
|
||||
set_property( TARGET drag-button PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(drag-button ${PROJECT_NAME})
|
||||
|
||||
add_executable(draw ../nana-demo/Examples/draw.cpp)
|
||||
set_property( TARGET draw PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(draw ${PROJECT_NAME})
|
||||
|
||||
add_executable(example_combox ../nana-demo/Examples/example_combox.cpp)
|
||||
set_property( TARGET example_combox PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(example_combox ${PROJECT_NAME})
|
||||
|
||||
add_executable(example_listbox ../nana-demo/Examples/example_listbox.cpp)
|
||||
set_property( TARGET example_listbox PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(example_listbox ${PROJECT_NAME})
|
||||
|
||||
add_executable(example_menu ../nana-demo/Examples/example_menu.cpp)
|
||||
set_property( TARGET example_menu PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(example_menu ${PROJECT_NAME})
|
||||
|
||||
add_executable(filebox-txt ../nana-demo/Examples/filebox-txt.cpp)
|
||||
set_property( TARGET filebox-txt PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(filebox-txt ${PROJECT_NAME})
|
||||
|
||||
add_executable(folder_tree ../nana-demo/Examples/folder_tree.cpp)
|
||||
set_property( TARGET folder_tree PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(folder_tree ${PROJECT_NAME})
|
||||
|
||||
add_executable(folder_tree_nana ../nana-demo/Examples/folder_tree_nana.cpp)
|
||||
set_property( TARGET folder_tree_nana PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(folder_tree_nana ${PROJECT_NAME})
|
||||
|
||||
add_executable(folder_tree_std ../nana-demo/Examples/folder_tree_std.cpp)
|
||||
set_property( TARGET folder_tree_std PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(folder_tree_std ${PROJECT_NAME})
|
||||
|
||||
add_executable(listbox_Resolver ../nana-demo/Examples/listbox_Resolver.cpp)
|
||||
set_property( TARGET listbox_Resolver PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(listbox_Resolver ${PROJECT_NAME})
|
||||
|
||||
add_executable(framework_design_2 ../nana-demo/Examples/framework_design_2.cpp)
|
||||
set_property( TARGET framework_design_2 PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(framework_design_2 ${PROJECT_NAME})
|
||||
|
||||
add_executable(framework_design_3 ../nana-demo/Examples/framework_design_3.cpp)
|
||||
set_property( TARGET framework_design_3 PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(framework_design_3 ${PROJECT_NAME})
|
||||
|
||||
add_executable(group ../nana-demo/Examples/group.cpp)
|
||||
set_property( TARGET group PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(group ${PROJECT_NAME})
|
||||
|
||||
add_executable(HelloWord ../nana-demo/Examples/HelloWord.cpp)
|
||||
set_property( TARGET HelloWord PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(HelloWord ${PROJECT_NAME})
|
||||
|
||||
add_executable(listbox_inline_widget ../nana-demo/Examples/listbox_inline_widget.cpp)
|
||||
set_property( TARGET listbox_inline_widget PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(listbox_inline_widget ${PROJECT_NAME})
|
||||
|
||||
add_executable(inputbox ../nana-demo/Examples/inputbox.cpp)
|
||||
set_property( TARGET inputbox PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(inputbox ${PROJECT_NAME})
|
||||
|
||||
add_executable(label_listener ../nana-demo/Examples/label_listener.cpp)
|
||||
set_property( TARGET label_listener PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(label_listener ${PROJECT_NAME})
|
||||
|
||||
add_executable(lambda_event.Cpp11 ../nana-demo/Examples/lambda_event.Cpp11.cpp)
|
||||
set_property( TARGET lambda_event.Cpp11 PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(lambda_event.Cpp11 ${PROJECT_NAME})
|
||||
|
||||
if (ENABLE_AUDIO)
|
||||
add_executable(audio_player ../nana-demo/Examples/audio_player.cpp)
|
||||
set_property( TARGET audio_player PROPERTY CXX_STANDARD 14 )
|
||||
target_link_libraries(audio_player ${PROJECT_NAME} )
|
||||
endif(ENABLE_AUDIO)
|
||||
|
||||
# TODO: make it automatic to select each demo and example and build each.
|
||||
#set(NANA_DEMOS_DIR ${CMAKE_SOURCE_DIR}/../nana-demo)
|
||||
#set(NANA_EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/../Examples/nana-demo/)
|
||||
# https://cmake.org/cmake/help/v3.3/command/file.html?highlight=glob#file
|
||||
@ -251,7 +361,37 @@ if (BUILD_NANA_DEMOS)
|
||||
# string( REPLACE ".cpp" "" demoname ${demofile} )
|
||||
# add_executable( ${demoname} ${demofile} )
|
||||
# set_property( TARGET ${demoname} PROPERTY CXX_STANDARD 14 )
|
||||
# target_link_libraries(${demoname} ${PROJECT_NAME})
|
||||
# target_link_libraries(${demoname} ${PROJECT_NAME} )# X11 Xft ${NANA_JPEG_LIB} ${NANA_PNG_LIB})
|
||||
#endforeach( demofile ${DEMO_SOURCES} )
|
||||
|
||||
endif(BUILD_NANA_DEMOS)
|
||||
|
||||
|
||||
# set compile flags
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall")
|
||||
else("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall")
|
||||
endif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
|
||||
# enable static linkage
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND NOT MINGW)
|
||||
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -pthread")
|
||||
|
||||
endif ()
|
||||
|
||||
if (APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libstdc++")
|
||||
endif ()
|
||||
|
||||
message ( "CMAKE_CXX_COMPILER_ID = " ${CMAKE_CXX_COMPILER_ID})
|
||||
message ( "COMPILER_IS_CLANG = " ${COMPILER_IS_CLANG})
|
||||
message ( "CMAKE_CXX_FLAGS = " ${CMAKE_CXX_FLAGS})
|
||||
message ( "CMAKE_COMPILER_IS_GNUCXX= " ${CMAKE_COMPILER_IS_GNUCXX})
|
||||
message ( "CMAKE_EXE_LINKER_FLAGS = " ${CMAKE_EXE_LINKER_FLAGS})
|
||||
message ( "NANA_LINKS = " ${NANA_LINKS})
|
||||
message ( "ENABLE_AUDIO = " ${ENABLE_AUDIO})
|
||||
|
22
README.md
22
README.md
@ -1,4 +1,9 @@
|
||||
# Nana C++ Library [](https://www.biicode.com/qiangwu/nana) [](https://travis-ci.org/cnjinhao/nana) [](LICENSE_1_0.txt)
|
||||
# Nana C++ Library
|
||||
[Linux (gcc 5, including demos) ](https://travis-ci.org/cnjinhao/nana)
|
||||
|
||||
[Windows (VC2015) ](https://ci.appveyor.com/project/qPCR4vir/nana)
|
||||
|
||||
[](LICENSE_1_0.txt)
|
||||
|
||||
|
||||
Nana is a C++ library designed to allow developers to easily create cross-platform GUI applications with modern C++11 style, currently it can work on Linux(X11) and Windows. The nana repository contains the entire source of library, you can browse the source code and submit your pull request for contributing.
|
||||
@ -7,20 +12,11 @@ Nana is a C++ library designed to allow developers to easily create cross-platfo
|
||||
|
||||
Nana is licensed under the [Boost Software License](http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
## Biicode
|
||||
Nana is available in biicode, download biicode and try the nana example:
|
||||
## Members
|
||||
|
||||
```
|
||||
> mkdir try-nana
|
||||
> cd try-nana
|
||||
> bii init
|
||||
> bii open qiangwu/nana-example
|
||||
> bii find
|
||||
> bii build
|
||||
> cd bin
|
||||
```
|
||||
Jinhao, [Ariel Viña Rodríguez].
|
||||
|
||||
Run it! All dependencies will be resovled automatically by biicode! Amazing, isn't it?
|
||||
[Ariel Viña Rodríguez]: http://qpcr4vir.github.io/
|
||||
|
||||
## Support
|
||||
|
||||
|
4
appveyor.yml
Normal file
4
appveyor.yml
Normal file
@ -0,0 +1,4 @@
|
||||
version: 1.0.{build}
|
||||
build:
|
||||
project: build\vc2015\nana.sln
|
||||
verbosity: minimal
|
@ -38,9 +38,10 @@
|
||||
|
||||
#ifndef NANA_CXX_DEFINES_INCLUDED
|
||||
#define NANA_CXX_DEFINES_INCLUDED
|
||||
|
||||
#define STD_FILESYSTEM_NOT_SUPPORTED
|
||||
//C++ language
|
||||
#if defined(_MSC_VER)
|
||||
# undef STD_FILESYSTEM_NOT_SUPPORTED
|
||||
# if (_MSC_VER < 1900)
|
||||
# //Nana defines some macros for lack of support of keywords
|
||||
# define _ALLOW_KEYWORD_MACROS
|
||||
@ -130,6 +131,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3 ) ) )
|
||||
#undef STD_FILESYSTEM_NOT_SUPPORTED
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ == 4)
|
||||
#if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1))
|
||||
#define STD_THREAD_NOT_SUPPORTED
|
||||
@ -168,4 +173,17 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0061r0.html
|
||||
|
||||
# if __cpp_lib_experimental_filesystem
|
||||
# undef STD_FILESYSTEM_NOT_SUPPORTED
|
||||
# endif
|
||||
|
||||
|
||||
#ifdef __has_include
|
||||
# if __has_include(<filesystem>)
|
||||
# undef STD_FILESYSTEM_NOT_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // NANA_CXX_DEFINES_INCLUDED
|
||||
|
@ -14,6 +14,7 @@
|
||||
* External libraries:
|
||||
* - NANA_LIBPNG, USE_LIBPNG_FROM_OS
|
||||
* - NANA_LIBJPEG, USE_LIBJPEG_FROM_OS
|
||||
* - NANA_ENABLE_AUDIO
|
||||
*
|
||||
* messages:
|
||||
* - VERBOSE_PREPROCESSOR, STOP_VERBOSE_PREPROCESSOR
|
||||
@ -30,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
|
||||
|
||||
///////////////////
|
||||
//Support of PCM playback
|
||||
//
|
||||
//#define NANA_ENABLE_AUDIO
|
||||
////////////////////////////
|
||||
// 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 <nana/filesystem/filesystem_selector.hpp>
|
||||
// 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 for PNG
|
||||
// Define the NANA_ENABLE_PNG to enable the support of PNG.
|
||||
// Support of PCM playback
|
||||
//
|
||||
#define NANA_ENABLE_AUDIO
|
||||
|
||||
///////////////////
|
||||
// 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.
|
||||
@ -56,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.
|
||||
|
@ -36,12 +36,13 @@
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
|
||||
#include <nana/deploy.hpp>
|
||||
|
||||
// namespace std { namespace experimental { namespace filesystem { inline namespace v1 {
|
||||
|
||||
namespace nana { namespace experimental
|
||||
namespace nana { namespace experimental { inline namespace v1
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
@ -149,6 +150,14 @@ namespace filesystem
|
||||
std::string string() const;
|
||||
std::wstring wstring() const;
|
||||
std::string u8string() const;
|
||||
// std::u16string u16string() const;
|
||||
// std::u32string u32string() const;
|
||||
|
||||
std::string generic_string() const ;
|
||||
std::wstring generic_wstring() const;
|
||||
std::string generic_u8string() const;
|
||||
// std::u16string generic_u16string() const;
|
||||
// std::u32string generic_u32string() const;
|
||||
|
||||
//appends
|
||||
path& operator/=(const path& other);
|
||||
@ -359,11 +368,11 @@ namespace filesystem
|
||||
return index ? path.substr(0, index + 1) : std::basic_string<CharType>();
|
||||
}
|
||||
|
||||
|
||||
}//end namespace filesystem
|
||||
} //end namespace v1
|
||||
} //end namespace filesystem
|
||||
} //end namespace experimental
|
||||
|
||||
namespace filesystem = experimental::filesystem;
|
||||
}//end namespace nana
|
||||
//namespace filesystem = experimental::filesystem;
|
||||
} //end namespace nana
|
||||
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <nana/gui/place.hpp>
|
||||
#include <nana/gui/widgets/panel.hpp>
|
||||
#include <nana/gui/widgets/checkbox.hpp>
|
||||
|
||||
namespace nana{
|
||||
class group
|
||||
@ -49,7 +50,7 @@ namespace nana{
|
||||
~group();
|
||||
|
||||
/// Adds an option for user selection
|
||||
group& add_option(::std::string);
|
||||
checkbox& add_option(::std::string);
|
||||
|
||||
/// Enables/disables the radio mode which is single selection
|
||||
group& radio_mode(bool);
|
||||
|
@ -261,17 +261,18 @@ namespace nana
|
||||
return this->get_drawer_trigger().length();
|
||||
}
|
||||
|
||||
tabbar& append(std::string text, window attach_wd, value_type value = {})
|
||||
/// Append a new tab
|
||||
tabbar& append(std::string text, window attach_wd, value_type value = {}) // 2x text convertion. maybe better to duplicate code?
|
||||
{
|
||||
return this->append(static_cast<std::wstring>(nana::charset(text, nana::unicode::utf8)), attach_wd);
|
||||
return this->append( static_cast<std::wstring&&>(nana::charset(std::move(text), nana::unicode::utf8)), attach_wd, std::move(value));
|
||||
}
|
||||
|
||||
tabbar& append(std::wstring text, window attach_wd, value_type value = {})
|
||||
{
|
||||
if (attach_wd && API::empty_window(attach_wd))
|
||||
throw std::invalid_argument("tabbar.attach: invalid window handle");
|
||||
throw std::invalid_argument("Appening a tab to a tabbar - error: tabbar.attach: invalid window handle");
|
||||
|
||||
this->get_drawer_trigger().insert(::nana::npos, std::move(text), std::move(value));
|
||||
this->get_drawer_trigger().insert(::nana::npos, to_nstring(std::move(text)), std::move(value));
|
||||
if (attach_wd)
|
||||
this->attach(this->get_drawer_trigger().length() - 1, attach_wd);
|
||||
|
||||
@ -299,7 +300,7 @@ namespace nana
|
||||
if (pos > length())
|
||||
throw std::out_of_range("tabbar::insert invalid position");
|
||||
|
||||
this->get_drawer_trigger().insert(pos, to_nstring(text), std::move(value));
|
||||
this->get_drawer_trigger().insert(pos, to_nstring(std::move(text)), std::move(value));
|
||||
API::update_window(*this);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
|
||||
namespace nana { namespace experimental {
|
||||
inline namespace v1 {
|
||||
namespace filesystem
|
||||
{
|
||||
//class filesystem_error
|
||||
@ -249,7 +250,24 @@ namespace nana { namespace experimental {
|
||||
{
|
||||
return to_utf8(pathstr_);
|
||||
}
|
||||
|
||||
std::string path::generic_string() const
|
||||
{
|
||||
auto str = string();
|
||||
std::replace(str.begin(), str.end(), '\\', '/');
|
||||
return str;
|
||||
}
|
||||
std::wstring path::generic_wstring() const
|
||||
{
|
||||
auto str = wstring();
|
||||
std::replace(str.begin(), str.end(), L'\\', L'/');
|
||||
return str;
|
||||
}
|
||||
std::string path::generic_u8string() const // uppss ...
|
||||
{
|
||||
auto str = pathstr_;
|
||||
std::replace(str.begin(), str.end(), '\\', '/'); // uppss ... revise this !!!!!
|
||||
return to_utf8(str);
|
||||
}
|
||||
path & path::operator/=(const path& p)
|
||||
{
|
||||
if (p.empty())
|
||||
@ -634,7 +652,7 @@ namespace nana { namespace experimental {
|
||||
auto stat = status(p, err);
|
||||
|
||||
if (err != std::error_code())
|
||||
throw filesystem_error("nana::filesystem::status", p, err);
|
||||
throw filesystem_error("nana::experimental::filesystem::status", p, err);
|
||||
|
||||
return stat;
|
||||
}
|
||||
@ -852,6 +870,7 @@ namespace nana { namespace experimental {
|
||||
::chdir(p.c_str());
|
||||
#endif
|
||||
}
|
||||
} //end namespace v1
|
||||
}//end namespace filesystem
|
||||
} //end namespace experimental
|
||||
}//end namespace nana
|
||||
|
@ -142,7 +142,7 @@ namespace nana
|
||||
auto path = path_.caption();
|
||||
auto root = path.substr(0, path.find('/'));
|
||||
if(root == "HOME")
|
||||
path.replace(0, 4, nana::filesystem::path_user().native());
|
||||
path.replace(0, 4, nana::experimental::filesystem::path_user().native());
|
||||
else if(root == "FILESYSTEM")
|
||||
path.erase(0, 10);
|
||||
else
|
||||
@ -344,7 +344,7 @@ namespace nana
|
||||
else
|
||||
dir = saved_selected_path;
|
||||
|
||||
_m_load_cat_path(dir.size() ? dir : nana::filesystem::path_user().native());
|
||||
_m_load_cat_path(dir.size() ? dir : nana::experimental::filesystem::path_user().native());
|
||||
|
||||
tb_file_.caption(file_with_path_removed);
|
||||
}
|
||||
@ -474,7 +474,7 @@ namespace nana
|
||||
{
|
||||
auto begstr = path.substr(0, pos);
|
||||
if(begstr == "FS.HOME")
|
||||
path.replace(0, 7, nana::filesystem::path_user().native());
|
||||
path.replace(0, 7, nana::experimental::filesystem::path_user().native());
|
||||
else
|
||||
path.erase(0, pos);
|
||||
return begstr;
|
||||
@ -508,13 +508,13 @@ namespace nana
|
||||
{
|
||||
m.bytes = fs::file_size(path + m.name);
|
||||
m.directory = fs::is_directory(fattr);
|
||||
::nana::filesystem::modified_file_time(path + m.name, m.modified_time);
|
||||
::nana::experimental::filesystem::modified_file_time(path + m.name, m.modified_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.bytes = 0;
|
||||
m.directory = fs::is_directory(*i);
|
||||
::nana::filesystem::modified_file_time(path + i->path().filename().native(), m.modified_time);
|
||||
::nana::experimental::filesystem::modified_file_time(path + i->path().filename().native(), m.modified_time);
|
||||
}
|
||||
|
||||
file_container_.push_back(m);
|
||||
@ -534,7 +534,7 @@ namespace nana
|
||||
while(!beg_node.empty() && (beg_node != nodes_.home) && (beg_node != nodes_.filesystem))
|
||||
beg_node = beg_node.owner();
|
||||
|
||||
auto head = nana::filesystem::path_user().native();
|
||||
auto head = nana::experimental::filesystem::path_user().native();
|
||||
if(path.size() >= head.size() && (path.substr(0, head.size()) == head))
|
||||
{//This is HOME
|
||||
path_.caption("HOME");
|
||||
|
@ -103,7 +103,7 @@ namespace nana{
|
||||
delete impl_->radio_logic;
|
||||
}
|
||||
|
||||
group& group::add_option(std::string text)
|
||||
checkbox& group::add_option(std::string text)
|
||||
{
|
||||
_THROW_IF_EMPTY()
|
||||
|
||||
@ -118,7 +118,7 @@ namespace nana{
|
||||
if (impl_->radio_logic)
|
||||
impl_->radio_logic->add(*opt);
|
||||
|
||||
return *this;
|
||||
return *impl_->options.back();
|
||||
}
|
||||
|
||||
group& group::radio_mode(bool enable)
|
||||
|
Loading…
x
Reference in New Issue
Block a user