From 74fa3bdf2b54141d3df537cca4b714632532cfe6 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 15 Apr 2019 13:34:27 +0200 Subject: [PATCH] Change again C compiler selection in CI --- .travis.yml | 4 ++-- libretroshare/src/libretroshare.pro | 14 ++++---------- retroshare.pri | 13 +++++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index e84e299bb..ed8308d2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,8 +48,8 @@ addons: before_script: - env - - if [ $TRAVIS_OS_NAME == linux ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX; fi - - if [ $TRAVIS_OS_NAME == osx ]; then qmake QMAKE_CC=clang QMAKE_CXX=$CXX CONFIG+=rs_macos10.14 INCLUDEPATH+=/usr/local/opt/openssl/include/ INCLUDEPATH+=/usr/local/Cellar/sqlcipher/4.0.1/include INCLUDEPATH+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/include QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/ QMAKE_LIBDIR+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/lib QMAKE_LIBDIR+=/usr/local/Cellar/sqlcipher/4.0.1/lib; fi + - if [ $TRAVIS_OS_NAME == linux ]; then qmake; fi + - if [ $TRAVIS_OS_NAME == osx ]; then qmake CONFIG+=rs_macos10.14 INCLUDEPATH+=/usr/local/opt/openssl/include/ INCLUDEPATH+=/usr/local/Cellar/sqlcipher/4.0.1/include INCLUDEPATH+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/include QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/ QMAKE_LIBDIR+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/lib QMAKE_LIBDIR+=/usr/local/Cellar/sqlcipher/4.0.1/lib; fi script: - if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j4; fi diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index dabe2e7af..4b65c46f1 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -882,7 +882,8 @@ rs_jsonapi { git submodule update --init --recommend-shallow dependency/kashmir ; \ true ) && \ mkdir -p $${RESTBED_BUILD_PATH} && cd $${RESTBED_BUILD_PATH} && \ - cmake -DCMAKE_CXX_COMPILER=$$QMAKE_CXX \ + cmake -DCMAKE_C_COMPILER=$$fixQmakeCC($$QMAKE_CC) \ + -DCMAKE_CXX_COMPILER=$$QMAKE_CXX \ $${CMAKE_GENERATOR_OVERRIDE} -DBUILD_SSL=OFF \ -DCMAKE_INSTALL_PREFIX=. -B. \ -H$$shell_path($${RESTBED_SRC_PATH}) && \ @@ -939,14 +940,7 @@ rs_broadcast_discovery { no_rs_cross_compiling { DUMMYQMAKECOMPILERINPUT = FORCE CMAKE_GENERATOR_OVERRIDE="" - CMAKE_C_COMPILER_OVERRIDE="" - win32-g++ { - CMAKE_GENERATOR_OVERRIDE="-G \"MSYS Makefiles\"" - APPVEYOR=$$(APPVEYOR) - equals(APPVEYOR, "True") { - CMAKE_C_COMPILER_OVERRIDE="-DCMAKE_C_COMPILER=gcc" - } - } + win32-g++:CMAKE_GENERATOR_OVERRIDE="-G \"MSYS Makefiles\"" udpdiscoverycpplib.name = Generating libudp-discovery.a. udpdiscoverycpplib.input = DUMMYQMAKECOMPILERINPUT udpdiscoverycpplib.output = $$clean_path($${UDP_DISCOVERY_BUILD_PATH}/libudp-discovery.a) @@ -958,7 +952,7 @@ rs_broadcast_discovery { true ) && \ mkdir -p $${UDP_DISCOVERY_BUILD_PATH} && \ cd $${UDP_DISCOVERY_BUILD_PATH} && \ - cmake $${CMAKE_C_COMPILER_OVERRIDE} \ + cmake -DCMAKE_C_COMPILER=$$fixQmakeCC($$QMAKE_CC) \ -DCMAKE_CXX_COMPILER=$$QMAKE_CXX \ $${CMAKE_GENERATOR_OVERRIDE} \ -DBUILD_EXAMPLE=OFF -DBUILD_TOOL=OFF \ diff --git a/retroshare.pri b/retroshare.pri index dd97fc08a..367c79a7f 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -324,6 +324,19 @@ defineReplace(linkDynamicLibs) { return($$retDlib) } +## On some environements qmake chose a C++ compiler as C compiler, this breaks +## some sub targets, such as those based on cmake which test for chosen C +## compiler to be a proper C compiler. This function try to deduce the correct C +## compiler also in those cases, and return it. So you can use +## $$fixQmakeCC($$QMAKE_CC) in those cases instead of plain $$QMAKE_CC +defineReplace(fixQmakeCC) { + retVal = $$1 + contains(1, .*\+\+$):retVal=$$str_member($$1, 0 ,-3) + contains(1, .*g\+\+$):retVal=$$str_member($$1, 0 ,-3)cc + contains(1, .*clang\+\+$):retVal=$$str_member($$1, 0 ,-3) + return($$retVal) +} + ################################################################################ ## Statements and variables that depends on build options (CONFIG) goes here ### ################################################################################