-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Adds SDL3_ttf port #24601
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
Open
fredheidrich
wants to merge
7
commits into
emscripten-core:main
Choose a base branch
from
fredheidrich:sdl3_ttf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Adds SDL3_ttf port #24601
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4d92fb9
Adds SDL3_ttf port
fredheidrich b529458
Adds browser tests for SDL3_ttf
fredheidrich 126e598
Fixes SDL3_ttf test for firefox
fredheidrich 4795119
Merge branch 'main' into sdl3_ttf
fredheidrich 1e67c0f
Minor formatting change in test_sdl3_ttf.c
fredheidrich a152f1c
Retrigger checks
fredheidrich 822bf46
Retrigger tests one more time for good measure
fredheidrich 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,27 @@ | ||
/* | ||
* Copyright 2013 The Emscripten Authors. All rights reserved. | ||
* Emscripten is available under two separate licenses, the MIT license and the | ||
* University of Illinois/NCSA Open Source License. Both these licenses can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <SDL3/SDL.h> | ||
#include <SDL3_ttf/SDL_ttf.h> | ||
#include <assert.h> | ||
#include <emscripten.h> | ||
#include <unistd.h> | ||
|
||
int main() { | ||
SDL_Init(SDL_INIT_VIDEO); | ||
fredheidrich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (!TTF_Init()) { | ||
printf("TTF_Init: %s\n", SDL_GetError()); | ||
return 1; | ||
} | ||
|
||
TTF_Quit(); | ||
SDL_Quit(); | ||
|
||
return 0; | ||
} |
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,63 @@ | ||
# Copyright 2015 The Emscripten Authors. All rights reserved. | ||
# Emscripten is available under two separate licenses, the MIT license and the | ||
# University of Illinois/NCSA Open Source License. Both these licenses can be | ||
# found in the LICENSE file. | ||
|
||
import os | ||
|
||
TAG = 'release-3.2.2' | ||
HASH = 'c5f34d1b79492e0341c91687cde9ec315f5d6544c7ebaa7ef5d092e77ccfc363a0e702ba9c43bfa0926c54420843ccfb98b81362985fd7b4a67d09a7852b90ba' | ||
|
||
deps = ['freetype', 'sdl3', 'harfbuzz'] | ||
|
||
variants = {'sdl3_ttf-mt': {'PTHREADS': 1}} | ||
|
||
|
||
def needed(settings): | ||
return settings.USE_SDL_TTF == 3 | ||
|
||
|
||
def get_lib_name(settings): | ||
return 'libSDL3_ttf' + ('-mt' if settings.PTHREADS else '') + '.a' | ||
|
||
|
||
def get(ports, settings, shared): | ||
ports.fetch_project('sdl3_ttf', f'https://github.com/libsdl-org/SDL_ttf/archive/{TAG}.zip', sha512hash=HASH) | ||
|
||
def create(final): | ||
src_root = ports.get_dir('sdl3_ttf', 'SDL_ttf-' + TAG) | ||
ports.install_header_dir(os.path.join(src_root, 'include'), target='.') | ||
flags = ['-DTTF_USE_HARFBUZZ=1', '-sUSE_SDL=3', '-sUSE_FREETYPE', '-sUSE_HARFBUZZ'] | ||
if settings.PTHREADS: | ||
flags += ['-pthread'] | ||
|
||
srcs = [ | ||
'src/SDL_gpu_textengine.c', | ||
'src/SDL_hashtable.c', | ||
'src/SDL_hashtable_ttf.c', | ||
'src/SDL_renderer_textengine.c', | ||
'src/SDL_surface_textengine.c', | ||
'src/SDL_ttf.c', | ||
] | ||
|
||
ports.build_port(src_root, final, 'sdl3_ttf', flags=flags, srcs=srcs) | ||
|
||
return [shared.cache.get_lib(get_lib_name(settings), create, what='port')] | ||
|
||
|
||
def clear(ports, settings, shared): | ||
shared.cache.erase_lib(get_lib_name(settings)) | ||
|
||
|
||
def process_dependencies(settings): | ||
settings.USE_SDL = 3 | ||
settings.USE_FREETYPE = 1 | ||
settings.USE_HARFBUZZ = 1 | ||
|
||
|
||
def process_args(ports): | ||
return ['-DTTF_USE_HARFBUZZ=1'] | ||
|
||
|
||
def show(): | ||
return 'sdl3_ttf (-sUSE_SDL_TTF=3 or --use-port=sdl3_ttf; zlib license)' |
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.
Uh oh!
There was an error while loading. Please reload this page.