Simplified qmake usage and normalized build between make and qtcreator

This commit is contained in:
Michaël Lemaire 2013-10-06 23:04:04 +02:00
parent 039aaeb33b
commit f4e4c1def4
15 changed files with 69 additions and 254 deletions

2
.gitignore vendored
View file

@ -5,7 +5,7 @@
/gmon.out
/nbproject/
/output/
/src/*/Makefile.*
/src/*/Makefile
*.pro.user
*.pro.user.*
qrc_*.cpp

View file

@ -1,52 +1,25 @@
BUILDMODE=release
BUILDPATH=./build/${BUILDMODE}
QBUILDMODE=declarative_${BUILDMODE}
CC=gcc
MAKE=make -f Makefile.${BUILDMODE}
ifneq (,$(COMPILER))
CC=$(COMPILER)
endif
all:dirs makefiles
@+cd src/rendering && $(MAKE)
@+cd src/exploring && $(MAKE)
@+cd src/controlling && $(MAKE)
@+cd src/editing && $(MAKE)
@+cd src/testing && $(MAKE)
all:build
dirs:
mkdir -p ${BUILDPATH}/rendering
mkdir -p ${BUILDPATH}/exploring
mkdir -p ${BUILDPATH}/controlling
mkdir -p ${BUILDPATH}/editing
mkdir -p ${BUILDPATH}/testing
mkdir -p ${BUILDPATH}
makefiles:
@+cd src/rendering && qmake rendering.pro "CONFIG=$(QBUILDMODE)" -r -spec linux-clang
@+cd src/exploring && qmake exploring.pro "CONFIG=$(QBUILDMODE)" -r -spec linux-clang
@+cd src/controlling && qmake controlling.pro "CONFIG=$(QBUILDMODE)" -r -spec linux-clang
@+cd src/editing && qmake editing.pro "CONFIG=${QBUILDMODE}" -r -spec linux-clang
@+cd src/testing && qmake testing.pro "CONFIG=$(QBUILDMODE)" -r -spec linux-clang
clean:
@+cd src/rendering && qmake "CONFIG=$(QBUILDMODE)" && $(MAKE) clean
@+cd src/exploring && qmake "CONFIG=$(QBUILDMODE)" && $(MAKE) clean
@+cd src/controlling && qmake "CONFIG=$(QBUILDMODE)" && $(MAKE) clean
@+cd src/editing && qmake "CONFIG=${QBUILDMODE}" && $(MAKE) clean
@+cd src/testing && qmake "CONFIG=$(QBUILDMODE)" && $(MAKE) clean
rm -f ${BUILDPATH}/paysages-cli
rm -f ${BUILDPATH}/paysages-gui
rm -f ${BUILDPATH}/paysages-tests
rm -f ${BUILDPATH}/libpaysages_exploring.so*
rm -f ${BUILDPATH}/libpaysages_rendering.so*
makefiles:dirs
ifeq (${BUILDMODE}, release)
+make BUILDMODE=debug clean
rm -f src/rendering/Makefile*
rm -f src/exploring/Makefile*
rm -f src/controlling/Makefile*
rm -f src/editing/Makefile*
rm -f src/testing/Makefile*
@+cd ${BUILDPATH} && qmake ../../src/paysages.pro -r -spec linux-clang
else
@+cd ${BUILDPATH} && qmake ../../src/paysages.pro -r -spec linux-clang CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
endif
build:makefiles
@+cd ${BUILDPATH} && $(MAKE)
clean:makefiles
@+cd ${BUILDPATH} && $(MAKE) clean
ifeq (${BUILDMODE}, release)
make BUILDMODE=debug clean
endif
docs:
@ -58,30 +31,30 @@ debug:
release:
+make BUILDMODE=release all
tests: all
LD_LIBRARY_PATH=${BUILDPATH} CK_DEFAULT_TIMEOUT=30 ${BUILDPATH}/paysages-tests
tests:build
LD_LIBRARY_PATH=${BUILDPATH}/rendering CK_DEFAULT_TIMEOUT=30 ${BUILDPATH}/testing/paysages-tests
run_cli: all
LD_LIBRARY_PATH=${BUILDPATH} ${RUNNER} ${BUILDPATH}/paysages-cli
run_cli:build
LD_LIBRARY_PATH=${BUILDPATH}/rendering ${RUNNER} ${BUILDPATH}/controlling/paysages-cli
run: all
LD_LIBRARY_PATH=${BUILDPATH} ${RUNNER} ${BUILDPATH}/paysages-gui
run:build
LD_LIBRARY_PATH=${BUILDPATH}/rendering:${BUILDPATH}/exploring ${RUNNER} ${BUILDPATH}/editing/paysages-gui
profile: debug
LD_LIBRARY_PATH=build/debug perf record -g fp ./build/debug/paysages-gui
profile:debug
LD_LIBRARY_PATH=build/debug/rendering:build/debug/exploring perf record -g fp ./build/debug/paysages-gui
perf report -g
profile_cli: debug
LD_LIBRARY_PATH=build/debug perf record -g fp ./build/debug/paysages-cli
profile_cli:debug
LD_LIBRARY_PATH=build/debug/rendering perf record -g fp ./build/debug/paysages-cli
perf report -g
install:release
mkdir -p ${DESTDIR}/usr/bin
mkdir -p ${DESTDIR}/usr/lib
mkdir -p ${DESTDIR}/usr/share/paysages3d
cp build/release/paysages-gui ${DESTDIR}/usr/bin/paysages3d
cp build/release/libpaysages_exploring.so ${DESTDIR}/usr/lib/
cp build/release/libpaysages_rendering.so ${DESTDIR}/usr/lib/
cp build/release/editing/paysages-gui ${DESTDIR}/usr/bin/paysages3d
cp build/release/exploring/libpaysages_exploring.so ${DESTDIR}/usr/lib/
cp build/release/rendering/libpaysages_rendering.so ${DESTDIR}/usr/lib/
cp data/.paysages_data ${DESTDIR}/usr/share/paysages3d/
cp -r data/i18n ${DESTDIR}/usr/share/paysages3d/
cp -r data/images ${DESTDIR}/usr/share/paysages3d/
@ -92,4 +65,4 @@ deb:
DEBFULLNAME="Michael Lemaire" DEBEMAIL=paysages@thunderk.net dch -i -p -u low -D stable
debuild -b -us -uc
.PHONY:all clean release
.PHONY:all clean release build

View file

@ -1,11 +0,0 @@
INCLUDEPATH += ..
CONFIG(declarative_debug) {
DESTDIR = ../../build/debug/
MAKEFILE = Makefile.debug
} else {
DESTDIR = ../../build/release/
MAKEFILE = Makefile.release
DEFINES += NDEBUG
}

View file

@ -1,5 +1,3 @@
include(../common.pri)
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
@ -7,10 +5,13 @@ CONFIG -= qt
TARGET = paysages-cli
OBJECTS_DIR = $$DESTDIR/controlling/
INCLUDEPATH += $$PWD/..
DEPENDPATH += ..
linux-clang:LIBS += -L$$DESTDIR -lpaysages_rendering
CONFIG(release, debug|release): DEFINES += NDEBUG
SOURCES += main.c
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../rendering/release/ -lpaysages_rendering
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../rendering/debug/ -lpaysages_rendering
else:unix: LIBS += -L$$OUT_PWD/../rendering/ -lpaysages_rendering
DEPENDPATH += $$PWD/../rendering

View file

@ -1,5 +1,3 @@
include(../common.pri)
TEMPLATE = app
CONFIG += qt
@ -7,14 +5,22 @@ QT += core gui opengl
TARGET = paysages-gui
OBJECTS_DIR = $$DESTDIR/editing/
MOC_DIR = $$OBJECTS_DIR/moc/
DEPENDPATH += ..
linux-clang:LIBS += -L$$DESTDIR -lpaysages_rendering -lpaysages_exploring -lGLU
linux-clang:LIBS += -lGLU
win32:LIBS += ../../libpaysages.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0
TRANSLATIONS = ../../data/i18n/paysages_fr.ts
CONFIG(release, debug|release): DEFINES += NDEBUG
INCLUDEPATH += $$PWD/..
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../exploring/release/ -lpaysages_exploring
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../exploring/debug/ -lpaysages_exploring
else:unix: LIBS += -L$$OUT_PWD/../exploring/ -lpaysages_exploring
DEPENDPATH += $$PWD/../exploring
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../rendering/release/ -lpaysages_rendering
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../rendering/debug/ -lpaysages_rendering
else:unix: LIBS += -L$$OUT_PWD/../rendering/ -lpaysages_rendering
DEPENDPATH += $$PWD/../rendering
HEADERS += \
terrain/widgetheightmap.h \
@ -146,3 +152,5 @@ FORMS += \
RESOURCES += \
../../data/ui_pictures.qrc
TRANSLATIONS = ../../data/i18n/paysages_fr.ts

View file

@ -1,89 +0,0 @@
#include "chunk.h"
#include <stdlib.h>
struct ExplorerChunk
{
/* Links */
Renderer* renderer;
ColorProfile* color_profile;
/* Protected override */
ExplorerChunkOverride override;
/* Bounding box */
double xmin;
double xmax;
double ymin;
double ymax;
double zmin;
double zmax;
/* General status */
int reset_needed;
double distance_to_camera;
/* Tesselation */
Vector3* vertex_data;
int tessellation_max_size;
int tessellation_current_size;
double tessellation_step;
/* Texture */
/*GLuint texture_opengl_id;
int texture_changed;
int texture_current_size;
int texture_max_size;*/
};
ExplorerChunk* exporerChunkCreate(Renderer* renderer, ColorProfile* color_profile, ExplorerChunkOverride override)
{
ExplorerChunk* result;
result = malloc(sizeof(ExplorerChunk));
result->renderer = renderer;
result->color_profile = color_profile;
result->override = override;
result->xmin = 0.0;
result->xmax = 0.0;
result->ymin = 0.0;
result->ymax = 0.0;
result->zmin = 0.0;
result->zmax = 0.0;
result->reset_needed = 0;
result->distance_to_camera = 0.0;
result->vertex_data = malloc(sizeof(Vector3) * 4);
result->tessellation_max_size = 1;
result->tessellation_current_size = 0;
explorerChunkMarkForReset(result);
/* TODO Insert in chunk list */
return result;
}
void explorerChunkDelete(ExplorerChunk* chunk)
{
free(chunk);
}
void explorerChunkUpdateBoundingBox(ExplorerChunk* chunk, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
{
chunk->xmin = xmin;
chunk->xmax = xmax;
chunk->ymin = ymin;
chunk->ymax = ymax;
chunk->zmin = zmin;
chunk->zmax = zmax;
}
void explorerChunkMarkForReset(ExplorerChunk* chunk)
{
}

View file

@ -1,35 +0,0 @@
#ifndef _PAYSAGES_EXPLORING_CHUNK_H_
#define _PAYSAGES_EXPLORING_CHUNK_H_
#include "rendering/tools/euclid.h"
#include "rendering/tools/color.h"
#include "rendering/renderer.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ExplorerChunk ExplorerChunk;
typedef struct
{
void (*getStatus)(ExplorerChunk* chunk);
Vector3 (*getVertex)(ExplorerChunk* chunk, Renderer* renderer, double x, double y);
Color (*getColor)(ExplorerChunk* chunk, Renderer* renderer, double x, double y, Vector3 vertex);
void (*onBeforeDelete)(ExplorerChunk* chunk, void* private_data);
void* private_data;
} ExplorerChunkOverride;
/* Public methods */
ExplorerChunk* exporerChunkCreate(Renderer* renderer, ColorProfile* color_profile, ExplorerChunkOverride override);
void explorerChunkDelete(ExplorerChunk* chunk);
/* Methods to call from an updateStatus() callback only (never to be called twice concurrently on the same chunk) */
void explorerChunkUpdateBoundingBox(ExplorerChunk* chunk, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
void explorerChunkMarkForReset(ExplorerChunk* chunk);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,21 +1,14 @@
include(../common.pri)
QT += opengl
TEMPLATE = lib
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
TARGET = paysages_exploring
OBJECTS_DIR = $$DESTDIR/exploring/
CONFIG(release, debug|release): DEFINES += NDEBUG
SOURCES += main.c \
terrain.c \
sky.c \
chunk.c
INCLUDEPATH += $$PWD/..
HEADERS += main.h \
terrain.h \
sky.h \
chunk.h
SOURCES += main.c
HEADERS += main.h

View file

@ -1 +0,0 @@
#include "sky.h"

View file

@ -1,13 +0,0 @@
#ifndef _PAYSAGES_EXPLORING_SKY_H_
#define _PAYSAGES_EXPLORING_SKY_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1 +0,0 @@
#include "terrain.h"

View file

@ -1,13 +0,0 @@
#ifndef _PAYSAGES_EXPLORING_TERRAIN_H_
#define _PAYSAGES_EXPLORING_TERRAIN_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

3
src/paysages.pro Normal file
View file

@ -0,0 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = rendering exploring editing controlling testing

View file

@ -1,5 +1,3 @@
include(../common.pri)
TEMPLATE = lib
CONFIG += console
CONFIG -= app_bundle
@ -7,13 +5,14 @@ CONFIG -= qt
TARGET = paysages_rendering
OBJECTS_DIR = $$DESTDIR/rendering/
INCLUDEPATH += $$PWD/..
linux-clang {
CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 gthread-2.0 IL ILU
}
DEFINES += HAVE_GLIB=1
CONFIG(release, debug|release): DEFINES += NDEBUG
SOURCES += main.c \
tools.c \

View file

@ -1,5 +1,3 @@
include(../common.pri)
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
@ -7,15 +5,19 @@ CONFIG -= qt
TARGET = paysages-tests
OBJECTS_DIR = $$DESTDIR/testing/
CONFIG(release, debug|release): DEFINES += NDEBUG
linux-clang {
CONFIG += link_pkgconfig
PKGCONFIG += check
}
DEPENDPATH += ..
linux-clang:LIBS += -L$$DESTDIR -lpaysages_rendering
INCLUDEPATH += $$PWD/..
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../rendering/release/ -lpaysages_rendering
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../rendering/debug/ -lpaysages_rendering
else:unix: LIBS += -L$$OUT_PWD/../rendering/ -lpaysages_rendering
DEPENDPATH += $$PWD/../rendering
SOURCES += main.c \
test_terrain_painting.c \
@ -30,4 +32,3 @@ SOURCES += main.c \
HEADERS += \
common.h