From a16c2f6e25459951798d47df079ddaa7be41400a Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 21 Jun 2011 16:02:15 +0200 Subject: using cmake instead of qmake --- .gitignore | 18 +++++------------- CMakeLists.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ build.sh | 33 +++++++++++++++++++++++++++++++-- src/testApp.sh | 41 ----------------------------------------- testApp.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 56 deletions(-) create mode 100644 CMakeLists.txt mode change 100644 => 100755 build.sh delete mode 100755 src/testApp.sh create mode 100755 testApp.sh diff --git a/.gitignore b/.gitignore index f15f5f8..a39b01f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,6 @@ -fbgui -*.o -*~ core *.core -moc_*.* -ui_*.* -qrc_*.* -*.swp -*.swo -debug -.project -.cproject -.metadata +build Makefile -Makefile.* +.cproject +.project +*.swp +update_fbgui.sh diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d9411fd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 2.8) + +project(fbgui) + +find_package(Qt4 REQUIRED) +if (QT4_FOUND) + message(STATUS "QT4 found.") +else(QT4_FOUND) + message(FATAL_ERROR "QT4 not found!") +endif(QT4_FOUND) + +#find_package(Qxt REQUIRED) + +set(QT_USE_QTNETWORK TRUE) +set(QT_USE_QTWEBKIT TRUE) + +file(GLOB_RECURSE FBGUI_SOURCES src/*.cpp) +file(GLOB_RECURSE FBGUI_MOC_HEADERS src/*.h) +file(GLOB_RECURSE FBGUI_UIS src/*.ui) +file(GLOB_RECURSE FBGUI_RCS src/*.qrc) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} + /usr/local/Qxt/include/QxtCore + /usr/include/sysfs + /usr/include/libusb-1.0) +include(${QT_USE_FILE}) +add_definitions(${QT_DEFINITIONS}) + +link_directories(/usr/local/Qxt/lib /usr/lib) + +QT4_ADD_RESOURCES(FBGUI_RC_SOURCES ${FBGUI_RCS}) +QT4_WRAP_UI(FBGUI_UI_HEADERS ${FBGUI_UIS}) +QT4_WRAP_CPP(FBGUI_MOC_SOURCES ${FBGUI_MOC_HEADERS}) + +add_executable(fbgui + ${FBGUI_SOURCES} + ${FBGUI_MOC_SOURCES} + ${FBGUI_UI_HEADERS} + ${FBGUI_RC_SOURCES}) + +target_link_libraries(fbgui + ${QT_LIBRARIES} + QxtCore qjson sysfs usb-1.0) diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 4ed283b..cda70f2 --- a/build.sh +++ b/build.sh @@ -1,2 +1,31 @@ -#!/bin/bash -# TODO auto-compiler with cmake +#!/bin/sh +# fbsplash builder script for cmake +DIR=$(pwd) +BUILDDIR=build + +# if --clean, remove build dir +if [ "$1" = "--clean" ] +then + rm -rf $BUILDDIR + echo "$BUILDDIR removed." + exit 1 +fi + +if [ ! -f CMakeLists.txt ] +then + echo "No CMakeLists.txt found." + echo "Run this script from the folder containing CMakeLists.txt." + exit 1 +fi + +# make build dir if its not there +[ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR + +cd $BUILDDIR +# use cmake to create Makefile +echo "Invoking cmake ..." +cmake "$DIR" +echo "Invoking make ..." +make + +cd $DIR diff --git a/src/testApp.sh b/src/testApp.sh deleted file mode 100755 index 9b46385..0000000 --- a/src/testApp.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# Script now simply passes all arguments to the fbgui call. -# Use: ./testApp.sh [OPTIONS] -# OPTIONS: -# -h, --help prints help -# -D , --debug= sets debug level [0,1] -# -u , --url= sets URL to load -# -d , --download= sets download directory -# -c , --config= sets path to config file -# -t , --trigger= sets path to file triggering URL load -# -s , --serial= sets path to serial number file -# -# Note: all path are expected to be absolute. - -# clean /tmp/fbgui -rm -rf /tmp/fbgui -rm /tmp/fbgui_trigger - -# path to script (including script name) -script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")" - -# to get the path only: use dirname which strips the filename from a path -working_path=`dirname "$script_path"` - -# construct unique display_id based on user, needed for multi-user qvfb usage -display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}') - -# Start QT's virtual framebuffer with proper display_id -/usr/local/Trolltech/Qt-4.7.2/bin/qvfb -width 1024 -height 768 -qwsdisplay :$display_id & -# quick sleep to wait for qvfb loading -sleep 0.2 -# Start fbgui connecting to QVFb with display_id from above. -$working_path/fbgui -display QVFb:$display_id $@ -# Check if fbbrowser is not running, if so kill the qvfb. -if [ $(ps aux | grep -v grep | grep -c fbgui) -eq 1 ] -then - echo "fbgui is still running ..." -else - echo "fbgui stopped running, killing qvfb ..." - killall qvfb -fi diff --git a/testApp.sh b/testApp.sh new file mode 100755 index 0000000..e1f1d1e --- /dev/null +++ b/testApp.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# Script now simply passes all arguments to the fbgui call. +# Use: ./testApp.sh [OPTIONS] +# OPTIONS: +# -h, --help prints help +# -D , --debug= sets debug level [0,1] +# -u , --url= sets URL to load +# -d , --download= sets download directory +# -c , --config= sets path to config file +# -t , --trigger= sets path to file triggering URL load +# -s , --serial= sets path to serial number file +# +# Note: all path are expected to be absolute. + +# clean /tmp/fbgui +rm -rf /tmp/fbgui +rm /tmp/fbgui_trigger + +# path to script (including script name) +script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")" + +# to get the path only: use dirname which strips the filename from a path +working_path=`dirname "$script_path"` + +# construct unique display_id based on user, needed for multi-user qvfb usage +display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}') + +# Start QT's virtual framebuffer with proper display_id +/usr/local/Trolltech/Qt-4.7.2/bin/qvfb -width 1024 -height 768 -qwsdisplay :$display_id & +# quick sleep to wait for qvfb loading +sleep 0.2 +# Start fbgui connecting to QVFb with display_id from above. +$working_path/build/fbgui -display QVFb:$display_id $@ +# Check if fbbrowser is not running, if so kill the qvfb. +if [ $(ps aux | grep -v grep | grep -c fbgui) -eq 1 ] +then + echo "fbgui is still running ..." +else + echo "fbgui stopped running, killing qvfb ..." + killall qvfb +fi -- cgit v1.2.3-55-g7522