From 52a1bb468b1aa71adb30541077e8209a9169578e Mon Sep 17 00:00:00 2001 From: Fei XU Date: Wed, 15 Dec 2021 15:36:40 +0800 Subject: [PATCH] compiled ok with go-1.17 on ubuntu-18 --- README.md | 7 +++++++ bridge.go | 2 +- datatype.go | 2 +- go.mod | 10 ++++++++++ go.sum | 7 +++++++ log.go | 2 +- qimage/qimage.go | 2 +- qml.go | 2 +- qmlcommon.go | 2 +- qmlcontext.go | 2 +- qmlengine.go | 2 +- {internal/util => util}/util.go | 0 12 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 go.mod create mode 100644 go.sum rename {internal/util => util}/util.go (100%) diff --git a/README.md b/README.md index b9b17fec..caf3ff40 100644 --- a/README.md +++ b/README.md @@ -155,3 +155,10 @@ and [Qt 5.0.2](http://download.qt-project.org/archive/qt/5.0/5.0.2/) directly from the upstreams. Note that you'll likely have to adapt environment variables to reflect the custom installation path for these libraries. See the instructions above for examples. + +## Build +```sh +export CGO_CXXFLAGS="-I/usr/include/x86_64-linux-gnu/qt5/QtCore/5.9.5/" +go build +``` +`CGO_CXXFLAGS` is for `#include `, change to your local version/path. diff --git a/bridge.go b/bridge.go index fa112619..5664a5f7 100644 --- a/bridge.go +++ b/bridge.go @@ -21,8 +21,8 @@ import ( "unsafe" "github.com/limetext/qml-go/cdata" - "github.com/limetext/qml-go/internal/util" "github.com/limetext/qml-go/qpainter" + "github.com/limetext/qml-go/util" ) type mainThreadFunc struct { diff --git a/datatype.go b/datatype.go index ebd8eedd..d4fbcf72 100644 --- a/datatype.go +++ b/datatype.go @@ -13,8 +13,8 @@ import ( "unicode" "unsafe" - "github.com/limetext/qml-go/internal/util" "github.com/limetext/qml-go/qpainter" + "github.com/limetext/qml-go/util" ) var ( diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..6b7189b3 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module github.com/limetext/qml-go + +go 1.17 + +require gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c + +require ( + github.com/kr/pretty v0.2.1 // indirect + github.com/kr/text v0.1.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..0c3aa11e --- /dev/null +++ b/go.sum @@ -0,0 +1,7 @@ +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/log.go b/log.go index 70a0f4b2..f17f1d12 100644 --- a/log.go +++ b/log.go @@ -11,7 +11,7 @@ import ( "strings" "unsafe" - "github.com/limetext/qml-go/internal/util" + "github.com/limetext/qml-go/util" ) // SetLogger sets the target for messages logged by the qml package, diff --git a/qimage/qimage.go b/qimage/qimage.go index 650d0da3..bb01602f 100644 --- a/qimage/qimage.go +++ b/qimage/qimage.go @@ -13,7 +13,7 @@ import ( "runtime" "unsafe" - "github.com/limetext/qml-go/internal/util" + "github.com/limetext/qml-go/util" ) type QImage interface { diff --git a/qml.go b/qml.go index aeeb67f8..5e21a6ac 100644 --- a/qml.go +++ b/qml.go @@ -10,7 +10,7 @@ import ( "errors" "unsafe" - "github.com/limetext/qml-go/internal/util" + "github.com/limetext/qml-go/util" ) func AddLibraryPath(path string) { diff --git a/qmlcommon.go b/qmlcommon.go index 043ae716..0cb5294d 100644 --- a/qmlcommon.go +++ b/qmlcommon.go @@ -13,7 +13,7 @@ import ( "reflect" "unsafe" - "github.com/limetext/qml-go/internal/util" + "github.com/limetext/qml-go/util" ) // Common implements the common behavior of all QML objects. diff --git a/qmlcontext.go b/qmlcontext.go index 93f35882..0b4faaea 100644 --- a/qmlcontext.go +++ b/qmlcontext.go @@ -6,7 +6,7 @@ package qml // import "C" import ( - "github.com/limetext/qml-go/internal/util" + "github.com/limetext/qml-go/util" ) // Context represents a QML context that can hold variables visible diff --git a/qmlengine.go b/qmlengine.go index 5ac84fcf..aa7bdb29 100644 --- a/qmlengine.go +++ b/qmlengine.go @@ -18,7 +18,7 @@ import ( "strings" "unsafe" - "github.com/limetext/qml-go/internal/util" + "github.com/limetext/qml-go/util" ) // Engine provides an environment for instantiating QML components. diff --git a/internal/util/util.go b/util/util.go similarity index 100% rename from internal/util/util.go rename to util/util.go