Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdl #19

Merged
merged 15 commits into from
Dec 31, 2024
Merged

Sdl #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- {os: debian, codename: bookworm, image_owner: , package_type: deb, labels: [arm32,docker]}
- {os: debian, codename: bookworm, image_owner: , package_type: deb, labels: [arm64,docker]}
# - {os: ubuntu, codename: focal, image_owner: , package_type: deb}
- {os: ubuntu, codename: jammy, image_owner: , package_type: deb}
# - {os: ubuntu, codename: jammy, image_owner: , package_type: deb}
- {os: ubuntu, codename: noble, image_owner: , package_type: deb}
# - {os: raspbian, codename: buster, image_owner: igagis/, package_type: deb, labels: [arm32,docker]}
# - {os: raspbian, codename: bullseye, image_owner: igagis/, package_type: deb, labels: [arm32,docker]}
Expand Down
7 changes: 7 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
"problemMatcher": [],
"group": "build"
},
{
"label": "run-app-sdl-dbg",
"type": "shell",
"command": "make run-app config=dbg sdl=true",
"problemMatcher": [],
"group": "build"
},
{
"label": "run-app-dbg-ogles2",
"type": "shell",
Expand Down
3 changes: 2 additions & 1 deletion debian/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Build-Depends:
libgles2-mesa-dev,
libgtk-3-dev,
libwayland-dev,
libxkbcommon-dev
libxkbcommon-dev,
libsdl2-dev
Build-Depends-Indep: doxygen
Standards-Version: 3.9.5

Expand Down
1 change: 0 additions & 1 deletion debian/libruisapp-dev.install
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ usr/include
usr/lib/pkgconfig
usr/lib/lib*.so
usr/lib/lib*.a

21 changes: 13 additions & 8 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ define ruisapp_rules

this_name := ruisapp-$1$(if $2,-$2)

ifeq ($(os), linux)
ifeq ($2,sdl)
this_ldlibs += -lSDL2
this_cxxflags += -D RUISAPP_BACKEND_SDL
else ifeq ($(os), linux)
# use -isystem instead of -I to prevent clang-tidy follow the includes from these locations
this_cxxflags += $$(patsubst -I%,-isystem%,$$(shell pkg-config --cflags gdk-3.0))
this_ldlibs += $$(shell pkg-config --libs gdk-3.0)
Expand All @@ -69,20 +72,17 @@ define ruisapp_rules
this_ldlibs += $(wayland_shell_protocol_lib)
this_ldlibs += -lxkbcommon
this_cxxflags += -isystem $(dir $(wayland_shell_protocol_header))
this_cxxflags += -D RUISAPP_WAYLAND
else
this_cxxflags += -D RUISAPP_BACKEND_WAYLAND
else ifeq ($2,xorg)
this_ldlibs += -lX11
else
endif
else ifeq ($(os), windows)
this_ldlibs += -lgdi32 -lopengl32 -lglew32
else ifeq ($(os), macosx)
this_ldlibs += -lGLEW
this_ldlibs += -framework Cocoa -framework OpenGL -ldl
endif

this_ldlibs += -lruis -lpapki -ltml -lutki

ifeq ($(os), macosx)
this_mm_obj := $$(d)$$(this_out_dir)obj_$$(this_name)/objc/ruisapp/glue/macosx/glue.mm.o

define this_subrules
Expand All @@ -94,6 +94,8 @@ $(.RECIPEPREFIX)$(a)$(this_cc) -ObjC++ -c -o "$$$$@" $$(this_cxxflags) $$(OBJCXX
$$(eval $$(this_subrules))
endif

this_ldlibs += -lruis -lpapki -ltml -lutki

this_cxxflags += -D RUISAPP_RENDER_$(shell echo $1 | tr '[:lower:]' '[:upper:]')
this_ldlibs += -lruis-render-$1

Expand All @@ -103,7 +105,8 @@ $(.RECIPEPREFIX)$(a)$(this_cc) -ObjC++ -c -o "$$$$@" $$(this_cxxflags) $$(OBJCXX

$$(eval $$(prorab-build-lib))

ifeq ($(os), macosx)
ifeq ($2,sdl)
else ifeq ($(os), macosx)
$$(prorab_this_staticlib): $$(this_mm_obj)
$$(prorab_this_name): $$(this_mm_obj)

Expand All @@ -120,6 +123,8 @@ ifeq ($(os), linux)
$(eval $(call ruisapp_rules,opengles,xorg))
# $(eval $(call ruisapp_rules,opengl,wayland))
$(eval $(call ruisapp_rules,opengles,wayland))
$(eval $(call ruisapp_rules,opengl,sdl))
$(eval $(call ruisapp_rules,opengles,sdl))
else
$(eval $(call ruisapp_rules,opengl,))
endif
Expand Down
7 changes: 5 additions & 2 deletions src/ruisapp/glue/glue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#include <utki/config.hpp>

#if CFG_OS == CFG_OS_WINDOWS
#ifdef RUISAPP_BACKEND_SDL
// NOLINTNEXTLINE(bugprone-suspicious-include)
# include "sdl/glue.cxx"
#elif CFG_OS == CFG_OS_WINDOWS
// NOLINTNEXTLINE(bugprone-suspicious-include)
# include "windows/glue.cxx"
#elif CFG_OS == CFG_OS_LINUX && CFG_OS_NAME == CFG_OS_NAME_ANDROID
# include "android/glue.cxx"
#elif CFG_OS == CFG_OS_LINUX
# ifdef RUISAPP_WAYLAND
# ifdef RUISAPP_BACKEND_WAYLAND
// NOLINTNEXTLINE(bugprone-suspicious-include)
# include "linux/glue_wayland.cxx"
# else
Expand Down
2 changes: 1 addition & 1 deletion src/ruisapp/glue/linux/glue_wayland.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2390,7 +2390,7 @@ int main(int argc, const char** argv)
// sequence:
// - update updateables
// - render
// - wait for events/next cycle
// - wait for events and handle them/next cycle
auto to_wait_ms = app.gui.update();
render(app);

Expand Down
4 changes: 1 addition & 3 deletions src/ruisapp/glue/linux/glue_xorg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ int main(int argc, const char** argv)
// sequence:
// - update updateables
// - render
// - wait for events/next cycle
// - wait for events and handle them/next cycle
auto to_wait_ms = app->gui.update();
render(*app);
wait_set.wait(to_wait_ms);
Expand Down Expand Up @@ -1387,8 +1387,6 @@ int main(int argc, const char** argv)
render(*app);
break;
case ConfigureNotify:
// TRACE(<<
//"ConfigureNotify X event got" << std::endl)
// squash all window resize events into one, for that store the new
// window dimensions and update the viewport later only once
new_win_dims.x() = ruis::real(event.xconfigure.width);
Expand Down
2 changes: 1 addition & 1 deletion src/ruisapp/glue/macosx/glue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ int main(int argc, const char** argv){
// sequence:
// - update updateables
// - render
// - wait for events/next cycle
// - wait for events and handle them/next cycle
uint32_t millis = ruisapp::inst().gui.update();
render(ruisapp::inst());
NSEvent *event = [ww.applicationObjectId
Expand Down
Loading
Loading