Compare commits

...

3 Commits
main ... dev

8 changed files with 325 additions and 328 deletions

5
.gitignore vendored
View File

@ -1,3 +1,8 @@
__pycache__
.bck
out
target
build
###################################
# folders

27
GLD_gale-sample.json Normal file
View File

@ -0,0 +1,27 @@
{
"type":"BINARY",
"sub-type":"SAMPLE",
"group-id":"com.atria-soft",
"description":"Simple windows with gale",
"license":"MPL-2",
"license-file":"file://LICENSE",
"maintainer":"file://authors.txt",
"author":"file://authors.txt",
"version":"file://version.txt",
"code-quality":"MEDIUM",
"source": [
"sample/basic.cpp"
],
"compilation-version": {
"c++": 2017
},
"dependency": [
"gale",
"test-debug"
],
"copy": [
"sample/basic.frag",
"sample/basic.vert"
]
}

216
GLD_gale.json Normal file
View File

@ -0,0 +1,216 @@
{
"type":"LIBRARY",
"group-id":"com.atria-soft",
"description":"gale is a main library to use widget in the openGl environement and manage all the wraping os",
"license":"MPL-2",
"license-file":"file://LICENSE",
"maintainer":"file://authors.txt",
"author":"file://authors.txt",
"version":"file://version.txt",
"code-quality":"MEDIUM",
"source": [
"gale/gale.cpp",
"gale/debug.cpp",
"gale/Dimension.cpp",
"gale/orientation.cpp",
"gale/Application.cpp",
"gale/Thread.cpp",
"gale/context/clipBoard.cpp",
"gale/context/commandLine.cpp",
"gale/context/Context.cpp",
"gale/context/cursor.cpp",
"gale/key/keyboard.cpp",
"gale/key/Special.cpp",
"gale/key/status.cpp",
"gale/key/type.cpp",
"gale/renderer/openGL/openGL.cpp",
"gale/resource/Manager.cpp",
"gale/resource/Program.cpp",
"gale/resource/Resource.cpp",
"gale/resource/Shader.cpp",
"gale/resource/Texture.cpp",
"gale/resource/VirtualBufferObject.cpp"
],
"header": [
"gale/debug.hpp",
"gale/gale.hpp",
"gale/Dimension.hpp",
"gale/orientation.hpp",
"gale/Application.hpp",
"gale/Thread.hpp",
"gale/context/clipBoard.hpp",
"gale/context/commandLine.hpp",
"gale/context/Context.hpp",
"gale/context/cursor.hpp",
"gale/context/Fps.hpp",
"gale/key/keyboard.hpp",
"gale/key/Special.hpp",
"gale/key/status.hpp",
"gale/key/type.hpp",
"gale/key/key.hpp",
"gale/renderer/openGL/openGL.hpp",
"gale/renderer/openGL/openGL-include.hpp",
"gale/resource/Manager.hpp",
"gale/resource/Program.hpp",
"gale/resource/Resource.hpp",
"gale/resource/Shader.hpp",
"gale/resource/Texture.hpp",
"gale/resource/VirtualBufferObject.hpp"
],
"path":[
"."
],
"compilation-version": {
"c++": 2017
},
"dependency": [
"etk",
"opengl",
"echrono",
{
"name": "esignal",
"optional": true,
"export": true,
"flag": {
"c++": "-DGALE_BUILD_ESIGNAL"
}
},
{
"name": "eproperty",
"optional": true,
"export": true,
"flag": {
"c++": "-DGALE_BUILD_EPROPERTY"
}
}
],
"flag": {
"c++": "-DGALE_VERSION=\"\\\"{{{project.version}}}\\\"\""
},
"target": {
"Windows": {
"source": [
"gale/context/Windows/Context.cpp"
],
"dependency": [
"start-mode-gui",
"glew"
]
},
"Linux": {
"dependency": [
{
"name": "X11",
"optional": true,
"export": true,
"source": [
"gale/context/X11/Context.cpp"
],
"flag": {
"c++": "-DGALE_BUILD_X11"
}
},{
"name": "wayland_____",
"optional": true,
"export": true,
"source": [
"gale/context/wayland/Context.cpp"
],
"flag": {
"c++": "-DGALE_BUILD_WAYLAND"
},
"dependency": [
"egl",
"gles2",
"xkbcommon"
],
"LUTIN:actions": {
"state": "PREPARE",
"cmd": "command_generateWaylandProtocol.py",
"data": {}
}
},{
"name": "egami",
"optional": true,
"export": true,
"flag": {
"c++": "-DGALE_BUILD_EGAMI"
}
}
]
},
"Android": {
"source": [
"gale/context/Android/Context.cpp",
"android/src/org/gale/GaleCallback.java",
"android/src/org/gale/GaleConstants.java",
"android/src/org/gale/Gale.java",
"android/src/org/gale/GaleRendererGL.java",
"android/src/org/gale/GaleSurfaceViewGL.java",
"android/src/org/gale/GaleActivity.java",
"android/src/org/gale/GaleWallpaper.java",
"org.gale.GaleConstants.javah"
],
"path":[
"android/src/"
],
"dependency": [
"SDK",
"jvm-basics"
],
"LUTIN:actions": {
"state": "BINARY",
"level": 50,
"name": "gale-auto-wrapper",
"cmd": "command_generateMainJavaClass.py",
"data": {}
}
},
"MacOs": {
"source": [
"gale/context/MacOs/Context.mm",
"gale/context/MacOs/Interface.mm",
"gale/context/MacOs/Windows.mm",
"gale/context/MacOs/OpenglView.mm",
"gale/context/MacOs/AppDelegate.mm"
],
"dependency": [
"Cocoa",
"QuartzCore",
"AppKit"
]
},
"IOs": {
"source": [
"gale/context/IOs/Context.cpp",
"gale/context/IOs/Interface.m",
"gale/context/IOs/OpenglView.mm",
"gale/context/IOs/AppDelegate.mm"
],
"dependency": [
"CoreGraphics",
"UIKit",
"GLKit",
"Foundation",
"QuartzCore"
]
},
"Web": {
"source":"gale/context/SDL/Context.cpp",
"dependency": [
"SDL"
]
},
"Linux|windows|MacOs": {
"mode": {
"debug": {
"flag": {
"c++": "-DGALE_BUILD_SIMULATION"
},
"source": "gale/context/simulation/Context.cpp"
}
}
}
}
}

View File

@ -1,272 +1,10 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
import realog.debug as debug
import lutin.image as image
import os
import lutin.multiprocess as lutinMultiprocess
def get_type():
return "LIBRARY"
def get_desc():
return "gale is a main library to use widget in the openGl environement and manage all the wraping os"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return "authors.txt"
def get_version():
return "version.txt"
def configure(target, my_module):
my_module.add_extra_flags()
# add the file to compile:
my_module.add_src_file([
'gale/gale.cpp',
'gale/debug.cpp',
'gale/Dimension.cpp',
'gale/orientation.cpp',
'gale/Application.cpp',
'gale/Thread.cpp',
])
my_module.add_header_file([
'gale/debug.hpp',
'gale/gale.hpp',
'gale/Dimension.hpp',
'gale/orientation.hpp',
'gale/Application.hpp',
'gale/Thread.hpp',
])
# context:
my_module.add_src_file([
'gale/context/clipBoard.cpp',
'gale/context/commandLine.cpp',
'gale/context/Context.cpp',
'gale/context/cursor.cpp',
])
my_module.add_header_file([
'gale/context/clipBoard.hpp',
'gale/context/commandLine.hpp',
'gale/context/Context.hpp',
'gale/context/cursor.hpp',
'gale/context/Fps.hpp'
])
if "Web" in target.get_type():
my_module.add_src_file('gale/context/SDL/Context.cpp')
elif "Linux" in target.get_type():
my_module.add_optionnal_depend(
'X11',
["c++", "-DGALE_BUILD_X11"],
src_file=[
'gale/context/X11/Context.cpp',
]
)
my_module.add_optionnal_depend(
'wayland',
["c++", "-DGALE_BUILD_WAYLAND"],
src_file=[
'gale/context/wayland/Context.cpp',
]
)
# check if egami is present in the worktree: this is for the icon parsing ...
my_module.add_optionnal_depend('egami', ["c++", "-DGALE_BUILD_EGAMI"])
elif "Windows" in target.get_type():
my_module.add_src_file('gale/context/Windows/Context.cpp')
my_module.add_depend('start-mode-gui')
elif "Android" in target.get_type():
my_module.add_src_file('gale/context/Android/Context.cpp')
my_module.add_src_file([
'android/src/org/gale/GaleCallback.java',
'android/src/org/gale/GaleConstants.java',
'android/src/org/gale/Gale.java',
'android/src/org/gale/GaleRendererGL.java',
'android/src/org/gale/GaleSurfaceViewGL.java',
'android/src/org/gale/GaleActivity.java',
'android/src/org/gale/GaleWallpaper.java',
'org.gale.GaleConstants.javah'
])
my_module.add_path('android/src/', type='java')
elif "MacOs" in target.get_type():
my_module.add_src_file([
'gale/context/MacOs/Context.mm',
'gale/context/MacOs/Interface.mm',
'gale/context/MacOs/Windows.mm',
'gale/context/MacOs/OpenglView.mm',
'gale/context/MacOs/AppDelegate.mm'
])
elif "IOs" in target.get_type():
my_module.add_src_file([
'gale/context/IOs/Context.cpp',
'gale/context/IOs/Interface.m',
'gale/context/IOs/OpenglView.mm',
'gale/context/IOs/AppDelegate.mm'
])
else:
debug.error("unknow mode...")
if "Linux" in target.get_type() \
or "Windows" in target.get_type() \
or "MacOs" in target.get_type():
# only in debug we add simulation:
if target.get_mode() == "debug":
my_module.add_flag('c++', "-DGALE_BUILD_SIMULATION")
my_module.add_src_file('gale/context/simulation/Context.cpp')
# Key properties:
my_module.add_src_file([
'gale/key/keyboard.cpp',
'gale/key/Special.cpp',
'gale/key/status.cpp',
'gale/key/type.cpp'
])
my_module.add_header_file([
'gale/key/keyboard.hpp',
'gale/key/Special.hpp',
'gale/key/status.hpp',
'gale/key/type.hpp',
'gale/key/key.hpp'
])
# OpenGL interface:
my_module.add_src_file([
'gale/renderer/openGL/openGL.cpp'
])
my_module.add_header_file([
'gale/renderer/openGL/openGL.hpp',
'gale/renderer/openGL/openGL-include.hpp'
])
# resources:
my_module.add_src_file([
'gale/resource/Manager.cpp',
'gale/resource/Program.cpp',
'gale/resource/Resource.cpp',
'gale/resource/Shader.cpp',
'gale/resource/Texture.cpp',
'gale/resource/VirtualBufferObject.cpp'
])
my_module.add_header_file([
'gale/resource/Manager.hpp',
'gale/resource/Program.hpp',
'gale/resource/Resource.hpp',
'gale/resource/Shader.hpp',
'gale/resource/Texture.hpp',
'gale/resource/VirtualBufferObject.hpp'
])
my_module.add_depend([
'etk',
'opengl',
'echrono',
])
my_module.add_optionnal_depend('esignal', ["c++", "-DGALE_BUILD_ESIGNAL"])
my_module.add_optionnal_depend('eproperty', ["c++", "-DGALE_BUILD_EPROPERTY"])
my_module.add_path(".")
my_module.add_flag('c++', [
"-DGALE_VERSION=\"\\\"" + tools.version_to_string(my_module.get_pkg("VERSION")) + "\\\"\""
])
if "Web" in target.get_type():
my_module.add_depend([
"SDL"
])
elif "Linux" in target.get_type():
# TODO : This is specific at wayland ==> check How we can add it better
my_module.add_depend([
'egl',
'gles2',
'xkbcommon'
])
my_module.add_action(tool_generate_wayland_protocol, data={})
elif "Android" in target.get_type():
my_module.add_depend(["SDK", "jvm-basics"])
# add tre creator of the basic java class ...
target.add_action("BINARY", 50, "gale-auto-wrapper", tool_generate_main_java_class)
# TODO : Add the same for BINARY to create a console interface ?
elif "Windows" in target.get_type():
my_module.add_depend("glew")
elif "MacOs" in target.get_type():
my_module.add_depend([
"Cocoa",
"QuartzCore",
"AppKit",
])
elif "IOs" in target.get_type():
my_module.add_depend([
"CoreGraphics",
"UIKit",
"GLKit",
"Foundation",
"QuartzCore",
])
return True
##################################################################
##
## Wayland specific section
##
##################################################################
def tool_generate_wayland_protocol(target, module, package_name):
file_list = []
debug.warning("------------------------------------------------------------------------")
debug.warning("Generate wayland back elements... '" + str(module) + "'" )
debug.warning("------------------------------------------------------------------------")
cmd = ["pkg-config", "wayland-protocols", "--variable=pkgdatadir"]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("Can not execute protocol extraction...")
WAYLAND_PROTOCOLS_DIR = ret
debug.warning("WAYLAND_PROTOCOLS_DIR = " + str(WAYLAND_PROTOCOLS_DIR))
cmd = ["pkg-config", "--variable=wayland_scanner", "wayland-scanner"]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("Can not execute protocol extraction...")
WAYLAND_SCANNER = ret
debug.warning("WAYLAND_SCANNER = " + str(WAYLAND_SCANNER))
XDG_SHELL_PROTOCOL = os.path.join(WAYLAND_PROTOCOLS_DIR, "stable", "xdg-shell", "xdg-shell.xml")
debug.warning("XDG_SHELL_PROTOCOL = " + str(XDG_SHELL_PROTOCOL))
client_protocol_header = "xdg-shell-client-protocol.h"
client_protocol = "xdg-shell-protocol.c"
# create files
debug.warning("Generate file = " + client_protocol_header)
tmp_file = "/tmp/gale_wayland.tmp"
cmd = [WAYLAND_SCANNER, "client-header", XDG_SHELL_PROTOCOL, tmp_file]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("error in generate wayland header code")
tmp_file_data = tools.file_read_data(tmp_file)
module.add_generated_header_file(tmp_file_data, client_protocol_header)
debug.warning("Generate file = " + client_protocol)
cmd = [WAYLAND_SCANNER, "private-code", XDG_SHELL_PROTOCOL, tmp_file]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("Error in wayland generation code of private header protocole")
tmp_file_data = tools.file_read_data(tmp_file)
module.add_generated_src_file(tmp_file_data, client_protocol)
##################################################################
##
## Android specific section
##
##################################################################
def tool_generate_main_java_class(target, module, package_name):
def generateMainJavaClass(target, module, package_name):
file_list = []
debug.debug("------------------------------------------------------------------------")

