From 391512d0a25a68ba2cf56deac5f8e826b8ff5d33 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 9 Dec 2014 19:48:03 +0100 Subject: [PATCH] fixed compiler settings on windows, added few comments --- cmake/EthCompilerSettings.cmake | 16 +++++++++------- cmake/EthDependencies.cmake | 23 +++++++++++++++++------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index d821067a8..677467bea 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -4,7 +4,12 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -DSHAREDLIB -fPIC") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") set(ETH_SHARED 1) + execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) if (NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)) @@ -14,6 +19,10 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -DSHAREDLIB -fPIC") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") set(ETH_SHARED 1) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") @@ -28,10 +37,3 @@ else () message(FATAL_ERROR "Your C++ compiler does not support C++11. You have ${CMAKE_CXX_COMPILER_ID}") endif () -# Initialize CXXFLAGS -# CMAKE_CXX_FLAGS was set before -set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") -set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") -set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") - diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 7c0fe048c..f55a93d38 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -77,6 +77,8 @@ find_package (CURL) message(" - curl header: ${CURL_INCLUDE_DIR}") message(" - curl lib : ${CURL_LIBRARY}") +# find all of the Qt packages +# remember to use 'Qt' instead of 'QT', cause unix is case sensitive # TODO make headless client optional find_package (Qt5Core REQUIRED) find_package (Qt5Gui REQUIRED) @@ -87,17 +89,26 @@ find_package (Qt5Widgets REQUIRED) find_package (Qt5WebKit REQUIRED) find_package (Qt5WebKitWidgets REQUIRED) -if (WIN32) +# use multithreaded boost libraries, with -mt suffix +set(Boost_USE_MULTITHREADED ON) + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # TODO hanlde other msvc versions or it will fail find them set(Boost_COMPILER -vc120) + # use static boost libraries *.lib set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) -elseif(APPLE) + +elseif (APPLE) + + # use static boost libraries *.a set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) -elseif(UNIX) + +elseif (UNIX) + + # use dynamic boost libraries .dll set(Boost_USE_STATIC_LIBS OFF) - set(Boost_USE_MULTITHREADED ON) + endif() find_package(Boost 1.54.0 REQUIRED COMPONENTS thread date_time system regex chrono filesystem unit_test_framework)