-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
sdl2-compat: add setup hook and minor fixes #388079
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| diff --git a/SDL2Config.cmake.in b/SDL2Config.cmake.in | ||
| index 80c1b99..54f50e6 100644 | ||
| --- a/SDL2Config.cmake.in | ||
| +++ b/SDL2Config.cmake.in | ||
| @@ -45,7 +45,8 @@ endif() | ||
| set(SDL2_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") | ||
| set(SDL2_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") | ||
| set(SDL2_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") | ||
| -set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") | ||
| +set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2" $ENV{SDL2_PATH}) | ||
| +separate_arguments(SDL2_INCLUDE_DIRS) | ||
| set(SDL2_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@") | ||
| set(SDL2_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@") | ||
| set(SDL2_LIBRARIES SDL2::SDL2) | ||
| diff --git a/sdl2-config.in b/sdl2-config.in | ||
| index d21b1b2..bb0d624 100644 | ||
| --- a/sdl2-config.in | ||
| +++ b/sdl2-config.in | ||
| @@ -50,7 +50,11 @@ while test $# -gt 0; do | ||
| echo @PROJECT_VERSION@ | ||
| ;; | ||
| --cflags) | ||
| - echo -I${includedir}/SDL2 @SDL_CFLAGS@ | ||
| + SDL_CFLAGS="" | ||
| + for i in @includedir@/SDL2 $SDL2_PATH; do | ||
| + SDL_CFLAGS="$SDL_CFLAGS -I$i" | ||
| + done | ||
| + echo $SDL_CFLAGS @SDL_CFLAGS@ | ||
| ;; | ||
| @ENABLE_SHARED_TRUE@ --libs) | ||
| @ENABLE_SHARED_TRUE@ echo -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| addSDL2Path () { | ||
| if [ -e "$1/include/SDL2" ]; then | ||
| export SDL2_PATH="${SDL2_PATH-}${SDL2_PATH:+ }$1/include/SDL2" | ||
| fi | ||
| } | ||
|
|
||
| addEnvHooks "$hostOffset" addSDL2Path |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you test this, especially on darwin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't use nix on darwin so I don't have any way to test this currently. I've tested the change on linux.
Note that this line doesn't add darwin to platforms - darwin is unix so it was already there - effectively it only adds windows which I wanted to test but I was blocked by #388297, I will try again shortly now that it's fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good point. If it was previously unix it should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to cross compile the package itself for windows after fixing the rpath setting, but cross compiling anything dependent on it is problematic, since I realized that the setup hook assumes that host == target. I've tried building a simple game by supplying necessary flags manually but it failed to run in wine with
Failed to initialize registry display settings for L"\\\\.\\DISPLAY1". I'm still leaving the platforms set toallsince there is nothing unixy required by the library, and the issues are likely caused by cross compiling.