View File

@ -0,0 +1,48 @@
##################################################################
##
## Wayland specific section
##
##################################################################
def generateWaylandProtocol(target, module, package_name):
file_list = []
debug.warning("------------------------------------------------------------------------")
debug.warning("Generate wayland back elements... '" + str(module) + "'" )
debug.warning("------------------------------------------------------------------------")
cmd = ["pkg-config", "wayland-protocols", "--variable=pkgdatadir"]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("Can not execute protocol extraction...")
WAYLAND_PROTOCOLS_DIR = ret
debug.warning("WAYLAND_PROTOCOLS_DIR = " + str(WAYLAND_PROTOCOLS_DIR))
cmd = ["pkg-config", "--variable=wayland_scanner", "wayland-scanner"]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("Can not execute protocol extraction...")
WAYLAND_SCANNER = ret
debug.warning("WAYLAND_SCANNER = " + str(WAYLAND_SCANNER))
XDG_SHELL_PROTOCOL = os.path.join(WAYLAND_PROTOCOLS_DIR, "stable", "xdg-shell", "xdg-shell.xml")
debug.warning("XDG_SHELL_PROTOCOL = " + str(XDG_SHELL_PROTOCOL))
client_protocol_header = "xdg-shell-client-protocol.h"
client_protocol = "xdg-shell-protocol.c"
# create files
debug.warning("Generate file = " + client_protocol_header)
tmp_file = "/tmp/gale_wayland.tmp"
cmd = [WAYLAND_SCANNER, "client-header", XDG_SHELL_PROTOCOL, tmp_file]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("error in generate wayland header code")
tmp_file_data = tools.file_read_data(tmp_file)
module.add_generated_header_file(tmp_file_data, client_protocol_header)
debug.warning("Generate file = " + client_protocol)
cmd = [WAYLAND_SCANNER, "private-code", XDG_SHELL_PROTOCOL, tmp_file]
ret = lutinMultiprocess.run_command_direct(tools.list_to_str(cmd))
if ret == False:
debug.error("Error in wayland generation code of private header protocole")
tmp_file_data = tools.file_read_data(tmp_file)
module.add_generated_src_file(tmp_file_data, client_protocol)

