qmake cleanup (#43)

* cleanup: get the include and lib path from r2

* clean up of the main project file

* check if r2 is available

* corrected r2 binary name m(

* qmake error if libr not found

Because the project won't build if r2 or the paths are not found emit
an error

* removed comments and unused variable

* Add 'make install' for AppImage

* Use 'make install' in travis build
This commit is contained in:
C. Balles 2017-04-06 10:29:36 +02:00 committed by Hugo Teso
parent b2bebb9821
commit 5032c9104d
3 changed files with 110 additions and 58 deletions

View File

@ -19,14 +19,7 @@ script:
- mkdir build ; cd build
- qmake PREFIX=/usr ../src
- make -j4
- # make install does not work, so do it by hand
- # sudo make INSTALL_ROOT=appdir install ; sudo chown -R $USER appdir ; find appdir/
- mkdir -p appdir/usr/bin
- mkdir -p appdir/usr/share/applications
- cp iaito appdir/usr/bin
- cp ../src/img/logo-small.png appdir/iaito.png
- cp ../src/iaito.desktop appdir/
- cp ../src/iaito.desktop appdir/usr/share/applications/
- sudo make INSTALL_ROOT=appdir install ; sudo chown -R $USER appdir ; find appdir/
after_success:
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"

View File

@ -1,14 +1,7 @@
#-------------------------------------------------
#
# Project created by QtCreator 2014-02-27T11:31:27
#
#-------------------------------------------------
ICON = img/Enso.icns
# No idea what this does exactly
TEMPLATE = app
TARGET = iaito
# The application version
win32 {
VERSION = 1.0
@ -16,34 +9,27 @@ win32 {
VERSION = 1.0-dev
}
ICON = img/Enso.icns
QT += core gui webkit webkitwidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT_CONFIG -= no-pkg-config
CONFIG += c++11
# Define the preprocessor macro to get the application version in our application.
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
QT += core gui webkit webkitwidgets
QT_CONFIG -= no-pkg-config
macx {
QMAKE_CXXFLAGS = -mmacosx-version-min=10.7 -std=gnu0x -stdlib=libc++
EXTSO=dylib
} else {
win32 {
EXTSO=dll
} else {
EXTSO=so
}
QMAKE_CXXFLAGS = -mmacosx-version-min=10.7 -std=gnu0x -stdlib=libc++
}
CONFIG += c++11
INCLUDEPATH *= .
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = iaito
TEMPLATE = app
INCLUDEPATH += ./
SOURCES += main.cpp\
mainwindow.cpp \
SOURCES += \
main.cpp \
mainwindow.cpp \
newfiledialog.cpp \
optionsdialog.cpp \
highlighter.cpp \
@ -77,7 +63,8 @@ SOURCES += main.cpp\
dialogs/xrefsdialog.cpp \
hexhighlighter.cpp
HEADERS += mainwindow.h \
HEADERS += \
mainwindow.h \
newfiledialog.h \
optionsdialog.h \
highlighter.h \
@ -112,7 +99,8 @@ HEADERS += mainwindow.h \
widgets/banned.h \
hexhighlighter.h
FORMS += mainwindow.ui \
FORMS += \
mainwindow.ui \
newfiledialog.ui \
optionsdialog.ui \
createnewdialog.ui \
@ -136,22 +124,38 @@ FORMS += mainwindow.ui \
RESOURCES += \
resources.qrc
win32 {
DEFINES += _CRT_NONSTDC_NO_DEPRECATE
DEFINES += _CRT_SECURE_NO_WARNINGS
INCLUDEPATH += "$$PWD/../iaito_win32/include"
INCLUDEPATH += "$$PWD/../iaito_win32/radare2/include/libr"
!contains(QMAKE_HOST.arch, x86_64) {
LIBS += -L"$$PWD/../iaito_win32/radare2/lib32"
} else {
LIBS += -L"$$PWD/../iaito_win32/radare2/lib64"
}
} else {
#INCLUDEPATH += /usr/local/radare2/osx/include/libr
INCLUDEPATH += /usr/local/include/libr
INCLUDEPATH += /usr/include/libr
#LIBS += -L/usr/local/radare2/osx/lib -lr_core -lr_config -lr_cons -lr_io -lr_util -lr_flag -lr_asm -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_socket -lr_fs -lr_magic -lr_crypto
LIBS += -L/usr/local/lib
}
include(lib_radare2.pri)
LIBS += -lr_core -lr_config -lr_cons -lr_io -lr_util -lr_flag -lr_asm -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_socket -lr_fs -lr_magic -lr_crypto
# 'make install' for AppImage
unix {
isEmpty(PREFIX) {
PREFIX = /usr/local
DEFAULT_PREFIX = true
}
desktop_file = iaito.desktop
# built-in no need for files atm
target.path = $$PREFIX/bin
share_applications.path = $$PREFIX/share/applications
share_applications.files = $$desktop_file
# TODO:
# iaito.png should be copied to $PREFIX/share/icons/$WIDTHx$HEIGHT
INSTALLS += target share_applications
# if a custom PREFIX is supplied, we asume it's an AppImage install
!defined(DEFAULT_PREFIX, var) {
# UGLY work around for the logo name in iaito.desktop
# Would be better to have a file called iaito.png in the first place
system(cp img/logo-small.png $$OUT_PWD/iaito.png)
appimage_root.path = /
appimage_root.files = $$OUT_PWD/iaito.png $$desktop_file
INSTALLS += appimage_root
}
}

55
src/lib_radare2.pri Normal file
View File

@ -0,0 +1,55 @@
win32 {
DEFINES += _CRT_NONSTDC_NO_DEPRECATE
DEFINES += _CRT_SECURE_NO_WARNINGS
INCLUDEPATH += "$$PWD/../iaito_win32/include"
INCLUDEPATH += "$$PWD/../iaito_win32/radare2/include/libr"
!contains(QMAKE_HOST.arch, x86_64) {
LIBS += -L"$$PWD/../iaito_win32/radare2/lib32"
} else {
LIBS += -L"$$PWD/../iaito_win32/radare2/lib64"
}
} else {
# check if r2 is available
system(r2 > /dev/null 2>&1) {
# see https://github.com/hteso/iaito/pull/5#issuecomment-290433796
RADARE2_INCLUDE_PATH = $$system(r2 -H | grep INCDIR | sed 's/[^=]*=//')
RADARE2_LIB_PATH = $$system(r2 -H | grep LIBDIR | sed 's/[^=]*=//')
!isEmpty(RADARE2_INCLUDE_PATH) {
INCLUDEPATH *= $$RADARE2_INCLUDE_PATH
LIBS *= -L$$RADARE2_LIB_PATH
} else {
error("sorry could not find radare2 lib")
}
} else {
error("r2 not found/in path")
}
}
LIBS += \
-lr_core \
-lr_config \
-lr_cons \
-lr_io \
-lr_util \
-lr_flag \
-lr_asm \
-lr_debug \
-lr_hash \
-lr_bin \
-lr_lang \
-lr_io \
-lr_anal \
-lr_parse \
-lr_bp \
-lr_egg \
-lr_reg \
-lr_search \
-lr_syscall \
-lr_socket \
-lr_fs \
-lr_magic \
-lr_crypto