From 6092cc71932dff7f5c3e838523be45b5962ba304 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Sat, 21 Sep 2013 15:21:32 +0200 Subject: [PATCH] refs #60 Added externals.pri looking for the external headers/libraries in 3 steps: 1. Manually set absolut path. Currently commented. Uncomment for local use. 2. Enviromental variable "VATSIM_EXTERNAL_DIR" 3. default path client/externals. --- .gitignore | 4 ++ .qmake.conf | 1 + client.pro | 4 +- externals.pri | 58 ++++++++++++++++++++++++ samples/cli_client/sample_cli_client.pro | 6 +-- 5 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 .qmake.conf create mode 100644 externals.pri diff --git a/.gitignore b/.gitignore index 6f275a76e..ac1fe06b3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,10 @@ DebugFast/ ReleaseDebugStatic/ DebugFastStatic/ build/ +Makefile + +# Externals folder +externals/ # .log files (usually created by QtTest - thanks to VestniK) *.log diff --git a/.qmake.conf b/.qmake.conf new file mode 100644 index 000000000..02ed81b06 --- /dev/null +++ b/.qmake.conf @@ -0,0 +1 @@ +TOPSRCDIR=$$PWD diff --git a/client.pro b/client.pro index 6a55eca2c..21094f539 100644 --- a/client.pro +++ b/client.pro @@ -2,6 +2,8 @@ TEMPLATE = subdirs CONFIG += ordered +include (externals.pri) + WITH_BLACKMISC = ON WITH_BLACKCORE = ON WITH_BLACKD = ON @@ -16,7 +18,7 @@ WITH_SAMPLES = ON equals(WITH_BLACKMISC, ON) { SUBDIRS += src/blackmisc - SUBDIRS += src/blackmisc_cpp2xml + #SUBDIRS += src/blackmisc_cpp2xml } equals(WITH_BLACKCORE, ON) { diff --git a/externals.pri b/externals.pri new file mode 100644 index 000000000..64ba8e4c7 --- /dev/null +++ b/externals.pri @@ -0,0 +1,58 @@ +# externals.pri +# Sets up the include and library directories for external dependencies + +# If you want to manually set the external path, uncomment the following line +# EXTERNALDIR = /path/to/externals + +# Test if enviromental variable for externals is set + +isEmpty(EXTERNALDIR) { + EXTERNALDIR = $$(VATSIM_EXTERNAL_DIR) + message($$EXTERNALDIR) + +} + +# if no env variable is set, we use the standard path in the client folder. +isEmpty(EXTERNALDIR) { + EXTERNALDIR = $$TOPSRCDIR/externals + message($$EXTERNALDIR) +} + +# Test the folder if it exists and has a include subfolder +!exists("$$EXTERNALDIR/include") { + error("Could not find externals in $$EXTERNALDIR. Please install it!") +} + +# Everything is fine. Add the include path +message("Found externals: $$EXTERNALDIR") +INCLUDEPATH *= $$EXTERNALDIR/include + +# and the library path depending on the used compiler + +win32:contains(QMAKE_TARGET.arch, x86_64) { + LIBS *= -L$$EXTERNALDIR/vs2010_64/lib +} +win32:contains(QMAKE_TARGET.arch, x86) { + LIBS *= -L$$EXTERNALDIR/vs2010_32/lib +} + +win32-g++ { + message("Can't figure out if MinGW version is 32 bit or 64.") + message("Defaulting to 64 bit. If this is not correct, change the path manually!") + LIBS *= -L$$EXTERNALDIR/mingw64/lib +} + +linux-g++-32 { + LIBS *= -L$$EXTERNALDIR/linux32/lib +} + +linux-g++-64 { + LIBS *= -L$$EXTERNALDIR/linux64/lib +} + + + + + + + diff --git a/samples/cli_client/sample_cli_client.pro b/samples/cli_client/sample_cli_client.pro index a5a5aaeb1..da714726a 100644 --- a/samples/cli_client/sample_cli_client.pro +++ b/samples/cli_client/sample_cli_client.pro @@ -1,3 +1,5 @@ +include (../../externals.pri) + QT += core dbus QT -= gui @@ -14,14 +16,12 @@ SOURCES += *.cpp HEADERS += *.h LIBS += -L../../lib -lblackcore -lblackmisc -LIBS += -L../../../vatlib -lvatlib +LIBS += -lvatlib win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib \ ../../lib/blackcore.lib \ - ../../../vatlib/vatlib.lib else: PRE_TARGETDEPS += ../../lib/libblackmisc.a \ ../../lib/libblackcore.a \ - ../../../vatlib/libvatlib.a #TODO standardize dependency locations DESTDIR = ../../bin