From 47b0ab9880b29c69df387d96366c2bf5a833eb85 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 18 Oct 2014 09:10:13 +0200 Subject: [PATCH 1/4] Fixing detection of Debian version --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7abf997dd..cb2be4597 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") ) if(${LINUX_DISTRIBUTION} MATCHES "Debian") set(LINUX_DISTRIBUTION "Debian") + file(READ /etc/debian_version LINUX_VER) endif(${LINUX_DISTRIBUTION} MATCHES "Debian") endif(EXISTS "/etc/os-release") endif(NOT LINUX_DISTRIBUTION) From b27f09907b63efb740d467aa0fc6cb8f45c2534e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 18 Oct 2014 09:35:40 +0200 Subject: [PATCH 2/4] Fixing detection of gfortran in Fedora and OpenSUSE (thanks to Nick Ristow) --- CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb2be4597..c932221bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -568,25 +568,31 @@ if(OS_IS_LINUX) /usr/lib/gcc/x86_64-redhat-linux/4.7.2 # Fedora 18 /usr/lib/gcc/i686-redhat-linux/4.7.2 /usr/lib/gcc/x86_64-redhat-linux/4.8.1 # Fedora 19 + /usr/lib/gcc/x86_64-redhat-linux/4.8.3 # Fedora 20 + /usr/lib/gcc/x86_64-redhat-linux/4.9.1 # Fedora 21 /usr/lib/gcc/i686-redhat-linux/4.8.1 + /usr/lib/gcc/i686-redhat-linux/4.8.3 + /usr/lib/gcc/i686-redhat-linux/4.9.1 /usr/lib/gcc/x86_64-redhat-linux/4.4.4 # CentOS 6 /usr/lib/gcc/i686-redhat-linux/4.4.4 /usr/lib/gcc/x86_64-redhat-linux/4.8.2 /usr/lib/gcc/i686-redhat-linux/4.8.2 /usr/lib/gcc/i586-suse-linux/4.8 # OpenSUSE 13.1 + /usr/lib/gcc/i586-suse-linux/4.9 /usr/lib/gcc/x86_64-suse-linux/4.8 + /usr/lib/gcc/x86_64-suse-linux/4.9 /usr/lib/gcc/i486-linux-gnu # Debian 7 /usr/lib/gcc/i486-linux-gnu/4.4 /usr/lib/gcc/i486-linux-gnu/4.6 /usr/lib/gcc/i486-linux-gnu/4.7 /usr/lib/gcc/i486-linux-gnu/4.8 /usr/lib/gcc/i486-linux-gnu/4.9 - /usr/lib/gcc/arm-linux-gnueabihf/4.4 # Debian armhf - /usr/lib/gcc/arm-linux-gnueabihf/4.5 - /usr/lib/gcc/arm-linux-gnueabihf/4.6 - /usr/lib/gcc/arm-linux-gnueabihf/4.7 - /usr/lib/gcc/arm-linux-gnueabihf/4.8 - /usr/lib/gcc/arm-linux-gnueabihf/4.9 + /usr/lib/gcc/arm-linux-gnueabihf/4.4 # Debian armhf + /usr/lib/gcc/arm-linux-gnueabihf/4.5 + /usr/lib/gcc/arm-linux-gnueabihf/4.6 + /usr/lib/gcc/arm-linux-gnueabihf/4.7 + /usr/lib/gcc/arm-linux-gnueabihf/4.8 + /usr/lib/gcc/arm-linux-gnueabihf/4.9 ) if(NOT GFORTRAN) message(" The gfortran library has not been found.") From 49ba62cefa66f10ae286fd7871b642a619abfd3d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 18 Oct 2014 09:43:44 +0200 Subject: [PATCH 3/4] Adding detection of Mac OS X 10.10 Yosemite --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c932221bf..dfd1aee3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,6 +171,12 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(OS_IS_MACOSX TRUE) exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION) string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) + if(${DARWIN_VERSION} MATCHES "14") + set(MACOSX_YOSEMITE TRUE) + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on Mac OS X 10.10 Yosemite") + endif(${DARWIN_VERSION} MATCHES "14") if(${DARWIN_VERSION} MATCHES "13") set(MACOSX_MAVERICKS TRUE) set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") From 045c432920eb43364f6daeb253cd9f7b75515aa9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 18 Oct 2014 12:39:58 +0200 Subject: [PATCH 4/4] Some changes to make it work with Yosemite --- src/main/CMakeLists.txt | 7 ++----- src/tests/CMakeLists.txt | 26 +++++++++++--------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index c8b648b7d..f5cbe5bc1 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -46,12 +46,9 @@ include_directories( add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) if(OS_IS_MACOSX) - if (MACOSX_MAVERICKS) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(MAC_LIBRARIES "-stdlib=libc++ -std=c++11 -framework Accelerate") - else(MACOSX_MAVERICKS) - link_directories( /opt/local/lib ) # Not very elegant, to be fixed - set(MAC_LIBRARIES "-lstdc++") - endif(MACOSX_MAVERICKS) + endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif(OS_IS_MACOSX) add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 25d7132cb..26cd78a98 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -33,7 +33,7 @@ endif(NOT GTEST_DIR_LOCAL) if(NOT GTEST_DIR_LOCAL) # if GTEST_DIR is not defined, we download and build it set(gtest_RELEASE 1.7.0) - if(MACOSX_MAVERICKS) + if(OS_IS_MACOSX) ExternalProject_Add( gtest-${gtest_RELEASE} URL http://googletest.googlecode.com/files/gtest-${gtest_RELEASE}.zip @@ -41,12 +41,12 @@ if(NOT GTEST_DIR_LOCAL) URL_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7" SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${gtest_RELEASE} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${gtest_RELEASE} - CMAKE_ARGS -DCMAKE_CXX_COMPILER=/usr/bin/clang++ + CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_COMMAND "" ) - else(MACOSX_MAVERICKS) + else(OS_IS_MACOSX) ExternalProject_Add( gtest-${gtest_RELEASE} URL http://googletest.googlecode.com/files/gtest-${gtest_RELEASE}.zip @@ -58,7 +58,7 @@ if(NOT GTEST_DIR_LOCAL) PATCH_COMMAND "" INSTALL_COMMAND "" ) - endif(MACOSX_MAVERICKS) + endif(OS_IS_MACOSX) # Set up variables # Set recently downloaded and build Googletest root folder set(GTEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${gtest_RELEASE}") @@ -68,11 +68,11 @@ if(NOT GTEST_DIR_LOCAL) set(GTEST_INCLUDE_DIRECTORIES ${GTEST_DIR}/include ${GTEST_DIR} ${GTEST_DIR}/src) # Library ExternalProject_Get_Property(gtest-${gtest_RELEASE} binary_dir) - if(MACOSX_MAVERICKS) + if(OS_IS_MACOSX) if(CMAKE_GENERATOR STREQUAL Xcode) set(binary_dir "${binary_dir}/Debug") endif(CMAKE_GENERATOR STREQUAL Xcode) - endif(MACOSX_MAVERICKS) + endif(OS_IS_MACOSX) set(GTEST_LIBRARY_PATH "${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a;${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main.a") set(GTEST_LIBRARY gtest-${gtest_RELEASE}) set(GTEST_LIBRARIES @@ -137,14 +137,10 @@ include_directories( ) -if(OS_IS_MACOSX) - if(MACOSX_MAVERICKS) - set(MAC_LIBRARIES "-stdlib=libc++ -std=c++11") - else(MACOSX_MAVERICKS) - # Tell the linker where the libraries installed by MacPorts are - link_directories( /opt/local/lib ) # not very elegant, to be fixed. Needed? - endif(MACOSX_MAVERICKS) -endif(OS_IS_MACOSX) +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CLANG_FLAGS "-stdlib=libc++ -std=c++11") +endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if(OPENCL_FOUND) add_definitions(-DOPENCL_BLOCKS_TEST=1) @@ -155,7 +151,7 @@ add_definitions(-DTEST_PATH="${CMAKE_SOURCE_DIR}/src/tests/") add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc) -target_link_libraries(run_tests ${MAC_LIBRARIES} +target_link_libraries(run_tests ${CLANG_FLAGS} ${Boost_LIBRARIES} ${GFLAGS_LIBS} ${GLOG_LIBRARIES}