mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Improve cross compile support and fix windows.c
This should make the Makefile much more robust when cross compiling. The windows.c code is now compile tested but not functionally tested. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
290ce56d01
commit
042c77c0fc
2 changed files with 12 additions and 9 deletions
14
Makefile
14
Makefile
|
@ -76,7 +76,7 @@ endif
|
||||||
# about it if it doesn't.
|
# about it if it doesn't.
|
||||||
LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null)
|
LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null)
|
||||||
|
|
||||||
LIBGTK = $(shell $(PKGCONFIG) --libs gtk+-2.0 glib-2.0 gconf-2.0)
|
LIBGTK = $(shell $(PKGCONFIG) --libs gtk+-2.0 glib-2.0)
|
||||||
LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERINCLUDES)
|
LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERINCLUDES)
|
||||||
LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
|
LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
|
||||||
|
|
||||||
|
@ -84,16 +84,18 @@ LIBXML2 = $(shell $(XML2CONFIG) --libs)
|
||||||
LIBXSLT = $(shell $(XSLCONFIG) --libs)
|
LIBXSLT = $(shell $(XSLCONFIG) --libs)
|
||||||
XML2CFLAGS = $(shell $(XML2CONFIG) --cflags)
|
XML2CFLAGS = $(shell $(XML2CONFIG) --cflags)
|
||||||
GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
|
GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
|
||||||
GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
|
|
||||||
GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
|
GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
|
||||||
CFLAGS += $(shell $(XSLCONFIG) --cflags)
|
CFLAGS += $(shell $(XSLCONFIG) --cflags)
|
||||||
|
|
||||||
UNAME := $(shell uname)
|
UNAME := $(shell $(CC) -v 2>&1 | grep Target | grep -E -o "linux|darwin|win")
|
||||||
|
|
||||||
ifeq ($(UNAME), Linux)
|
|
||||||
|
ifeq ($(UNAME), linux)
|
||||||
|
LIBGCONF2 = $(shell $(PKGCONFIG) --libs gconf-2.0)
|
||||||
|
GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
|
||||||
OSSUPPORT = linux
|
OSSUPPORT = linux
|
||||||
OSSUPPORT_CFLAGS = $(GTK2CFLAGS) $(GCONF2CFLAGS)
|
OSSUPPORT_CFLAGS = $(GTK2CFLAGS) $(GCONF2CFLAGS)
|
||||||
else ifeq ($(UNAME), Darwin)
|
else ifeq ($(UNAME), darwin)
|
||||||
OSSUPPORT = macos
|
OSSUPPORT = macos
|
||||||
OSSUPPORT_CFLAGS = $(GTK2CFLAGS)
|
OSSUPPORT_CFLAGS = $(GTK2CFLAGS)
|
||||||
else
|
else
|
||||||
|
@ -108,7 +110,7 @@ ifneq ($(strip $(LIBXSLT)),)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBDIVECOMPUTER) -lpthread
|
LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) -lpthread
|
||||||
|
|
||||||
OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
|
OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
|
||||||
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
|
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
|
||||||
|
|
|
@ -38,7 +38,7 @@ void subsurface_set_conf(char *name, pref_type_t type, const void *value)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PREF_BOOL:
|
case PREF_BOOL:
|
||||||
/* we simply store the value as DWORD */
|
/* we simply store the value as DWORD */
|
||||||
RegSetValueEx(hkey, TEXT(name), 0, REG_DWORD, (DWORD)value, 4);
|
RegSetValueEx(hkey, TEXT(name), 0, REG_DWORD, value, 4);
|
||||||
break;
|
break;
|
||||||
case PREF_STRING:
|
case PREF_STRING:
|
||||||
RegSetValueEx(hkey, TEXT(name), 0, REG_SZ, value, strlen(value));
|
RegSetValueEx(hkey, TEXT(name), 0, REG_SZ, value, strlen(value));
|
||||||
|
@ -47,6 +47,7 @@ void subsurface_set_conf(char *name, pref_type_t type, const void *value)
|
||||||
|
|
||||||
const void *subsurface_get_conf(char *name, pref_type_t type)
|
const void *subsurface_get_conf(char *name, pref_type_t type)
|
||||||
{
|
{
|
||||||
|
LONG success;
|
||||||
char *string;
|
char *string;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ const void *subsurface_get_conf(char *name, pref_type_t type)
|
||||||
string = malloc(80);
|
string = malloc(80);
|
||||||
len = 80;
|
len = 80;
|
||||||
success = RegQueryValueEx(hkey, TEXT(name), NULL, NULL,
|
success = RegQueryValueEx(hkey, TEXT(name), NULL, NULL,
|
||||||
(LPBYTE) string, &len );
|
(LPBYTE) string, (LPDWORD)&len );
|
||||||
if (success != ERROR_SUCCESS) {
|
if (success != ERROR_SUCCESS) {
|
||||||
/* that's what happens the first time we start - just return NULL */
|
/* that's what happens the first time we start - just return NULL */
|
||||||
free(string);
|
free(string);
|
||||||
|
@ -72,6 +73,6 @@ const void *subsurface_get_conf(char *name, pref_type_t type)
|
||||||
void subsurface_close_conf(void)
|
void subsurface_close_conf(void)
|
||||||
{
|
{
|
||||||
if (RegFlushKey(hkey) != ERROR_SUCCESS)
|
if (RegFlushKey(hkey) != ERROR_SUCCESS)
|
||||||
printf("RegFlushKey failed %ld\n");
|
printf("RegFlushKey failed \n");
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue