Fixed Windows compile with pre-compiled libraries

Added new variable EXTERNAL_LIB_DIR to specify path of external libraries
This commit is contained in:
thunder2 2018-05-07 07:30:29 +02:00
parent d9a75a9362
commit 38ac234862
2 changed files with 14 additions and 7 deletions

View File

@ -43,7 +43,7 @@ win32 {
OPENCV_VERSION = "341" OPENCV_VERSION = "341"
USE_PRECOMPILED_LIBS = USE_PRECOMPILED_LIBS =
for(lib, LIB_DIR) { for(lib, RS_LIB_DIR) {
#message(Scanning $$lib) #message(Scanning $$lib)
exists( $$lib/opencv/libopencv_core$${OPENCV_VERSION}.a) { exists( $$lib/opencv/libopencv_core$${OPENCV_VERSION}.a) {
isEmpty(USE_PRECOMPILED_LIBS) { isEmpty(USE_PRECOMPILED_LIBS) {

View File

@ -375,6 +375,11 @@ android-* {
} }
win32-g++ { win32-g++ {
!isEmpty(EXTERNAL_LIB_DIR) {
message(Use pre-compiled libraries in $${EXTERNAL_LIB_DIR}.)
PREFIX = $$system_path($$EXTERNAL_LIB_DIR)
}
PREFIX_MSYS2 = $$(MINGW_PREFIX) PREFIX_MSYS2 = $$(MINGW_PREFIX)
isEmpty(PREFIX_MSYS2) { isEmpty(PREFIX_MSYS2) {
message("MINGW_PREFIX is not set, attempting MSYS2 autodiscovery.") message("MINGW_PREFIX is not set, attempting MSYS2 autodiscovery.")
@ -389,22 +394,24 @@ win32-g++ {
PREFIX_MSYS2=$${TEMPTATIVE_MSYS2} PREFIX_MSYS2=$${TEMPTATIVE_MSYS2}
} }
isEmpty(PREFIX_MSYS2) { !isEmpty(PREFIX_MSYS2) {
error(Cannot find MSYS2 please set MINGW_PREFIX)
} else {
message(Found MSYS2: $${PREFIX_MSYS2}) message(Found MSYS2: $${PREFIX_MSYS2})
isEmpty(PREFIX) {
PREFIX = $$system_path($${PREFIX_MSYS2})
}
} }
} }
isEmpty(PREFIX) { isEmpty(PREFIX) {
PREFIX = $$system_path($${PREFIX_MSYS2}) error(PREFIX is not set. Set either EXTERNAL_LIB_DIR or PREFIX_MSYS2.)
} }
INCLUDEPATH *= $$system_path($${PREFIX}/include) INCLUDEPATH *= $$system_path($${PREFIX}/include)
INCLUDEPATH *= $$system_path($${PREFIX_MSYS2}/include) !isEmpty(PREFIX_MSYS2) : INCLUDEPATH *= $$system_path($${PREFIX_MSYS2}/include)
QMAKE_LIBDIR *= $$system_path($${PREFIX}/lib) QMAKE_LIBDIR *= $$system_path($${PREFIX}/lib)
QMAKE_LIBDIR *= $$system_path($${PREFIX_MSYS2}/lib) !isEmpty(PREFIX_MSYS2) : QMAKE_LIBDIR *= $$system_path($${PREFIX_MSYS2}/lib)
RS_BIN_DIR = $$system_path($${PREFIX}/bin) RS_BIN_DIR = $$system_path($${PREFIX}/bin)
RS_INCLUDE_DIR = $$system_path($${PREFIX}/include) RS_INCLUDE_DIR = $$system_path($${PREFIX}/include)