From a68155c7d70c2e5d05acbd0ad30b96664d27d79f Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Mon, 27 Jun 2016 01:25:48 +0200 Subject: [PATCH] Build build demos separately. --- .travis.yml | 22 +++++++----- CMakeLists.txt | 92 ++++---------------------------------------------- 2 files changed, 19 insertions(+), 95 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4bd87dfd..262925d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,6 @@ matrix: - alsa-oss - libx11-dev - libxft-dev - - libboost-filesystem-dev sources: - ubuntu-toolchain-r-test - env: CXX=g++-4.9 CC=gcc-4.9 @@ -35,6 +34,7 @@ matrix: - alsa-oss - libx11-dev - libxft-dev + - libboost-filesystem-dev sources: - ubuntu-toolchain-r-test @@ -56,7 +56,7 @@ matrix: - llvm-toolchain-precise before_install: - - git clone --depth=1 --branch=dev_nana_fs https://github.com/qPCR4vir/nana-demo.git nana-demo + - git clone --depth=1 --branch=dev_nana_fs 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 @@ -66,12 +66,12 @@ install: - /tmp/tools/cmake --prefix="$HOME" --exclude-subdir before_script : - # travis dont have a fisical monitor. We need to instal an emulator: https://docs.travis-ci.com/user/gui-and-headless-browsers/ + # travis don't have a physical monitor. We need to install an emulator: https://docs.travis-ci.com/user/gui-and-headless-browsers/ - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - sleep 3 # give xvfb some time to start - # we have: qPCR4vir/nana/nana-demo and now we are in: qPCR4vir/nana/ our executable tests will assces: ../Examples/*.bmp etc.(need to be in parallel with nana-demo/Examples) - #- cd nana-demo + # we have: qPCR4vir/nana/../nana-demo and now we are in: qPCR4vir/nana/ our executable tests will assces: ../Examples/*.bmp etc.(need to be in parallel with nana-demo/Examples) + #- cd ../nana-demo - mkdir bin - cd bin @@ -92,11 +92,15 @@ before_script : script: - - cmake -G"Unix Makefiles" .. -DNANA_CMAKE_ENABLE_JPEG=ON -DNANA_CMAKE_ENABLE_PNG=OFF -DNANA_CMAKE_BUILD_DEMOS=ON -DNANA_CMAKE_ENABLE_AUDIO=OFF -DNANA_CMAKE_FIND_BOOST_FILESYSTEM=ON -DNANA_CMAKE_BOOST_FILESYSTEM_FORCE=OFF -DNANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS=OFF -DNANA_CMAKE_AUTOMATIC_GUI_TESTING=ON + - cmake -G"Unix Makefiles" .. -DNANA_CMAKE_ENABLE_JPEG=ON -DNANA_CMAKE_ENABLE_PNG=OFF -DNANA_CMAKE_BUILD_DEMOS=ON -DNANA_CMAKE_ENABLE_AUDIO=OFF -DNANA_CMAKE_FIND_BOOST_FILESYSTEM=ON -DNANA_CMAKE_BOOST_FILESYSTEM_FORCE=OFF -DNANA_CMAKE_AUTOMATIC_GUI_TESTING=ON - make - - cd .. - - mv -v bin/ nana-demo/ - - cd nana-demo/bin + - cd lib + - ls + - cd ../.. + - ls + - mv -v bin/ ../nana-demo/ + - cd ../nana-demo/bin + - cmake -G"Unix Makefiles" .. -DNANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS=OFF -DNANA_CMAKE_AUTOMATIC_GUI_TESTING=ON - ls - ./a_group_impl - ./animate-bmp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ebc78bc..99b27e2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,10 +35,8 @@ option(NANA_CMAKE_LIBJPEG_FROM_OS "Use libjpeg from operating system." ON) option(NANA_CMAKE_ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF) option(NANA_CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." ON) option(NANA_CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) -option(NANA_CMAKE_BUILD_DEMOS "Build all the demos form the nana_demo repository." ON) -option(NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS "" ON) option(NANA_CMAKE_AUTOMATIC_GUI_TESTING "Activate automatic GUI testing?" OFF) -option(NANA_CMAKE_BUILD_FreeMe "Build FreeMe (currently broken)?" OFF) + # The ISO C++ File System Technical Specification (ISO-TS, or STD) is optional. @@ -84,7 +82,6 @@ add_definitions(-DNANA_IGNORE_CONF) if(WIN32) add_definitions(-DWIN32) - # 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) @@ -106,8 +103,6 @@ if(APPLE) add_definitions(-DAPPLE) include_directories(/opt/X11/include/) set(NANA_LINKS "${NANA_LINKS} -L/opt/X11/lib/ -liconv") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -liconv") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/opt/X11/lib/ -liconv") set(ENABLE_AUDIO OFF) elseif(UNIX) add_definitions(-Dlinux) @@ -116,13 +111,9 @@ endif(APPLE) if(UNIX) set(NANA_LINKS "${NANA_LINKS} -lX11") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lX11") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lX11") find_package(Freetype) if (FREETYPE_FOUND) include_directories( ${FREETYPE_INCLUDE_DIRS}) - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lXft") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lXft") set(NANA_LINKS "${NANA_LINKS} -lXft") endif(FREETYPE_FOUND) endif(UNIX) @@ -152,7 +143,6 @@ 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) # GNU || CLang not MinGW - #set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -pthread") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3) @@ -169,9 +159,6 @@ if (APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # A set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libstdc++") endif () -# set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") - - ############# Optional libraries @@ -179,10 +166,7 @@ endif () #Find PNG if(NANA_CMAKE_ENABLE_PNG) add_definitions(-DNANA_ENABLE_PNG) - #set(NANA_PNG_LIB "png") set(NANA_LINKS "${NANA_LINKS} -lpng") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpng") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpng") if(NANA_CMAKE_LIBPNG_FROM_OS) find_package(PNG) if (PNG_FOUND) @@ -195,10 +179,7 @@ endif(NANA_CMAKE_ENABLE_PNG) #Find JPEG if(NANA_CMAKE_ENABLE_JPEG) add_definitions(-DNANA_ENABLE_JPEG) - #set(NANA_JPEG_LIB "jpeg") set(NANA_LINKS "${NANA_LINKS} -ljpeg") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ljpeg") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljpeg") if(NANA_CMAKE_LIBJPEG_FROM_OS) find_package(JPEG) if (JPEG_FOUND) @@ -215,8 +196,6 @@ if(NANA_CMAKE_ENABLE_AUDIO) if (ASOUND_FOUND) include_directories( ${ASOUND_INCLUDE_DIRS}) set(NANA_LINKS "${NANA_LINKS} -lasound") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lasound") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasound") else(ASOUND_FOUND) message(FATAL_ERROR "libasound is not found") endif(ASOUND_FOUND) @@ -243,9 +222,7 @@ elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) if (Boost_FOUND) add_definitions(-DNANA_BOOST_FILESYSTEM_AVAILABLE) include_directories(SYSTEM "${Boost_INCLUDE_DIR}") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${Boost_LIBRARIES}") set(NANA_LINKS "${NANA_LINKS} ${Boost_LIBRARIES}") ###### FIRST !!!!!!!!!!!!!!!!! add is not first - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Boost_LIBRARIES}") endif (Boost_FOUND) set(Boost_USE_STATIC_LIBS ON) @@ -255,11 +232,15 @@ elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) endif (NANA_CMAKE_NANA_FILESYSTEM_FORCE) - if(NANA_CMAKE_VERBOSE_PREPROCESSOR) add_definitions(-DVERBOSE_PREPROCESSOR) endif(NANA_CMAKE_VERBOSE_PREPROCESSOR) +if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) + add_definitions(-DNANA_AUTOMATIC_GUI_TESTING) + enable_testing () +endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) + set(NANA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source) set(NANA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -312,67 +293,6 @@ endif(NANA_CMAKE_INSTALL_INCLUDES) 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 (NANA_CMAKE_BUILD_DEMOS) - - if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - add_definitions(-DNANA_AUTOMATIC_GUI_TESTING) - enable_testing () - endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - - - set (demos_dir ../nana-demo/) - set (demos calculator file_explorer helloworld_demo notepad widget_show widget_show2 ) - # Pending: - - set (examples_dir ../nana-demo/Examples/) - set (examples a_group_impl animate-bmp audio_player audio_player_simple - background-effects categ clicked windows-subclassing - dock drag-button draw example.button - example_combox example_listbox example_menu lambda_event.Cpp11 - filebox-txt folder_tree folder_tree_nana folder_tree_std - framework_design_1 framework_design_2 framework_design_3 label_listener - group HelloWord helloword_quit listbox_inline_widget - inputbox listbox_Resolver loader_1 loader_2 - main mbox menu_debug menu_popuper modal_form - MontiHall place_login png textbox_line_number - stretch_image threading thread-pool various_events - window-dragger screen decore - ) - # Pending: - - if (NANA_CMAKE_BUILD_FreeMe) - add_definitions(-DBUILD_FreeMe) - endif (NANA_CMAKE_BUILD_FreeMe) - if (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) - list(APPEND demos ) # ?? FreeMe - endif (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) - # Pending: FreeMe (added but really completely compiled if defined BUILD_FreeMe ) - - function(set_nana_test dir files) - foreach ( test ${${files}}) - add_executable(${test} "${${dir}}${test}.cpp") - set_property( TARGET ${test} PROPERTY CXX_STANDARD 14 ) - target_link_libraries(${test} ${PROJECT_NAME}) - #if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - #add_custom_command( TARGET ${test} POST_BUILD COMMAND ${test} ) - #add_custom_target(do_always_${test} ALL COMMAND ${test}) - #add_test(${test} COMMAND ${test}) - #endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - install(TARGETS ${test} RUNTIME DESTINATION "../nana-demo/") - message("... to build: ${${dir}}${test}.cpp" ) - endforeach( test ${${files}}) - endfunction(set_nana_test) - - set_nana_test(demos_dir demos) - set_nana_test(examples_dir examples) - -endif (NANA_CMAKE_BUILD_DEMOS) - - - message ( "CMAKE_CXX_COMPILER_ID = " ${CMAKE_CXX_COMPILER_ID}) message ( "COMPILER_IS_CLANG = " ${COMPILER_IS_CLANG}) message ( "CMAKE_COMPILER_IS_GNUCXX= " ${CMAKE_COMPILER_IS_GNUCXX})