Skip to content

Commit

Permalink
support msvc static build. qml is not supported yet
Browse files Browse the repository at this point in the history
tested qt5.7.0 vs2015 x86 from http://www.npcglib.org/~stathis/blog/
precompiled-qt4-qt5/
  • Loading branch information
wang-bin committed Jan 6, 2017
1 parent 89747bd commit 9d49102
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion examples/QMLPlayer/QMLPlayer.pro
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
VERSION = $$QTAV_VERSION
!static:VERSION = $$QTAV_VERSION # vc: will create exp and lib, result in static build error
QT = sql
android {
QT = androidextras
Expand Down
2 changes: 1 addition & 1 deletion examples/QMLPlayer/QMLPlayer_sdk.pro
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
TARGET = QMLPlayer
VERSION = $$QTAV_VERSION
!static:VERSION = $$QTAV_VERSION
QT = av svg qml quick sql
android {
QT = androidextras
Expand Down
2 changes: 1 addition & 1 deletion examples/common/libcommon.pri
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 52,7 @@ LIB_VERSION = $$QTAV_VERSION #0.x.y may be wrong for dll

# If user haven't supplied STATICLINK, then auto-detect
isEmpty(STATICLINK) {
contains(CONFIG, staticlib) {
static|contains(CONFIG, staticlib) {
STATICLINK = 1
} else {
STATICLINK = 0
Expand Down
2 changes: 1 addition & 1 deletion examples/filters/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 63,7 @@ int main(int argc, char *argv[])
VideoRenderer *renderer = 0;
bool textfilter = false;
if (vo == QLatin1String("gl")) {
renderer = VideoRenderer::create(VideoRendererId_GLWidget);
renderer = VideoRenderer::create(VideoRendererId_GLWidget2);
textfilter = true;
} else if (vo == QLatin1String("d2d")) {
renderer = VideoRenderer::create(VideoRendererId_Direct2D);
Expand Down
2 changes: 1 addition & 1 deletion examples/player/player.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@ contains(QT_CONFIG, opengl): QT = opengl
QT = sql svg
greaterThan(QT_MAJOR_VERSION, 4): QT = widgets
TRANSLATIONS = res/player_zh_CN.ts
VERSION = $$QTAV_VERSION
!static:VERSION = $$QTAV_VERSION # vc: will create exp and lib, result in static build error

PROJECTROOT = $$PWD/../..
include($$PROJECTROOT/src/libQtAV.pri)
Expand Down
4 changes: 3 additions & 1 deletion qml/libQmlAV.pri
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 51,7 @@ eval(LIB$$upper($$NAME)_PRI_INCLUDED = 1)
LIB_VERSION = $$QTAV_VERSION #0.x.y may be wrong for dll
# If user haven't supplied STATICLINK, then auto-detect
isEmpty(STATICLINK) {
contains(CONFIG, staticlib) {
static|contains(CONFIG, staticlib) {
STATICLINK = 1
} else {
STATICLINK = 0
Expand All @@ -60,6 60,8 @@ isEmpty(STATICLINK) {
# in iOS 8.1.
ios:STATICLINK = 1
}
isEqual(STATICLINK, 1):DEFINES = BUILD_$$upper($$NAME)_STATIC

TEMPLATE = fakelib
PROJECT_TARGETNAME = $$qtLibraryTarget($$NAME)
TEMPLATE -= fakelib
Expand Down
8 changes: 4 additions & 4 deletions src/libQtAV.pri
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 49,9 @@ NAME = QtAV
eval(LIB$$upper($$NAME)_PRI_INCLUDED = 1)

LIB_VERSION = $$QTAV_VERSION #0.x.y may be wrong for dll

# If user haven't supplied STATICLINK, then auto-detect
isEmpty(STATICLINK) {
contains(CONFIG, staticlib) {
static|contains(CONFIG, staticlib) {
STATICLINK = 1
} else {
STATICLINK = 0
Expand All @@ -61,6 60,7 @@ isEmpty(STATICLINK) {
# in iOS 8.1.
ios:STATICLINK = 1
}
isEqual(STATICLINK, 1):DEFINES = BUILD_$$upper($$NAME)_STATIC

TEMPLATE = fakelib
PROJECT_TARGETNAME = $$qtLibraryTarget($$NAME)
Expand Down Expand Up @@ -109,9 109,9 @@ DEPENDPATH *= $$PROJECT_SRCPATH
CONFIG *= create_prl #
DEFINES = BUILD_$$upper($$NAME)_LIB #win32-msvc*
isEqual(STATICLINK, 1) {
CONFIG -= shared dll ##otherwise the following shared is true, why?
CONFIG -= shared dll ##otherwise the following shared is true, why?
CONFIG *= staticlib
} else {
} else {
CONFIG *= shared #shared includes dll
}

Expand Down
7 changes: 3 additions & 4 deletions src/libQtAV.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 14,8 @@ greaterThan(QT_MAJOR_VERSION, 4) {
config_gl: QT = opengl
}
CONFIG *= qtav-buildlib
staticlib: DEFINES = BUILD_QTAV_STATIC
static: CONFIG *= static_ffmpeg
INCLUDEPATH = $$[QT_INSTALL_HEADERS]
INCLUDEPATH = $$[QT_INSTALL_HEADERS] # TODO: ffmpeg dir

#mac: simd.prf will load qt_build_config and the result is soname will prefixed with QT_INSTALL_LIBS and link flag will append soname after QMAKE_LFLAGS_SONAME
config_libcedarv: CONFIG *= neon config_simd #need by qt4 addSimdCompiler(). neon or config_neon is required because tests/arch can not detect neon
Expand All @@ -31,7 30,7 @@ PROJECTROOT = $$PWD/..
preparePaths($$OUT_PWD/../out)
exists($$PROJECTROOT/extra/qtLongName(include)): INCLUDEPATH = $$PROJECTROOT/extra/qtLongName(include)
exists($$PROJECTROOT/extra/qtLongName(lib)): LIBS = -L$$PROJECTROOT/extra/qtLongName(lib)

staticlib: DEFINES = BUILD_QTAV_STATIC

config_uchardet {
DEFINES = LINK_UCHARDET
Expand Down Expand Up @@ -97,7 96,7 @@ win32 {
}
debug: QMAKE_LFLAGS = /SAFESEH:NO
#CXXFLAGS debug: /MTd
QMAKE_LFLAGS *= /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib #for msbuild vs2013
!static:QMAKE_LFLAGS *= /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib #for msbuild vs2013

}
capi {
Expand Down
1 change: 0 additions & 1 deletion tests/qiodevice/qiodevice.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,6 @@ TEMPLATE = app
greaterThan(QT_MAJOR_VERSION, 4): QT = widgets
CONFIG -= app_bundle

STATICLINK = 0
PROJECTROOT = $$PWD/../..
include($$PROJECTROOT/src/libQtAV.pri)
include($$PROJECTROOT/widgets/libQtAVWidgets.pri)
Expand Down
10 changes: 8 additions & 2 deletions tools/install_sdk/install_sdk.pro
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 61,13 @@ defineTest(createForModule) {
MODULE = $$lower($$MODULE_NAME)
MODULE_DEPENDS = $$eval($${MODULE}.depends)
MODULE_DEFINES = QT_$$upper($${MODULE})_LIB
ORIG_LIB = $${LIBPREFIX}$$qtLibName($$MODULE_FULL_NAME, $$QTAV_MAJOR_VERSION).$${LIBSUFFIX}
ORIG_LIB_D = $${LIBPREFIX}$$qtLibName($$MODULE_FULL_NAME$${DEBUG_SUF}, $$QTAV_MAJOR_VERSION).$${LIBSUFFIX}
static {
ORIG_LIB = $${LIBPREFIX}$${MODULE_FULL_NAME}.$${LIBSUFFIX}
ORIG_LIB_D = $${LIBPREFIX}$${MODULE_FULL_NAME}.$${LIBSUFFIX}
} else {
ORIG_LIB = $${LIBPREFIX}$$qtLibName($$MODULE_FULL_NAME, $$QTAV_MAJOR_VERSION).$${LIBSUFFIX}
ORIG_LIB_D = $${LIBPREFIX}$$qtLibName($$MODULE_FULL_NAME$${DEBUG_SUF}, $$QTAV_MAJOR_VERSION).$${LIBSUFFIX}
}
greaterThan(QT_MAJOR_VERSION, 4) {
MODULE_PRF_FILE = $$OUT_PWD/mkspecs/features/$${MODULE}.prf
NEW_LIB = $${LIBPREFIX}Qt$${QT_MAJOR_VERSION}$${MODULE_NAME}$${NAME_SUF}.$${LIBSUFFIX}
Expand Down Expand Up @@ -117,6 122,7 @@ AV_PRF_CONT = "QTAV_MAJOR_VERSION=$$QTAV_MAJOR_VERSION"
AV_PRF_CONT = "QTAV_MINOR_VERSION=$$QTAV_MINOR_VERSION"
AV_PRF_CONT = "QTAV_PATCH_VERSION=$$QTAV_PATCH_VERSION"
AV_PRF_CONT = "android: QMAKE_LFLAGS = -lOpenSLES"
AV_PRF_CONT = "static: DEFINES = BUILD_QT$$upper($${MODULE})_STATIC"
#AV_PRF_CONT = "QMAKE_LFLAGS = -lavutil -lavcodec -lavformat -lswscale"
#config_avresample: AV_PRF_CONT = "QMAKE_LFLAGS = -lavresample"
#config_swresample: AV_PRF_CONT = "QMAKE_LFLAGS = -lswresample"
Expand Down
6 changes: 4 additions & 2 deletions widgets/libQtAVWidgets.pri
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 51,7 @@ eval(LIB$$upper($$NAME)_PRI_INCLUDED = 1)
LIB_VERSION = $$QTAV_VERSION #0.x.y may be wrong for dll
# If user haven't supplied STATICLINK, then auto-detect
isEmpty(STATICLINK) {
contains(CONFIG, staticlib) {
static|contains(CONFIG, staticlib) {
STATICLINK = 1
} else {
STATICLINK = 0
Expand All @@ -60,6 60,8 @@ isEmpty(STATICLINK) {
# in iOS 8.1.
ios:STATICLINK = 1
}
isEqual(STATICLINK, 1):DEFINES = BUILD_$$upper($$NAME)_STATIC

TEMPLATE = fakelib
PROJECT_TARGETNAME = $$qtLibraryTarget($$NAME)
TEMPLATE -= fakelib
Expand Down Expand Up @@ -109,7 111,7 @@ DEPENDPATH *= $$PROJECT_SRCPATH
isEqual(STATICLINK, 1) {
CONFIG -= shared dll ##otherwise the following shared is true, why?
CONFIG *= staticlib
} else {
} else {
CONFIG *= shared #shared includes dll
}

Expand Down
1 change: 0 additions & 1 deletion widgets/libQtAVWidgets.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 13,6 @@ greaterThan(QT_MAJOR_VERSION, 4) {
}
}
CONFIG *= qtavwidgets-buildlib
staticlib: DEFINES = BUILD_QTAVWIDGETS_STATIC

INCLUDEPATH = $$[QT_INSTALL_HEADERS]
#release: DEFINES = QT_NO_DEBUG_OUTPUT
Expand Down

0 comments on commit 9d49102

Please sign in to comment.