View File

@ -912,21 +912,21 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
#if defined(__TARGET_OS__Linux)
if (false) { }
#ifdef GALE_BUILD_X11
else if (tmpVal == "X11") {
else if (tmpVal == "X11") {
request = tmpVal;
}
#endif
#ifdef GALE_BUILD_WAYLAND
else if (tmpVal == "wayland") {
else if (tmpVal == "wayland") {
request = tmpVal;
}
#endif
#ifdef GALE_BUILD_SIMULATION
else if (tmpVal == "simulation") {
else if (tmpVal == "simulation") {
request = tmpVal;
}
#endif
else {
else {
GALE_ERROR("Unsupported environement variable : '" << tmpVal << "' only: ["
#ifdef GALE_BUILD_X11
<< "X11"
@ -977,21 +977,21 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
#if defined(__TARGET_OS__Linux)
if (false) { }
#ifdef GALE_BUILD_X11
else if (tmpVal == "X11") {
else if (tmpVal == "X11") {
request = tmpVal;
}
#endif
#ifdef GALE_BUILD_WAYLAND
else if (tmpVal == "wayland") {
else if (tmpVal == "wayland") {
request = tmpVal;
}
#endif
#ifdef GALE_BUILD_SIMULATION
else if (tmpVal == "simulation") {
else if (tmpVal == "simulation") {
request = tmpVal;
}
#endif
else {
else {
GALE_ERROR("Unsupported environement variable : '" << tmpVal << "' only: ["
#ifdef GALE_BUILD_X11
<< "X11"
@ -1041,26 +1041,26 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
if (request == "") {
if (false) {}
#ifdef GALE_BUILD_X11
else if (gale::context::x11::isBackendPresent() == true) {
else if (gale::context::x11::isBackendPresent() == true) {
context = gale::context::x11::createInstance(_application, _argc, _argv);
}
#endif
#ifdef GALE_BUILD_WAYLAND
else if (gale::context::wayland::isBackendPresent() == true) {
else if (gale::context::wayland::isBackendPresent() == true) {
context = gale::context::wayland::createInstance(_application, _argc, _argv);
}
#endif
#ifdef GALE_BUILD_SIMULATION
else if (gale::context::simulation::isBackendPresent() == true) {
else if (gale::context::simulation::isBackendPresent() == true) {
context = gale::context::simulation::createInstance(_application, _argc, _argv);
}
#endif
else {
else {
GALE_CRITICAL("Have no backend to generate display ...");
}
}
#ifdef GALE_BUILD_X11
else if (request == "X11") {
else if (request == "X11") {
if (gale::context::x11::isBackendPresent() == true) {
context = gale::context::x11::createInstance(_application, _argc, _argv);
} else {
@ -1069,22 +1069,24 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
}
#endif
#ifdef GALE_BUILD_WAYLAND
else if (request == "wayland") {
else if (request == "wayland") {
if (gale::context::wayland::isBackendPresent() == true) {
context = gale::context::wayland::createInstance(_application, _argc, _argv);
} else {
GALE_CRITICAL("Backend 'wayland' is not present");
}
}
#endif
#ifdef GALE_BUILD_SIMULATION
} else if (request == "simulation") {
else if (request == "simulation") {
if (gale::context::simulation::isBackendPresent() == true) {
context = gale::context::simulation::createInstance(_application, _argc, _argv);
} else {
GALE_CRITICAL("Backend 'simulation' is not present");
}
}
#endif
} else {
else {
GALE_CRITICAL("Must not appear");
}
#elif defined(__TARGET_OS__Windows)
@ -1093,11 +1095,11 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
context = gale::context::windows::createInstance(_application, _argc, _argv);
}
#ifdef GALE_BUILD_SIMULATION
else if (gale::context::simulation::isBackendPresent() == true) {
else if (gale::context::simulation::isBackendPresent() == true) {
context = gale::context::simulation::createInstance(_application, _argc, _argv);
}
#endif
else {
else {
GALE_CRITICAL("Have no backend to generate display ...");
}
} else if (request == "windows") {
@ -1108,14 +1110,15 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
}
}
#ifdef GALE_BUILD_SIMULATION
else if (request == "simulation") {
else if (request == "simulation") {
if (gale::context::simulation::isBackendPresent() == true) {
context = gale::context::simulation::createInstance(_application, _argc, _argv);
} else {
GALE_CRITICAL("Backend 'simulation' is not present");
}
}
#endif
} else {
else {
GALE_CRITICAL("Must not appear");
}
#elif defined(__TARGET_OS__Web)
@ -1143,19 +1146,20 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
} else {
GALE_CRITICAL("Backend 'macos' is not present");
}
}
#ifdef GALE_BUILD_SIMULATION
} else if (request == "simulation") {
else if (request == "simulation") {
if (gale::context::simulation::isBackendPresent() == true) {
context = gale::context::simulation::createInstance(_application, _argc, _argv);
} else {
GALE_CRITICAL("Backend 'simulation' is not present");
}
}
#endif
} else {
else {
GALE_CRITICAL("Must not appear");
}
#endif
if (context == null) {
GALE_ERROR("Can not allocate the interface of the GUI ...");
return -1;

View File

@ -1,41 +0,0 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
def get_type():
return "BINARY"
def get_sub_type():
return "SAMPLE"
def get_desc():
return "Simple windows with gale"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return "authors.txt"
def configure(target, my_module):
my_module.add_src_file([
'sample/basic.cpp'
])
my_module.add_depend([
'gale',
'test-debug'
])
my_module.copy_file('sample/basic.frag')
my_module.copy_file('sample/basic.vert')
return True

View File

@ -1 +1 @@
1.0.0
1.0.0-dev