From 8aad0ced388c2e5136190dff3aa88daaed5fd0bd Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Sun, 8 Apr 2018 20:20:04 +0800 Subject: [PATCH 1/4] We should do not need POLICY CMP0004 anymore --- CMakeLists.txt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac548dcd..a9973884 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# CMake configuration for Nana +# CMake configuration for Nana # Author: Andrew Kornilov(https://github.com/ierofant) # Contributors: # Jinhao @@ -59,14 +59,8 @@ option(NANA_CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if avail ########### Compatibility with CMake 3.1 if(POLICY CMP0054) # http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html - cmake_policy(SET CMP0054 OLD) + cmake_policy(SET CMP0054 NEW) endif() -if(POLICY CMP0004) # ignore leading space - # http://www.cmake.org/cmake/help/v3.0/policy/CMP0004.html - cmake_policy(SET CMP0004 OLD) -endif() - -set(CMAKE_DEBUG_POSTFIX "_d") ########### OS @@ -113,7 +107,6 @@ if(WIN32) endif() endif() - if(APPLE) add_definitions(-DAPPLE) include_directories(/opt/X11/include/) @@ -287,6 +280,8 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") add_definitions(-fmax-errors=3) endif() +set(CMAKE_DEBUG_POSTFIX "_d") + if(NANA_CMAKE_SHARED_LIB) add_library(${PROJECT_NAME} SHARED ${SOURCES}) else() From 596aecc24a6c8da820a6657118b3da025fcfd1bc Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Sun, 8 Apr 2018 20:27:11 +0800 Subject: [PATCH 2/4] Better static linker flags again Don't know why it missing in the previous commit --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9973884..a83a3ee8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,7 @@ endif() # # # see at end of: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html +# if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall -g") @@ -147,12 +148,12 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") endif() endif() -# enable static linkage # GNU || CLang not MinGW if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(NANA_CMAKE_SHARED_LIB) list(APPEND NANA_LINKS -lgcc -lstdc++ -pthread) else() - set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -pthread") + set(CMAKE_EXE_LINKER_FLAGS "-static -pthread") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s") endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3) @@ -160,7 +161,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") endif() endif() - if(APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") list(APPEND NANA_LINKS -stdlib=libstdc++) endif() From f03c09303d50ab882c53a575f3e4da84ef7f7102 Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Sun, 8 Apr 2018 21:22:47 +0800 Subject: [PATCH 3/4] Remove the duplicaties compilation options --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a83a3ee8..1ae8abff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,9 +142,9 @@ endif() # if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall -g") + set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall") else() - set(CMAKE_CXX_FLAGS "-std=c++14 -Wall -g") + set(CMAKE_CXX_FLAGS "-std=c++14 -Wall") endif() endif() @@ -310,8 +310,6 @@ if(NANA_CLION) # the Clion IDE don't reconize the install target COMMENT "Installing ${PROJECT_NAME}") endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) - if(NANA_CMAKE_SHARED_LIB) if(WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) From 1a9d84e88a9de1553d0180f35cb2a7c7bc90e03f Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Sun, 8 Apr 2018 21:43:35 +0800 Subject: [PATCH 4/4] Fix compilation warning --- source/gui/widgets/listbox.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index d5e71b54..1101fbb8 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -4552,7 +4552,7 @@ namespace nana //Check if it scrolls in current screen window //condition: top of target item is not less than top edge of content view and //the bottom of target item is not greater than bottom edge of content view. - if ((screen_top + static_cast(item_px) <= logic_top) && (logic_top + static_cast(item_px) + static_cast(item_px) <= screen_bottom)) + if ((screen_top + static_cast(item_px) <= logic_top) && (logic_top + static_cast(item_px) + static_cast(item_px) <= static_cast(screen_bottom))) { int offset = (static_cast(upward ? screen_top : screen_bottom - item_px) - logic_top) / static_cast(item_px); target_idx = list.advance(init_idx, offset); @@ -4578,8 +4578,8 @@ namespace nana target_idx = list.last(); origin.y = list.distance(list.first(), target_idx) * item_px + item_px; - if (origin.y >= (screen_bottom - screen_top)) - origin.y -= (screen_bottom - screen_top); + if (origin.y >= static_cast(screen_bottom - screen_top)) + origin.y -= static_cast(screen_bottom - screen_top); else origin.y = 0; }