Add first batch of configuration tests

Summary:
Configuration tests check whether all mandatory dependencies to build
swift are met. They can also be used to check optional dependencies, which
results in certain features to be enabled or disabled.
This first batch tests for mandatory libraries libpng, zlib and OpenGL.
If this is not tested and some libraries are missing, the developer will
be notified very late in the build.

Reviewers: #swift_pilot_client, msutcliffe

Reviewed By: #swift_pilot_client, msutcliffe

Subscribers: msutcliffe, jenkins

Differential Revision: https://dev.swift-project.org/D34
This commit is contained in:
Roland Winklmeier
2017-06-13 10:05:45 +02:00
committed by Mathew Sutcliffe
parent 045caddcc8
commit 7317ddd155
13 changed files with 163 additions and 52 deletions

14
config.tests/gl/gl.cpp Normal file
View File

@@ -0,0 +1,14 @@
#if defined(Q_OS_WIN)
#include <windows.h>
#include <GL/gl.h>
#elif defined(Q_OS_MAC)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
int main(int, char **)
{
glGetString(GL_VERSION);
return 0;
}

16
config.tests/gl/gl.pro Normal file
View File

@@ -0,0 +1,16 @@
load(config_test_pre)
CONFIG -= qt
CONFIG += console
SOURCES = gl.cpp
win32 {
DEFINES += Q_OS_WIN
LIBS *= -lopengl32
}
linux: LIBS *= -lGL
macx {
DEFINES += Q_OS_MAC
LIBS += -framework OpenGL
}

14
config.tests/glu/glu.cpp Normal file
View File

@@ -0,0 +1,14 @@
#if defined(Q_OS_WIN)
#include <windows.h>
#include <GL/glu.h>
#elif defined(Q_OS_MAC)
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif
int main(int, char **)
{
gluGetString(GL_VERSION);
return 0;
}

16
config.tests/glu/glu.pro Normal file
View File

@@ -0,0 +1,16 @@
load(config_test_pre)
CONFIG -= qt
CONFIG += console
SOURCES = glu.cpp
win32 {
DEFINES += Q_OS_WIN
LIBS *= -lglu32
}
linux: LIBS *= -lGLU
macx {
DEFINES += Q_OS_MAC
LIBS += -framework OpenGL
}

View File

@@ -0,0 +1,7 @@
#include <png.h>
int main(int, char **)
{
png_access_version_number();
return 0;
}

View File

@@ -0,0 +1,7 @@
load(config_test_pre)
CONFIG -= qt
CONFIG += console
SOURCES = libpng.cpp
LIBS *= -lpng -lz

View File

@@ -0,0 +1,7 @@
#include <zlib.h>
int main(int, char **)
{
zlibVersion();
return 0;
}

View File

@@ -0,0 +1,7 @@
load(config_test_pre)
CONFIG -= qt
CONFIG += console
SOURCES = zlib.cpp
LIBS *= -lz

View File

@@ -103,62 +103,11 @@ equals(WORD_SIZE,32) {
win32-g++: QMAKE_LFLAGS *= -Wl,--large-address-aware
}
################################
# Path to external dependencies
################################
# If you want to manually set the external path, uncomment the following line
# EXTERNALSROOT = /path/to/externals
isEmpty(EXTERNALSROOT) {
EXTERNALSROOT = $$(SWIFT_EXTERNALS_DIR)
}
isEmpty(EXTERNALSROOT) {
EXTERNALSROOT = $$SourceRoot/externals
}
!exists("$$EXTERNALSROOT/common/include") {
error("Could not find externals in $${EXTERNALSROOT}. Please install them!")
}
################################
# Externals
################################
EXTERNALS_SPEC = $$basename(QMAKESPEC)
msvc {
clang_cl: EXTERNALS_SPEC = win32-msvc2015
win32-msvc2017: EXTERNALS_SPEC = win32-msvc2015
win32-msvc {
# From Qt 5.8.1 onwards, QMAKESPEC is win32-msvc without the version number
# see https://codereview.qt-project.org/#/c/162754/
lessThan(MSVC_VER, 14.0) | greaterThan(MSVC_VER, 15.0) {
error(This version of Visual Studio is not supported (MSVC_VER = $$MSVC_VER))
}
EXTERNALS_SPEC = win32-msvc2015
}
}
INCLUDEPATH *= $$EXTERNALSROOT/common/include
INCLUDEPATH *= $$EXTERNALSROOT/$$EXTERNALS_SPEC/include
INCLUDEPATH *= $$EXTERNALSROOT/common/include/crashpad
INCLUDEPATH *= $$EXTERNALSROOT/common/include/mini_chromium
equals(WORD_SIZE,64) {
EXTERNALS_BIN_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/bin64
EXTERNALS_LIB_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/lib64
}
equals(WORD_SIZE,32) {
EXTERNALS_BIN_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/bin32
EXTERNALS_LIB_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/lib32
}
LIBS *= -L$$EXTERNALS_LIB_DIR
macx: LIBS *= -F$$EXTERNALS_LIB_DIR
win32: LIBS *= -luser32
INCLUDEPATH *= $$EXTERNALDIR/common/include
include(externals.pri)
################################
# Includes

