unify makefile, make win32 builds
This commit is contained in:
parent
0f1cc014d7
commit
d7c3bfd1f5
@ -1,5 +1,8 @@
|
||||
mode:regexp
|
||||
^build-qbolt-
|
||||
^dummy-data/dummy-data$
|
||||
^qbolt\.a$
|
||||
\.pro\.user$
|
||||
^build/
|
||||
|
||||
# Extra copy of built .a file, for IDE builds
|
||||
^qbolt/qbolt.a$
|
||||
|
40
Makefile
40
Makefile
@ -1,11 +1,43 @@
|
||||
|
||||
export PATH := /usr/lib/mxe/usr/bin:$(PATH)
|
||||
GOFLAGS := -ldflags='-s -w' -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: qbolt.a
|
||||
all: \
|
||||
qbolt/qbolt.a \
|
||||
build/linux/qbolt \
|
||||
build/win32/qbolt.exe
|
||||
|
||||
clean:
|
||||
if [ -f qbolt.a ] ; then rm qbolt.a ; fi
|
||||
if [ -f qbolt/qbolt.a ] ; then rm qbolt/qbolt.a ; fi
|
||||
if [ -f qbolt ] ; then rm qbolt ; fi
|
||||
if [ -d build ] ; then rm -r build ; fi
|
||||
|
||||
qbolt.a: *.go
|
||||
go build -ldflags='-s -w' -buildmode=c-archive -o qbolt.a
|
||||
# Build core golang shared library (linux)
|
||||
|
||||
build/linux/qbolt.a: *.go
|
||||
mkdir -p build/linux
|
||||
go build ${GOFLAGS} -buildmode=c-archive -o build/linux/qbolt.a
|
||||
|
||||
# Build core golang shared library (win32)
|
||||
|
||||
build/win32/qbolt.a: *.go
|
||||
mkdir -p build/win32
|
||||
CC=/usr/lib/mxe/usr/bin/i686-w64-mingw32.static-gcc CGO_ENABLED=1 GOARCH=386 GOOS=windows \
|
||||
go build ${GOFLAGS} -buildmode=c-archive -o build/win32/qbolt.a
|
||||
|
||||
# Copy shared library into place for builds straight out of the IDE
|
||||
|
||||
qbolt/qbolt.a: build/linux/qbolt.a
|
||||
cp build/linux/qbolt.a qbolt/qbolt.a
|
||||
|
||||
# Linux binaries
|
||||
|
||||
build/linux/qbolt: build/linux/qbolt.a qbolt/*
|
||||
cd build/linux && qmake ../../qbolt/qbolt.pro && make
|
||||
|
||||
# Windows binaries
|
||||
|
||||
build/win32/release/qbolt.exe: build/win32/qbolt.a qbolt/*
|
||||
cd build/win32 && i686-w64-mingw32.static-qmake-qt5 ../../qbolt/qbolt.pro && make
|
||||
|
111
qbolt.h
111
qbolt.h
@ -1,111 +0,0 @@
|
||||
/* Created by "go tool cgo" - DO NOT EDIT. */
|
||||
|
||||
/* package code.ivysaur.me/qbolt */
|
||||
|
||||
/* Start of preamble from import "C" comments. */
|
||||
|
||||
|
||||
|
||||
|
||||
/* End of preamble from import "C" comments. */
|
||||
|
||||
|
||||
/* Start of boilerplate cgo prologue. */
|
||||
|
||||
#ifndef GO_CGO_PROLOGUE_H
|
||||
#define GO_CGO_PROLOGUE_H
|
||||
|
||||
typedef signed char GoInt8;
|
||||
typedef unsigned char GoUint8;
|
||||
typedef short GoInt16;
|
||||
typedef unsigned short GoUint16;
|
||||
typedef int GoInt32;
|
||||
typedef unsigned int GoUint32;
|
||||
typedef long long GoInt64;
|
||||
typedef unsigned long long GoUint64;
|
||||
typedef GoInt64 GoInt;
|
||||
typedef GoUint64 GoUint;
|
||||
typedef __SIZE_TYPE__ GoUintptr;
|
||||
typedef float GoFloat32;
|
||||
typedef double GoFloat64;
|
||||
typedef float _Complex GoComplex64;
|
||||
typedef double _Complex GoComplex128;
|
||||
|
||||
/*
|
||||
static assertion to make sure the file is being used on architecture
|
||||
at least with matching size of GoInt.
|
||||
*/
|
||||
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
||||
|
||||
typedef struct { const char *p; GoInt n; } GoString;
|
||||
typedef void *GoMap;
|
||||
typedef void *GoChan;
|
||||
typedef struct { void *t; void *v; } GoInterface;
|
||||
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
||||
|
||||
#endif
|
||||
|
||||
/* End of boilerplate cgo prologue. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
extern GoInt64 GetMagic();
|
||||
|
||||
extern GoInt64 Bolt_Options_New();
|
||||
|
||||
extern GoInt64 Bolt_Options_New_Readonly();
|
||||
|
||||
/* Return type for Bolt_Open */
|
||||
struct Bolt_Open_return {
|
||||
GoInt64 r0;
|
||||
char* r1;
|
||||
GoInt r2;
|
||||
};
|
||||
|
||||
extern struct Bolt_Open_return Bolt_Open(GoString p0, GoUint32 p1, GoInt64 p2);
|
||||
|
||||
/* Return type for Bolt_DBStats */
|
||||
struct Bolt_DBStats_return {
|
||||
GoInt64 r0;
|
||||
char* r1;
|
||||
GoInt r2;
|
||||
};
|
||||
|
||||
extern struct Bolt_DBStats_return Bolt_DBStats(GoInt64 p0);
|
||||
|
||||
/* Return type for Bolt_BucketStats */
|
||||
struct Bolt_BucketStats_return {
|
||||
GoInt64 r0;
|
||||
char* r1;
|
||||
GoInt r2;
|
||||
};
|
||||
|
||||
extern struct Bolt_BucketStats_return Bolt_BucketStats(GoInt64 p0, GoSlice p1);
|
||||
|
||||
extern GoInt64 Bolt_ListBuckets(GoInt64 p0, GoSlice p1);
|
||||
|
||||
/* Return type for GetNext */
|
||||
struct GetNext_return {
|
||||
GoInt64 r0;
|
||||
char* r1;
|
||||
GoInt r2;
|
||||
};
|
||||
|
||||
extern struct GetNext_return GetNext(GoInt64 p0);
|
||||
|
||||
extern GoInt64 Bolt_ListBucketsAtRoot(GoInt64 p0);
|
||||
|
||||
/* Return type for Bolt_Close */
|
||||
struct Bolt_Close_return {
|
||||
char* r0;
|
||||
GoInt r1;
|
||||
};
|
||||
|
||||
extern struct Bolt_Close_return Bolt_Close(GoInt64 p0);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
#ifndef INTEROP_H
|
||||
#define INTEROP_H
|
||||
|
||||
#include "../qbolt.h"
|
||||
#include "qbolt_cgo.h"
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
|
@ -17,8 +17,7 @@ TEMPLATE = app
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
#QMAKE_LFLAGS += ../qbolt.so
|
||||
QMAKE_LIBS += ../qbolt.a
|
||||
QMAKE_LIBS += qbolt.a
|
||||
|
||||
QMAKE_CXXFLAGS += -fpermissive # needed for some CGO function pointer interop where the header only specifices void*
|
||||
|
||||
@ -27,6 +26,12 @@ QMAKE_CXXFLAGS += -fpermissive # needed for some CGO function pointer interop wh
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
win32: {
|
||||
# for some reason, qbolt_cgo.h never realises that Q_OS_WIN is defined for win32 builds... weird
|
||||
DEFINES += CGO_WINDOWS
|
||||
#QMAKE_LFLAGS += -lntdll
|
||||
QMAKE_LIBS += -lntdll
|
||||
}
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp \
|
||||
@ -36,7 +41,7 @@ SOURCES += main.cpp\
|
||||
HEADERS += mainwindow.h \
|
||||
interop.h \
|
||||
boltdb.h \
|
||||
../qbolt.h
|
||||
qbolt_cgo.h
|
||||
|
||||
FORMS += mainwindow.ui
|
||||
|
||||
|
10
qbolt/qbolt_cgo.h
Normal file
10
qbolt/qbolt_cgo.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef QBOLT_CGO_H
|
||||
#define QBOLT_CGO_H
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(CGO_WINDOWS)
|
||||
#include "../build/win32/qbolt.h"
|
||||
#else
|
||||
#include "../build/linux/qbolt.h"
|
||||
#endif
|
||||
|
||||
#endif // QBOLT_CGO_H
|
Loading…
Reference in New Issue
Block a user