Project directory structure

Dirk Hohndel dirk at hohndel.org
Tue Apr 2 13:23:11 PDT 2013


Tomaz Canabrava <tcanabrava at kde.org> writes:

> Alberto,
>
> I just pushed to my repo the modifications that Dirk asked, reduced the
> number of files, updated the mainwindow a bit. It's in a state that's
> 'workable', I tried to follow the codding style ( where did I failed? o.o )
>
> Please, edit the makefile for me :)

Yes, your Makefile has some "minor" issues. Like this part of the diff:

@@ -49,46 +54,9 @@ PRODVERSION_STRING := $(shell $(GET_VERSION) win $(VERSION_STRING) || \
 # subdirectories of /usr/local and /usr and then we give up. You can
 # override by simply setting it here
 #
-ifeq ($(CC), i686-w64-mingw32-gcc)
-# ok, we are cross building for Windows
-       LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
-       LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
-       RESFILE = packaging/windows/subsurface.res
-       LDFLAGS += -Wl,-subsystem,windows
-       LIBWINSOCK = -lwsock32
-else ifeq ($(UNAME), darwin)
-       LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
-       LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
-else
-libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a)
-libdc-local64 := $(wildcard /usr/local/lib64/libdivecomputer.a)
-libdc-usr := $(wildcard /usr/lib/libdivecomputer.a)
-libdc-usr64 := $(wildcard /usr/lib64/libdivecomputer.a)
-
-ifneq ($(LIBDCDEVEL),)
-       LIBDIVECOMPUTERDIR = ../libdivecomputer
-       LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
-       LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/src/.libs/libdivecomputer.a
-else ifneq ($(strip $(libdc-local)),)
-       LIBDIVECOMPUTERDIR = /usr/local
-       LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
-       LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
-else ifneq ($(strip $(libdc-local64)),)
-       LIBDIVECOMPUTERDIR = /usr/local
-       LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
-       LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
-else ifneq ($(strip $(libdc-usr)),)
-       LIBDIVECOMPUTERDIR = /usr
-       LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
-       LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
-else ifneq ($(strip $(libdc-usr64)),)
-       LIBDIVECOMPUTERDIR = /usr
-       LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
-       LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
-else
-$(error Cannot find libdivecomputer - please edit Makefile)
-endif
-endif
+LIBDIVECOMPUTERDIR = /home/tomaz/Projetos/libdivecomputer-binary
+LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
+LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
 
 # Libusb-1.0 is only required if libdivecomputer was built with it.
 # And libdivecomputer is only built with it if libusb-1.0 is


Admittedly, the code that tries to find libdivecomputer is ugly, but
just hardcoding the path... that's not nice.

A quick fix is to set

LIBDCDEVEL=TRUE

then it will link with the library in ../libdivecomputer

which works very nicely if you have libdivecomputer and subsurface both
next to each other under the same parent directory (which I think many
people will have). That way you don't need to install libdivecomputer at
all (and since it's statically linked there's no harm done).

/D


More information about the subsurface mailing list