Skip to content

Disable SDL2 by default #18072

Closed
Closed

Description

@aleck099

USE_SDL is 1 by default
Everything is fine except for building SDL2
When USE_SDL=1, emcc will add an include path of its built-in SDL1, which contains same files with SDL2 (e.g. SDL_config.h)
Building SDL2 without additional flags will result in redefination errors

How to disable USE_SDL globally? Is there any configuration file or environment variable? Please don't tell me to use CFLAGS= because of many compability issues of many build systems

Activity

  1. sbc100 commented on Oct 19, 2022

    @sbc100
    Collaborator

    If you don't want the system version of SDL you can use -sUSE_SDL=0

  2. sbc100 commented on Oct 19, 2022

    @sbc100
    Collaborator

    Is there some reason the emscripten builtin SDL2 port doesn't work for you? (i.e. -sUSE_SDL=2)?

  3. sbc100 commented on Oct 19, 2022

    @sbc100
    Collaborator

    If you really don't want to pass -sUSE_SDL=0 on the command line you could edit src/settings.js and change the default for USE_SDL from 1 to 0... we don't normally recommend editing this file, but its one option.

  4. aleck099 commented on Oct 20, 2022

    @aleck099
    Author

    If you really don't want to pass -sUSE_SDL=0 on the command line you could edit src/settings.js and change the default for USE_SDL from 1 to 0... we don't normally recommend editing this file, but its one option.

    Finally I edited settings.js

  5. Akaricchi commented on Nov 7, 2022

    @Akaricchi
    Contributor

    I think USE_SDL=1 is a bad default. SDL1 has been obsolete for years. How much maintained software even still depends on it?

  6. sbc100 commented on Nov 7, 2022

    @sbc100
    Collaborator

    True perhaps the default should be changed 0. On the other hand doesn't this only effect folks who what to buiild an out-of-tree copy of SDL2. I wonder how common that is?

  7. Akaricchi commented on Nov 7, 2022

    @Akaricchi
    Contributor

    Common enough to have been noticed by at least two people here. Building your own SDL isn't that crazy when you build for multiple platforms and want precise and centralized control over your dependencies. We do that in Taisei; I wrote meson build definitions for all of our deps and we use the same set of subprojects for official emscripten, windows, macos, and linux builds. Building a custom SDL also allows us to disable a bunch of dead code that our game is not using, such as the built-in 2D renderer.

  8. reopened this on Nov 27, 2022
  9. sbc100 commented on Nov 27, 2022

    @sbc100
    Collaborator

    Re-opening because there is some ongoing discussion about whether its a good idea to make USE_SDL default to 0 instead of 1.

  10. Akaricchi commented on Nov 28, 2022

    @Akaricchi
    Contributor

    FWIW, SDL3 is now under development, so even SDL2 will be on its way out fairly soon (hopefully more gracefully than SDL1 was).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions