diff --git a/.gitignore b/.gitignore index 4c01316..1b5c31b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ /gmon.out /nbproject/ /output/ -/src/*/Makefile.* +/src/*/Makefile *.pro.user *.pro.user.* qrc_*.cpp diff --git a/Makefile b/Makefile index 92a2e15..795d177 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/common.pri b/src/common.pri deleted file mode 100644 index 07d1312..0000000 --- a/src/common.pri +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDEPATH += .. - -CONFIG(declarative_debug) { - DESTDIR = ../../build/debug/ - MAKEFILE = Makefile.debug -} else { - DESTDIR = ../../build/release/ - MAKEFILE = Makefile.release - - DEFINES += NDEBUG -} diff --git a/src/controlling/controlling.pro b/src/controlling/controlling.pro index 672bc41..266dba0 100644 --- a/src/controlling/controlling.pro +++ b/src/controlling/controlling.pro @@ -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 diff --git a/src/editing/editing.pro b/src/editing/editing.pro index 4346502..bbb55fe 100644 --- a/src/editing/editing.pro +++ b/src/editing/editing.pro @@ -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 diff --git a/src/exploring/chunk.c b/src/exploring/chunk.c deleted file mode 100644 index d70e8dc..0000000 --- a/src/exploring/chunk.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "chunk.h" - -#include - -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) -{ - -} diff --git a/src/exploring/chunk.h b/src/exploring/chunk.h deleted file mode 100644 index 2f27c1c..0000000 --- a/src/exploring/chunk.h +++ /dev/null @@ -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 diff --git a/src/exploring/exploring.pro b/src/exploring/exploring.pro index b161513..c80145a 100644 --- a/src/exploring/exploring.pro +++ b/src/exploring/exploring.pro @@ -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 diff --git a/src/exploring/sky.c b/src/exploring/sky.c deleted file mode 100644 index 81d6d22..0000000 --- a/src/exploring/sky.c +++ /dev/null @@ -1 +0,0 @@ -#include "sky.h" diff --git a/src/exploring/sky.h b/src/exploring/sky.h deleted file mode 100644 index 6f6d502..0000000 --- a/src/exploring/sky.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _PAYSAGES_EXPLORING_SKY_H_ -#define _PAYSAGES_EXPLORING_SKY_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/exploring/terrain.c b/src/exploring/terrain.c deleted file mode 100644 index a0f24cd..0000000 --- a/src/exploring/terrain.c +++ /dev/null @@ -1 +0,0 @@ -#include "terrain.h" diff --git a/src/exploring/terrain.h b/src/exploring/terrain.h deleted file mode 100644 index d76f35b..0000000 --- a/src/exploring/terrain.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _PAYSAGES_EXPLORING_TERRAIN_H_ -#define _PAYSAGES_EXPLORING_TERRAIN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/paysages.pro b/src/paysages.pro new file mode 100644 index 0000000..24f99f1 --- /dev/null +++ b/src/paysages.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs + +SUBDIRS = rendering exploring editing controlling testing diff --git a/src/rendering/rendering.pro b/src/rendering/rendering.pro index a9ad638..879a063 100644 --- a/src/rendering/rendering.pro +++ b/src/rendering/rendering.pro @@ -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 \ diff --git a/src/testing/testing.pro b/src/testing/testing.pro index c95e195..be6e3da 100644 --- a/src/testing/testing.pro +++ b/src/testing/testing.pro @@ -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 -