Building QScintilla framework on macOS: Difference between revisions
m (Kylinsage moved page Building Scintilla framework on Mac OS X to Building QScintilla framework on Mac OS X) |
(Gather items into a category:Build.) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Build]] | |||
By default, dynamic libraries files(.dylib) are generated after building the QScintilla project. For Qt libraries are built in form of frameworks by default, we will creating QScintilla framework here. | |||
Modify Qt4Qt5/qscintilla.pro | |||
Change the line: | |||
CONFIG += qt warn_off release thread exceptions | |||
to: | |||
CONFIG += qt warn_off release thread exceptions lib_bundle | |||
==Build and install== | |||
/usr/local/Qt/4.8.7/bin/qmake # Qt is located in /usr/local/Qt/4.8.7 | |||
make | |||
make install | |||
cp -f -R /path/to/src/Qt4Qt5/Qsci /usr/local/Qt/4.8.7/include/ | |||
cp -f /path/to/src/Qt4Qt5/qscintilla_cs.qm /usr/local/Qt/4.8.7/translations/ | |||
cp -f /path/to/src/Qt4Qt5/qscintilla_de.qm /usr/local/Qt/4.8.7/translations/ | |||
cp -f /path/to/srcqscintilla_es.qm /usr/local/Qt/4.8.7/translations/ | |||
cp -f /path/to/src/Qt4Qt5/qscintilla_fr.qm /usr/local/Qt/4.8.7/translations/ | |||
cp -f /path/to/src/Qt4Qt5/qscintilla_pt_br.qm /usr/local/Qt/4.8.7/translations/ | |||
cp -f -R /path/to/srcqsci /usr/local/Qt/4.8.7/ | |||
rm -f -r "/usr/local/Qt/4.8.7/lib/qscintilla2.framework" | |||
cp -f -R "qscintilla2.framework" "/usr/local/Qt/4.8.7/lib/qscintilla2.framework" | |||
cp -f /path/to/srcQt4Qt5/features/qscintilla2.prf /usr/local/Qt/4.8.7/mkspecs/features/ | |||
==Build example-Qt4Qt5== | |||
Because we have built qscintilla2.framework, not qscintilla2.dylib,it is required to change applicatioin.pro: | |||
CONFIG += release qscintilla2 | |||
macx { | |||
QMAKE_POST_LINK = install_name_tool -change libqscintilla2.12.dylib $$[QT_INSTALL_LIBS]/libqscintilla2.12.dylib $(TARGET) | |||
} | |||
HEADERS = mainwindow.h | |||
SOURCES = main.cpp mainwindow.cpp | |||
RESOURCES = application.qrc | |||
to: | |||
CONFIG += release | |||
macx { | |||
LIBS += -framework qscintilla2 | |||
} | |||
HEADERS = mainwindow.h | |||
SOURCES = main.cpp mainwindow.cpp | |||
RESOURCES = application.qrc | |||
then, we compile: | |||
/usr/local/Qt/4.8.7/bin/qmake | |||
make | |||
Run the program: | |||
open application.app | |||
We encounter error: | |||
LSOpenURLsWithRole() failed with error -10810 for the file /Users/frankshong/Studio/Qt/3rd_party/QScintilla/QScintillaQt4/example-Qt4Qt5/application.app. | |||
View dependencies with otool -L | |||
otool -L application.app/Contents/MacOS/application | |||
application.app/Contents/MacOS/application: | |||
qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0) | |||
/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7) | |||
/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7) | |||
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0) | |||
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0) | |||
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0) | |||
By default, OS X searches framework in /Library/Frameworks, but qscintilla2.framework is located in Qt directory. So we must specify the path. | |||
Change library path with nstall_name_tool | |||
install_name_tool -change qscintilla2.framework/Versions/12/qscintilla2 /usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2 | |||
application.app/Contents/MacOS/application | |||
View depencies again: | |||
otool -L application.app/Contents/MacOS/application | |||
application.app/Contents/MacOS/application: | |||
/usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0) | |||
/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7) | |||
/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7) | |||
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0) | |||
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0) | |||
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0) | |||
All right. Now we run: | |||
open application.app | |||
To deploy the program, run: | |||
macdeployqt application.app |
Latest revision as of 15:12, 25 November 2016
By default, dynamic libraries files(.dylib) are generated after building the QScintilla project. For Qt libraries are built in form of frameworks by default, we will creating QScintilla framework here.
Modify Qt4Qt5/qscintilla.pro
Change the line:
CONFIG += qt warn_off release thread exceptions
to:
CONFIG += qt warn_off release thread exceptions lib_bundle
Build and install
/usr/local/Qt/4.8.7/bin/qmake # Qt is located in /usr/local/Qt/4.8.7
make
make install
cp -f -R /path/to/src/Qt4Qt5/Qsci /usr/local/Qt/4.8.7/include/
cp -f /path/to/src/Qt4Qt5/qscintilla_cs.qm /usr/local/Qt/4.8.7/translations/
cp -f /path/to/src/Qt4Qt5/qscintilla_de.qm /usr/local/Qt/4.8.7/translations/
cp -f /path/to/srcqscintilla_es.qm /usr/local/Qt/4.8.7/translations/
cp -f /path/to/src/Qt4Qt5/qscintilla_fr.qm /usr/local/Qt/4.8.7/translations/
cp -f /path/to/src/Qt4Qt5/qscintilla_pt_br.qm /usr/local/Qt/4.8.7/translations/
cp -f -R /path/to/srcqsci /usr/local/Qt/4.8.7/
rm -f -r "/usr/local/Qt/4.8.7/lib/qscintilla2.framework"
cp -f -R "qscintilla2.framework" "/usr/local/Qt/4.8.7/lib/qscintilla2.framework"
cp -f /path/to/srcQt4Qt5/features/qscintilla2.prf /usr/local/Qt/4.8.7/mkspecs/features/
Build example-Qt4Qt5
Because we have built qscintilla2.framework, not qscintilla2.dylib,it is required to change applicatioin.pro:
CONFIG += release qscintilla2
macx {
QMAKE_POST_LINK = install_name_tool -change libqscintilla2.12.dylib $$[QT_INSTALL_LIBS]/libqscintilla2.12.dylib $(TARGET)
}
HEADERS = mainwindow.h
SOURCES = main.cpp mainwindow.cpp
RESOURCES = application.qrc
to:
CONFIG += release
macx {
LIBS += -framework qscintilla2
}
HEADERS = mainwindow.h
SOURCES = main.cpp mainwindow.cpp
RESOURCES = application.qrc
then, we compile:
/usr/local/Qt/4.8.7/bin/qmake
make
Run the program:
open application.app
We encounter error:
LSOpenURLsWithRole() failed with error -10810 for the file /Users/frankshong/Studio/Qt/3rd_party/QScintilla/QScintillaQt4/example-Qt4Qt5/application.app.
View dependencies with otool -L
otool -L application.app/Contents/MacOS/application
application.app/Contents/MacOS/application:
qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0)
/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7)
/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0)
By default, OS X searches framework in /Library/Frameworks, but qscintilla2.framework is located in Qt directory. So we must specify the path.
Change library path with nstall_name_tool
install_name_tool -change qscintilla2.framework/Versions/12/qscintilla2 /usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2 application.app/Contents/MacOS/application
View depencies again:
otool -L application.app/Contents/MacOS/application
application.app/Contents/MacOS/application:
/usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0)
/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7)
/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0)
All right. Now we run:
open application.app
To deploy the program, run:
macdeployqt application.app