mirror of
https://github.com/gosticks/gml.git
synced 2025-10-16 12:05:33 +00:00
added setSearchPath and enabled verbose mode in docker build
This commit is contained in:
parent
91fa281744
commit
38428c4f72
18
gml.go
18
gml.go
@ -36,6 +36,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Global app variable.
|
||||
@ -109,3 +110,20 @@ func SetContextProperty(name string, v interface{}) (err error) {
|
||||
func AddImportPath(path string) {
|
||||
gapp.AddImportPath(path)
|
||||
}
|
||||
|
||||
// SetSearchPaths sets or replaces Qt's search paths for file names with the prefix prefix to searchPaths.
|
||||
// To specify a prefix for a file name, prepend the prefix followed by a single colon (e.g., "images:undo.png", "xmldocs:books.xml"). prefix can only contain letters or numbers (e.g., it cannot contain a colon, nor a slash).
|
||||
// Qt uses this search path to locate files with a known prefix. The search path entries are tested in order, starting with the first entry.
|
||||
func SetSearchPaths(prefix string, searchPaths []string) {
|
||||
if len(prefix) == 0 || len(searchPaths) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
prefixC := C.CString(prefix)
|
||||
defer C.free(unsafe.Pointer(prefixC))
|
||||
|
||||
pathsC := toCharArray(searchPaths)
|
||||
defer freeCharArray(pathsC, len(searchPaths))
|
||||
|
||||
C.gml_global_set_search_paths(prefixC, pathsC, C.int(len(searchPaths)))
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#ifndef GML_HEADER_H
|
||||
#define GML_HEADER_H
|
||||
|
||||
#include "gml_global.h"
|
||||
#include "gml_app.h"
|
||||
#include "gml_bytes.h"
|
||||
#include "gml_error.h"
|
||||
|
||||
43
internal/binding/headers/gml_global.h
Normal file
43
internal/binding/headers/gml_global.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* GML - Go QML
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Roland Singer <roland.singer[at]desertbit.com>
|
||||
* Copyright (c) 2019 Sebastian Borchers <sebastian[at]desertbit.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef GML_GLOBAL_H
|
||||
#define GML_GLOBAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "gml_error.h"
|
||||
|
||||
void gml_global_set_search_paths(const char* prefix, const char** paths, int paths_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
50
internal/binding/sources/gml_global.cpp
Normal file
50
internal/binding/sources/gml_global.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* GML - Go QML
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Roland Singer <roland.singer[at]desertbit.com>
|
||||
* Copyright (c) 2019 Sebastian Borchers <sebastian[at]desertbit.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gml_includes.h"
|
||||
#include "gml_error.h"
|
||||
|
||||
//#############//
|
||||
//### C API ###//
|
||||
//#############//
|
||||
|
||||
void gml_global_set_search_paths(const char* prefix, const char** paths, int paths_size) {
|
||||
try {
|
||||
QStringList list;
|
||||
for (int i=0; i < paths_size; ++i) {
|
||||
list.append(QString(paths[i]));
|
||||
}
|
||||
|
||||
QDir::setSearchPaths(QString(prefix), list);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
gml_error_log_exception(e.what());
|
||||
}
|
||||
catch (...) {
|
||||
gml_error_log_exception();
|
||||
}
|
||||
}
|
||||
@ -42,6 +42,7 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QDir>
|
||||
#include <QImage>
|
||||
#include <QQuickTextureFactory>
|
||||
#include <QQuickAsyncImageProvider>
|
||||
|
||||
@ -111,11 +111,14 @@ func Build(
|
||||
"-v", ctx.SourceDir + ":/work/" + ctx.BinName,
|
||||
"-v", ctx.BuildDir + ":/work/build",
|
||||
"-v", ctx.DestDir + ":/work/bin",
|
||||
container, "gml",
|
||||
}
|
||||
|
||||
args = append(args,
|
||||
container,
|
||||
"gml", "build",
|
||||
if utils.Verbose {
|
||||
args = append(args, "-v")
|
||||
}
|
||||
|
||||
args = append(args, "build",
|
||||
"--source-dir", "/work/"+ctx.BinName,
|
||||
"--build-dir", "/work/build/gml-build",
|
||||
"--dest-dir", "/work/bin")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user