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

Building without GTK dependencies #1084

Closed
vanfanel opened this issue May 13, 2020 · 11 comments
Closed

Building without GTK dependencies #1084

vanfanel opened this issue May 13, 2020 · 11 comments
Assignees

Comments

@vanfanel
Copy link

Hi there!

I have just discovered TIC-80, and I am trying to build it for my Pi, where no Xorg server is running or needed. SDL2 programs dont need Xorg because SDL2 has KMSDRM support, so the system boots in 1 second :)

So, since we have SDL2 and its KMS/DRM backend, is it possible to build TIC-80 without GTK dependencies? If its not possible... why not?

Thanks!

@nesbox
Copy link
Owner

nesbox commented May 13, 2020

It's possible to build without GTK, we use it to show system file save/load dialogs, so you can disable code in the file_dialog_load() / file_dialog_save() functions and build.

void file_dialog_load(file_dialog_load_callback callback, void* data)

@vanfanel
Copy link
Author

vanfanel commented May 13, 2020

Ok, I am trying to build like that, but I get a not related problem:

manuel@teclast:~/src/TIC-80/b3$ cmake ..
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	b3/

nothing added to commit but untracked files present (use "git add" to track)
Building for target : Linux
PROJECT_VERSION: 0.80.2-dev
CMake Error at CMakeLists.txt:355 (add_subdirectory):
  The source directory

    /home/manuel/src/TIC-80/vendor/sdl2

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:545 (add_subdirectory):
  The source directory

    /home/manuel/src/TIC-80/vendor/zip

  does not contain a CMakeLists.txt file.


-- Checking for module 'gtk+-3.0'
--   No package 'gtk+-3.0' found
CMake Error at /usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:415 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:593 (_pkg_check_modules_internal)
  CMakeLists.txt:778 (pkg_check_modules)


-- Configuring incomplete, errors occurred!
See also "/home/manuel/src/TIC-80/b3/CMakeFiles/CMakeOutput.log".
See also "/home/manuel/src/TIC-80/b3/CMakeFiles/CMakeError.log".


I can add -DDISABLE_NETWORKING=1 to the cmake command, but it fails on sdl2 and zip directories.
Any idea on whats going on?

@nesbox
Copy link
Owner

nesbox commented May 13, 2020

you have to update submodules, use git submodule update --init --recursive command

@vanfanel
Copy link
Author

vanfanel commented May 13, 2020

@nesbox Right! Thanks!
Commenting out the GTK functions in src/ext/file_dialog.c, and the GTK include, and the GTK detection in CMakefiles.txt, does indeed get me a building version now :)
Would you accept a PR so I dont have to do all this every time I rebuild on the PI? My idea is simply disabling it if it is not found, and putting the small GTK code inside an #ifdef. You can also do it yourself, if you feel like it. But I think that making GTK an "optional dependency" is a good idea, as TIC-80 is very well suited for small Xorg-less systems thanks to SDL2.

Also, is it possible to use whatever renderer SDL2 uses? I have seen that the generated binaries (t80, t80-sokol, player-sdl, etc...) are all linked against desktop GL instead of GLES, thats better suited for X-less Pi.

@nesbox
Copy link
Owner

nesbox commented May 13, 2020

better, I will add an alternative file saving functionality without UI dialogs and a build option to enable/disable it.

@vanfanel
Copy link
Author

vanfanel commented May 13, 2020

Great! What about X11/DesktopGL linkage? Can it be disabled somehow or is it detected depending on whats SDL2 built against?
SDL2 on KMSDRM usually has GLES2 support, instead of desktop GL.

@nesbox
Copy link
Owner

nesbox commented May 13, 2020

Don't know about disabling X11 in SDL2, try to look into vendor/sdl2/CMakeLists.txt, maybe you find options you need.

@vanfanel
Copy link
Author

Well, it seems that independently from SDL2, it tries to build Desktop GL:

In file included from /home/pi/src/TIC-80/vendor/sdl-gpu/src/externals/glew/glew.c:33:
/home/pi/src/TIC-80/vendor/sdl-gpu/src/externals/glew/GL/glew.h:1202:14: fatal error: GL/glu.h: No such file or directory
 1202 | #    include <GL/glu.h>
      |              ^~~~~~~~~~
compilation terminated.

No way to disable that? SDL2 is enough, really.

@RobLoach
Copy link
Contributor

You'll need the gl-dev dependencies. libopengl-dev usually.

Also can be...
libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

@vanfanel
Copy link
Author

@RobLoach So, does TIC-80 depend on desktop-GL? Cant it just use whatever renderer SDL2 uses? In my case, its GLES2. And anything (2D) goes.

@nesbox nesbox self-assigned this Oct 15, 2020
@nesbox
Copy link
Owner

nesbox commented Oct 15, 2020

Added GTK libs autodetection here ee40393 20ff233.

@nesbox nesbox closed this as completed Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants