forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QMAKE_RPATHDIR has different results on mac(4.x 5.x) and linux. now can run directly on mac
- Loading branch information
Showing
5 changed files
with
51 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 1,5 @@ | ||
# qmake common template pri file | ||
# Copyright (C) 2011-2013 Wang Bin <[email protected]> | ||
# Copyright (C) 2011-2015 Wang Bin <[email protected]> | ||
# Shanghai, China. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
|
@@ -55,6 55,8 @@ unix { | |
*maemo6*:_OS = _maemo6 | ||
} else:*meego*: _OS = _meego | ||
!isEmpty(MEEGO_EDITION): _OS = _$$MEEGO_EDITION | ||
# QMAKE_RPATHDIR will be ignored if QMAKE_LFLAGS_RPATH is not defined. e.g. qt4.8 unsupported/macx-clang-libc | ||
isEmpty(QMAKE_LFLAGS_RPATH): QMAKE_LFLAGS_RPATH=-Wl,-rpath, | ||
} else:wince* { | ||
_OS = _wince | ||
} else:win32 { #true for wince | ||
|
@@ -381,6 383,38 @@ defineReplace(system_path) { | |
return($$1) | ||
} | ||
} #lessThan(QT_MAJOR_VERSION, 5) | ||
|
||
# set default rpath and add user defined rpaths | ||
defineTest(set_rpath) { | ||
!unix: return(true) | ||
RPATHDIR = $$ARGS #see doc | ||
LIBS = -L/usr/local/lib | ||
# $$[QT_INSTALL_LIBS] and $$DESTDIR and pro dir will be auto added to QMAKE_RPATHDIR if QMAKE_RPATHDIR is not empty | ||
# Current (sub)project dir is auto added to the first value as prefix. e.g. QMAKE_RPATHDIR = .. ==> -Wl,-rpath,ROOT/.. | ||
# Executable dir search: ld -z origin, g -Wl,-R,'$ORIGIN', in makefile -Wl,-R,'$$ORIGIN' | ||
# Working dir search: "." | ||
# mac: install_name @rpath will search paths set in rpath link flags | ||
# QMAKE_RPATHDIR: lflags maybe wrong, paths are modified | ||
#isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
macx|ios { | ||
RPATHDIR *= @loader_path/../Frameworks @executable_path/../Frameworks | ||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/ | ||
} else { | ||
RPATHDIR *= \$\$ORIGIN \$\$ORIGIN/lib . /usr/local/lib $$[QT_INSTALL_LIBS] | ||
# $$PROJECT_LIBDIR only for host == target. But QMAKE_TARGET.arch is only available on windows. QT_ARCH is bad, e.g. QT_ARCH=i386 while QMAKE_HOST.arch=i686 | ||
# https://bugreports.qt-project.org/browse/QTBUG-30263 | ||
QMAKE_LFLAGS *= -Wl,-z,origin #\'-Wl,-rpath,$$join(RPATHDIR, ":")\' | ||
} | ||
for(R,RPATHDIR) { | ||
QMAKE_LFLAGS *= \'$${QMAKE_LFLAGS_RPATH}$$R\' | ||
} | ||
# QMAKE_RPATHDIR *= $$RPATHDIR | ||
#export(QMAKE_RPATHDIR) | ||
export(QMAKE_LFLAGS_SONAME) | ||
export(QMAKE_LFLAGS) | ||
return(true) | ||
} | ||
|
||
#argument 1 is default dir if not defined | ||
defineTest(getBuildRoot) { | ||
!isEmpty(2): unset(BUILD_DIR) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 1,5 @@ | ||
# qmake library building template pri file | ||
# Copyright (C) 2011-2013 Wang Bin <[email protected]> | ||
# Copyright (C) 2011-2015 Wang Bin <[email protected]> | ||
# Shanghai, China. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
|
@@ -131,25 131,10 @@ DEPENDPATH *= $$PROJECT_SRCPATH | |
} | ||
} | ||
|
||
unix { | ||
LIBS = -L/usr/local/lib | ||
# $$[QT_INSTALL_LIBS] and $$DESTDIR and pro dir will be auto added to QMAKE_RPATHDIR if QMAKE_RPATHDIR is not empty | ||
# Current (sub)project dir is auto added to the first value as prefix. e.g. QMAKE_RPATHDIR = .. ==> -Wl,-rpath,ROOT/.. | ||
# Executable dir search: ld -z origin, g -Wl,-R,'$ORIGIN', in makefile -Wl,-R,'$$ORIGIN' | ||
# Working dir search: "." | ||
# TODO: for macx. see qtcreator/src/rpath.pri. (-rpath define rpath, @rpath exapand to that path?) | ||
macx|ios { | ||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,$$PROJECT_LIBDIR/ | ||
#QMAKE_LFLAGS = -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../ | ||
} else { | ||
RPATHDIR = \$\$ORIGIN \$\$ORIGIN/lib . /usr/local/lib | ||
# $$PROJECT_LIBDIR only for host == target. But QMAKE_TARGET.arch is only available on windows. QT_ARCH is bad, e.g. QT_ARCH=i386 while QMAKE_HOST.arch=i686 | ||
# https://bugreports.qt-project.org/browse/QTBUG-30263 | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
QMAKE_LFLAGS *= -Wl,-z,origin \'-Wl,-rpath,$$join(RPATHDIR, ":")\' | ||
} | ||
} | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
set_rpath($$RPATHDIR) | ||
|
||
unset(RPATHDIR) | ||
unset(LIB_VERSION) | ||
unset(PROJECT_SRCPATH) | ||
unset(PROJECT_LIBDIR) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 1,5 @@ | ||
# qmake library building template pri file | ||
# Copyright (C) 2011-2013 Wang Bin <[email protected]> | ||
# Copyright (C) 2011-2015 Wang Bin <[email protected]> | ||
# Shanghai, China. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
|
@@ -129,25 129,10 @@ DEPENDPATH *= $$PROJECT_SRCPATH | |
} | ||
} | ||
|
||
unix { | ||
LIBS = -L/usr/local/lib | ||
# $$[QT_INSTALL_LIBS] and $$DESTDIR and pro dir will be auto added to QMAKE_RPATHDIR if QMAKE_RPATHDIR is not empty | ||
# Current (sub)project dir is auto added to the first value as prefix. e.g. QMAKE_RPATHDIR = .. ==> -Wl,-rpath,ROOT/.. | ||
# Executable dir search: ld -z origin, g -Wl,-R,'$ORIGIN', in makefile -Wl,-R,'$$ORIGIN' | ||
# Working dir search: "." | ||
# TODO: for macx. see qtcreator/src/rpath.pri. (-rpath define rpath, @rpath exapand to that path?) | ||
macx|ios { | ||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/Frameworks/ | ||
#QMAKE_LFLAGS = -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../ | ||
} else { | ||
RPATHDIR = \$\$ORIGIN \$\$ORIGIN/lib . /usr/local/lib | ||
# $$PROJECT_LIBDIR only for host == target. But QMAKE_TARGET.arch is only available on windows. QT_ARCH is bad, e.g. QT_ARCH=i386 while QMAKE_HOST.arch=i686 | ||
# https://bugreports.qt-project.org/browse/QTBUG-30263 | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
QMAKE_LFLAGS *= -Wl,-z,origin \'-Wl,-rpath,$$join(RPATHDIR, ":")\' | ||
} | ||
} | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
set_rpath($$RPATHDIR) | ||
|
||
unset(RPATHDIR) | ||
unset(LIB_VERSION) | ||
unset(PROJECT_SRCPATH) | ||
unset(PROJECT_LIBDIR) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 1,5 @@ | ||
# qmake library building template pri file | ||
# Copyright (C) 2011-2013 Wang Bin <[email protected]> | ||
# Copyright (C) 2011-2015 Wang Bin <[email protected]> | ||
# Shanghai, China. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
|
@@ -131,29 131,11 @@ DEPENDPATH *= $$PROJECT_SRCPATH | |
INSTALLS = target | ||
} | ||
} | ||
|
||
unix { | ||
LIBS = -L/usr/local/lib | ||
# $$[QT_INSTALL_LIBS] and $$DESTDIR and pro dir will be auto added to QMAKE_RPATHDIR if QMAKE_RPATHDIR is not empty | ||
# Current (sub)project dir is auto added to the first value as prefix. e.g. QMAKE_RPATHDIR = .. ==> -Wl,-rpath,ROOT/.. | ||
# Executable dir search: ld -z origin, g -Wl,-R,'$ORIGIN', in makefile -Wl,-R,'$$ORIGIN' | ||
# Working dir search: "." | ||
# TODO: for macx. see qtcreator/src/rpath.pri. (-rpath define rpath, @rpath exapand to that path?) | ||
macx|ios { | ||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,$$PROJECT_LIBDIR/ | ||
# 5.4 | ||
#QMAKE_LFLAGS = -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../ | ||
} else { | ||
RPATHDIR = \$\$ORIGIN \$\$ORIGIN/lib . /usr/local/lib $$[QT_INSTALL_LIBS] | ||
# $$PROJECT_LIBDIR only for host == target. But QMAKE_TARGET.arch is only available on windows. QT_ARCH is bad, e.g. QT_ARCH=i386 while QMAKE_HOST.arch=i686 | ||
# https://bugreports.qt-project.org/browse/QTBUG-30263 | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
QMAKE_LFLAGS *= -Wl,-z,origin \'-Wl,-rpath,$$join(RPATHDIR, ":")\' | ||
} | ||
} | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
set_rpath($$RPATHDIR) | ||
|
||
*maemo*: QMAKE_LFLAGS = -lasound | ||
|
||
unset(RPATHDIR) | ||
unset(LIB_VERSION) | ||
unset(PROJECT_SRCPATH) | ||
unset(PROJECT_LIBDIR) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 1,5 @@ | ||
# qmake library building template pri file | ||
# Copyright (C) 2011-2013 Wang Bin <[email protected]> | ||
# Copyright (C) 2011-2015 Wang Bin <[email protected]> | ||
# Shanghai, China. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
|
@@ -132,26 132,10 @@ DEPENDPATH *= $$PROJECT_SRCPATH | |
} | ||
} | ||
|
||
unix { | ||
LIBS = -L/usr/local/lib | ||
# $$[QT_INSTALL_LIBS] and $$DESTDIR and pro dir will be auto added to QMAKE_RPATHDIR if QMAKE_RPATHDIR is not empty | ||
# Current (sub)project dir is auto added to the first value as prefix. e.g. QMAKE_RPATHDIR = .. ==> -Wl,-rpath,ROOT/.. | ||
# Executable dir search: ld -z origin, g -Wl,-R,'$ORIGIN', in makefile -Wl,-R,'$$ORIGIN' | ||
# Working dir search: "." | ||
# TODO: for macx. see qtcreator/src/rpath.pri. (-rpath define rpath, @rpath exapand to that path?) | ||
macx|ios { | ||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,$$PROJECT_LIBDIR/ | ||
# 5.4 | ||
#QMAKE_LFLAGS = -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../ | ||
} else { | ||
RPATHDIR = \$\$ORIGIN \$\$ORIGIN/lib . /usr/local/lib $$[QT_INSTALL_LIBS] | ||
# $$PROJECT_LIBDIR only for host == target. But QMAKE_TARGET.arch is only available on windows. QT_ARCH is bad, e.g. QT_ARCH=i386 while QMAKE_HOST.arch=i686 | ||
# https://bugreports.qt-project.org/browse/QTBUG-30263 | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
QMAKE_LFLAGS *= -Wl,-z,origin \'-Wl,-rpath,$$join(RPATHDIR, ":")\' | ||
} | ||
} | ||
isEmpty(CROSS_COMPILE): RPATHDIR *= $$PROJECT_LIBDIR | ||
set_rpath($$RPATHDIR) | ||
|
||
unset(RPATHDIR) | ||
unset(LIB_VERSION) | ||
unset(PROJECT_SRCPATH) | ||
unset(PROJECT_LIBDIR) | ||
|