Browse Source

updated build environment

- better handling of variables across files though cache stack
- partial rewrite to make use of it
- out of tree building
- release and debug build are better separated
tags/1.3
Sven Oliver Moll 1 year ago
parent
commit
3b8df1e404
6 changed files with 59 additions and 49 deletions
  1. 18
    7
      Makefile
  2. 0
    4
      TODO
  3. 1
    1
      packaging/debian/fridgegrid.install
  4. 8
    37
      src/buildconfig.pri
  5. 1
    0
      src/fridgegrid/fridgegrid.pro
  6. 31
    0
      src/src.pro

+ 18
- 7
Makefile View File

@@ -1,17 +1,28 @@

QMAKE ?= qmake
BUILDDIR = build

all: release

debug release: src/Makefile
make -C src $@
.PHONY: debug release

src/Makefile:
(cd src;$(QMAKE) -r CONFIG+=debug_and_release)
release: $(BUILDDIR)-release/Makefile
+make -C $(BUILDDIR)-release all

clean:
[ ! -f src/Makefile ] || make -C src distclean
rm -rf build
debug: $(BUILDDIR)-debug/Makefile
+make -C $(BUILDDIR)-debug all

$(BUILDDIR)-release/Makefile: $(BUILDDIR)-release
(cd $(BUILDDIR)-release;$(QMAKE) -r CONFIG+=release CONFIG-=debug CONFIG-=debug_and_release ../src/src.pro)

$(BUILDDIR)-debug/Makefile: $(BUILDDIR)-debug
(cd $(BUILDDIR)-debug;$(QMAKE) -r CONFIG+=debug CONFIG-=release CONFIG-=debug_and_release ../src/src.pro)

$(BUILDDIR)-release $(BUILDDIR)-debug:
mkdir -p $@

distclean clean:
rm -rf $(BUILDDIR)-release $(BUILDDIR)-debug

exe:
(cd packaging/windows ; ./build-cross.sh)

+ 0
- 4
TODO View File

@@ -1,4 +0,0 @@

- "new" in file menu
- templates


+ 1
- 1
packaging/debian/fridgegrid.install View File

@@ -1,3 +1,3 @@
build/release/bin/fridgegrid usr/bin
build-release/bin/fridgegrid usr/bin
debian/fridgegrid.png usr/share/icons
debian/fridgegrid.desktop usr/share/applications

+ 8
- 37
src/buildconfig.pri View File

@@ -4,54 +4,25 @@
# released as public domain
#############################################################################

contains(QT_VERSION, ^4\\.[0-3]\\..*) {
message("Cannot build this software with Qt version $${QT_VERSION}.")
error("Use at least Qt 4.4.")
}

count( TOPSRC, 0 ) {
TOPSRC = ".."
}
BUILDDIR = $${TOPSRC}/..

count( TARGET, 0 ) {
error(TARGET not set $$TARGET)
}

build_pass:CONFIG(release, debug|release) {
TARGETARCH = "release"
} else {
TARGETARCH = "debug"
}

contains(TEMPLATE,app) {
contains( TEMPLATE, app ) {
is_test = $$find( OUT_PWD, "/tests/" )
count( is_test, 1 ) {
DESTDIR = $${BUILDDIR}/build/$${TARGETARCH}/test
DESTDIR = $${TESTDIR}
} else {
DESTDIR = $${BUILDDIR}/build/$${TARGETARCH}/bin
DESTDIR = $${BINDIR}
}
} else {
contains( CONFIG, plugin ) {
DESTDIR = $${BUILDDIR}/build/$${TARGETARCH}/lib
DESTDIR = $${DLLDIR}
} else {
DESTDIR = $${BUILDDIR}/build/$${TARGETARCH}/tmp/lib
DESTDIR = $${LIBDIR}
}
}
LIBS += -L$${BUILDDIR}/build/$${TARGETARCH}/tmp/lib

DLLDESTDIR = $${BUILDDIR}/build/$${TARGETARCH}/lib
MOC_DIR = $${BUILDDIR}/build/$${TARGETARCH}/tmp/$${TARGET}/moc
OBJECTS_DIR = $${BUILDDIR}/build/$${TARGETARCH}/tmp/$${TARGET}/objs
RCC_DIR = $${BUILDDIR}/build/$${TARGETARCH}/tmp/$${TARGET}/rcc
UI_DIR = $${BUILDDIR}/build/$${TARGETARCH}/tmp/$${TARGET}/ui
UI_HEADERS_DIR = $${BUILDDIR}/build/$${TARGETARCH}/tmp/$${TARGET}/ui_headers
UI_SOURCES_DIR = $${BUILDDIR}/build/$${TARGETARCH}/tmp/$${TARGET}/ui_sources

contains( QMAKE_CXX, g++ ) {
QMAKE_CXXFLAGS_DEBUG += -pedantic -Wno-long-long
QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
QMAKE_CXXFLAGS_DEBUG += -pedantic -Wall -Wno-long-long
QMAKE_CXXFLAGS_RELEASE += -ffunction-sections -fdata-sections
!macx {
QMAKE_LFLAGS += -Wl,--gc-sections -rdynamic
QMAKE_LFLAGS_RELEASE += -Wl,--gc-sections -rdynamic
}
}

+ 1
- 0
src/fridgegrid/fridgegrid.pro View File

@@ -4,6 +4,7 @@ TEMPLATE = app
QT += xml widgets

include ( ../buildconfig.pri )
DESTDIR = $${BINDIR}

RESOURCES += ../resources/FridgeGrid.qrc
#TRANSLATIONS += Translations/otts_de.ts

+ 31
- 0
src/src.pro View File

@@ -1,5 +1,36 @@

# only allow out of tree builds (like qt creator)
equals( _PRO_FILE_PWD_, $${OUT_PWD} ) {
error( "in-tree builds are prohibited." );
}

# define common directories
BINDIR = $${OUT_PWD}/bin
LIBDIR = $${OUT_PWD}/tmp/lib
DLLDIR = $${OUT_PWD}/dll
TESTDIR = $${OUT_PWD}/test
TOOLSDIR = $${OUT_PWD}/tools

# make sure they exist
#mkpath( $${BINDIR} )
#mkpath( $${LIBDIR} )
#mkpath( $${DLLDIR} )
#mkpath( $${TESTDIR} )
#mkpath( $${TOOLSDIR} )

# store them for subdirs to use
cache( BINDIR, set stash, BINDIR )
cache( LIBDIR, set stash, LIBDIR )
cache( DLLDIR, set stash, DLLDIR )
cache( TESTDIR, set stash, TESTDIR )
cache( TOOLSDIR, set stash, TOOLSDIR )

# make sure that selfbuilt libs are available everywhere
LIBSPATH = -L$${LIBDIR}
cache( LIBS, add stash, LIBSPATH )

TEMPLATE = subdirs

SUBDIRS += fridgegrid

message( building for config $$CONFIG )

Loading…
Cancel
Save