View File

@@ -28,6 +28,17 @@ isEmpty(BLACK_EOL): BLACK_EOL = "20180101"
## Private Area ##
## Dependency Checks ##
load(configure)
defineTest(CheckMandatoryDependency) {
!qtCompileTest($${1}): error(Cannot find $${1} development package. Make sure it is installed. Inspect config.log for more information.)
}
defineTest(CheckOptionalDependency) {
qtCompileTest($${1})
}
# include vatsim client id and key
include(vatsim.pri)

View File

@@ -0,0 +1,2 @@
include(wordsize.pri)
include(externals.pri)

View File

@@ -0,0 +1,56 @@
################################
# Path to external dependencies
################################
# If you want to manually set the external path, uncomment the following line
# EXTERNALSROOT = /path/to/externals
isEmpty(EXTERNALSROOT) {
EXTERNALSROOT = $$(SWIFT_EXTERNALS_DIR)
}
isEmpty(EXTERNALSROOT) {
EXTERNALSROOT = $$SourceRoot/externals
}
!exists("$$EXTERNALSROOT/common/include") {
error("Could not find externals in $${EXTERNALSROOT}. Please install them!")
}
################################
# Externals
################################
EXTERNALS_SPEC = $$basename(QMAKESPEC)
msvc {
clang_cl: EXTERNALS_SPEC = win32-msvc2015
win32-msvc2017: EXTERNALS_SPEC = win32-msvc2015
win32-msvc {
# From Qt 5.8.1 onwards, QMAKESPEC is win32-msvc without the version number
# see https://codereview.qt-project.org/#/c/162754/
lessThan(MSVC_VER, 14.0) | greaterThan(MSVC_VER, 15.0) {
error(This version of Visual Studio is not supported (MSVC_VER = $$MSVC_VER))
}
EXTERNALS_SPEC = win32-msvc2015
}
}
INCLUDEPATH *= $$EXTERNALSROOT/common/include
INCLUDEPATH *= $$EXTERNALSROOT/$$EXTERNALS_SPEC/include
INCLUDEPATH *= $$EXTERNALSROOT/common/include/crashpad
INCLUDEPATH *= $$EXTERNALSROOT/common/include/mini_chromium
equals(WORD_SIZE,64) {
EXTERNALS_BIN_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/bin64
EXTERNALS_LIB_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/lib64
}
equals(WORD_SIZE,32) {
EXTERNALS_BIN_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/bin32
EXTERNALS_LIB_DIR = $$EXTERNALSROOT/$$EXTERNALS_SPEC/lib32
}
LIBS *= -L$$EXTERNALS_LIB_DIR
macx: LIBS *= -F$$EXTERNALS_LIB_DIR
win32: LIBS *= -luser32
INCLUDEPATH *= $$EXTERNALDIR/common/include

View File

@@ -6,6 +6,11 @@ CONFIG += ordered
OTHER_FILES += mkspecs/features/*.prf
OTHER_FILES += mkspecs/features/*.pri
CheckMandatoryDependency(gl)
CheckMandatoryDependency(glu)
CheckMandatoryDependency(libpng)
CheckMandatoryDependency(zlib)
contains(BLACK_CONFIG,Doxygen) {
SUBDIRS += docs
}