-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
312 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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 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,114 @@ | ||
# Copyright 2018 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
licenses(["notice"]) | ||
|
||
# We can't just glob *.c, since Freetype has .c files that include other .c | ||
# files all over the place. In order to simplify the process of listing them | ||
# manually, we patch out the non-TrueType drivers from the configuration file, | ||
# since the only font we ship is TrueType. | ||
sources = [ | ||
"src/autofit/afangles.c", | ||
"src/autofit/afblue.c", | ||
"src/autofit/afcjk.c", | ||
"src/autofit/afdummy.c", | ||
"src/autofit/afglobal.c", | ||
"src/autofit/afhints.c", | ||
"src/autofit/afindic.c", | ||
"src/autofit/aflatin.c", | ||
"src/autofit/afloader.c", | ||
"src/autofit/afmodule.c", | ||
"src/autofit/afpic.c", | ||
"src/autofit/afranges.c", | ||
"src/autofit/afshaper.c", | ||
"src/autofit/afwarp.c", | ||
"src/base/basepic.c", | ||
"src/base/ftadvanc.c", | ||
"src/base/ftapi.c", | ||
"src/base/ftbbox.c", | ||
"src/base/ftbdf.c", | ||
"src/base/ftbitmap.c", | ||
"src/base/ftcalc.c", | ||
"src/base/ftcid.c", | ||
"src/base/ftdbgmem.c", | ||
"src/base/ftdebug.c", | ||
"src/base/ftfntfmt.c", | ||
"src/base/ftfstype.c", | ||
"src/base/ftgasp.c", | ||
"src/base/ftgloadr.c", | ||
"src/base/ftglyph.c", | ||
"src/base/ftgxval.c", | ||
"src/base/fthash.c", | ||
"src/base/ftinit.c", | ||
"src/base/ftlcdfil.c", | ||
"src/base/ftmm.c", | ||
"src/base/ftobjs.c", | ||
"src/base/ftotval.c", | ||
"src/base/ftoutln.c", | ||
"src/base/ftpatent.c", | ||
"src/base/ftpfr.c", | ||
"src/base/ftpic.c", | ||
"src/base/ftrfork.c", | ||
"src/base/ftsnames.c", | ||
"src/base/ftstream.c", | ||
"src/base/ftstroke.c", | ||
"src/base/ftsynth.c", | ||
"src/base/ftsystem.c", | ||
"src/base/fttrigon.c", | ||
"src/base/fttype1.c", | ||
"src/base/ftutil.c", | ||
"src/base/ftwinfnt.c", | ||
"src/gzip/ftgzip.c", | ||
"src/raster/ftraster.c", | ||
"src/raster/ftrend1.c", | ||
"src/raster/rastpic.c", | ||
"src/sfnt/pngshim.c", | ||
"src/sfnt/sfdriver.c", | ||
"src/sfnt/sfntpic.c", | ||
"src/sfnt/sfobjs.c", | ||
"src/sfnt/ttbdf.c", | ||
"src/sfnt/ttcmap.c", | ||
"src/sfnt/ttkern.c", | ||
"src/sfnt/ttload.c", | ||
"src/sfnt/ttmtx.c", | ||
"src/sfnt/ttpost.c", | ||
"src/sfnt/ttsbit.c", | ||
"src/smooth/ftgrays.c", | ||
"src/smooth/ftsmooth.c", | ||
"src/smooth/ftspic.c", | ||
"src/truetype/ttdriver.c", | ||
"src/truetype/ttgload.c", | ||
"src/truetype/ttgxvar.c", | ||
"src/truetype/ttinterp.c", | ||
"src/truetype/ttobjs.c", | ||
"src/truetype/ttpic.c", | ||
"src/truetype/ttpload.c", | ||
"src/truetype/ttsubpix.c", | ||
] | ||
|
||
cc_library( | ||
name = "freetype", | ||
srcs = sources, | ||
hdrs = glob([ | ||
"src/**/*.h", | ||
"include/**/*.h", | ||
]), | ||
copts = [ | ||
"-DFT2_BUILD_LIBRARY", | ||
"-UDEBUG", | ||
], | ||
includes = ["include"], | ||
textual_hdrs = glob(["src/**/*.c"]), | ||
visibility = ["//visibility:public"], | ||
) |
This file contains 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,26 @@ | ||
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h | ||
index 76d271a..c5950fe 100644 | ||
--- a/include/freetype/config/ftmodule.h | ||
+++ b/include/freetype/config/ftmodule.h | ||
@@ -12,21 +12,10 @@ | ||
|
||
FT_USE_MODULE( FT_Module_Class, autofit_module_class ) | ||
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) | ||
-FT_USE_MODULE( FT_Module_Class, psaux_module_class ) | ||
-FT_USE_MODULE( FT_Module_Class, psnames_module_class ) | ||
-FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) | ||
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) | ||
FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) | ||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) | ||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) | ||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) | ||
-FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) | ||
|
||
/* EOF */ |
This file contains 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,80 @@ | ||
# Copyright 2018 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
licenses(["notice"]) | ||
|
||
# Common include paths | ||
sdl_includes = [ | ||
"include", | ||
"src/video/khronos", | ||
] | ||
|
||
objc_library( | ||
name = "sdl2_objc", | ||
srcs = glob([ | ||
"src/**/*.h", | ||
"include/*.h", | ||
]), | ||
includes = sdl_includes, | ||
non_arc_srcs = glob([ | ||
"src/audio/coreaudio/*.m", | ||
"src/file/cocoa/*.m", | ||
"src/filesystem/cocoa/*.m", | ||
"src/render/metal/*.m", | ||
"src/video/cocoa/*.m", | ||
]), | ||
sdk_frameworks = [ | ||
"AudioToolbox", | ||
"Carbon", | ||
"CoreAudio", | ||
"CoreVideo", | ||
"Cocoa", | ||
"ForceFeedback", | ||
"IOKit", | ||
"OpenGL", | ||
"Metal", | ||
], | ||
alwayslink = 1, | ||
) | ||
|
||
sdl_srcs = glob( | ||
include = [ | ||
"src/**/*.c", | ||
"src/**/*.h", | ||
], | ||
exclude = [ | ||
"src/video/qnx/**", | ||
"src/haptic/windows/**", | ||
"src/test/*.c", | ||
"src/thread/generic/*.c", | ||
"src/core/linux/*.c", | ||
], | ||
) | ||
|
||
# In general, we bundle SDL2. However, on Linux that would require a header | ||
# generated by --configure, and a lot of buildflags and installing dev headers | ||
# is in general less painful, so we just link it dynamically. | ||
cc_library( | ||
name = "sdl2", | ||
srcs = sdl_srcs, | ||
hdrs = glob(["include/*.h"]), | ||
copts = ["-Wno-error"], | ||
includes = sdl_includes, | ||
textual_hdrs = glob(["src/thread/generic/*.c"]), | ||
visibility = ["//visibility:public"], | ||
deps = select({ | ||
"@platforms//cpu:wasm32": [], | ||
"//conditions:default": [":sdl2_objc"], | ||
}), | ||
) |
This file contains 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,26 @@ | ||
# Copyright 2018 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cc_library( | ||
name = "sdl2_ttf", | ||
srcs = ["SDL_ttf.c"], | ||
hdrs = ["SDL_ttf.h"], | ||
copts = ["-Wno-error"], | ||
includes = ["."], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@freetype", | ||
"@sdl2", | ||
], | ||
) |
This file contains 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 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 |
---|---|---|
@@ -1,19 +1,33 @@ | ||
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary") | ||
|
||
# FIXME: -sUSE_SDL=2 -sUSE_SDL_TTF=2 not work with bazel | ||
# cc_binary( | ||
# name = "krabby", | ||
# srcs = ["src/main.cpp"], | ||
# copts = [ | ||
# "-std=c++20", | ||
# ], | ||
# ) | ||
|
||
# wasm_cc_binary( | ||
# name = "krabby-wasm", | ||
# cc_target = ":krabby", | ||
# outputs = [ | ||
# "krabby.js", | ||
# "krabby.wasm", | ||
# ], | ||
# ) | ||
filegroup( | ||
name = "asset", | ||
srcs = glob([ | ||
"asset/font/*", | ||
"asset/audio/*", | ||
]), | ||
) | ||
|
||
cc_binary( | ||
name = "krabby", | ||
srcs = ["src/main.cpp"], | ||
additional_linker_inputs = [":asset"], | ||
copts = [ | ||
"-std=c++20", | ||
], | ||
data = [":asset"], | ||
# linkopts = ["--preload-file $(locations asset)"], | ||
deps = ["@sdl2_ttf"], | ||
) | ||
|
||
wasm_cc_binary( | ||
name = "krabby-wasm", | ||
cc_target = ":krabby", | ||
outputs = [ | ||
"krabby.js", | ||
"krabby.wasm", | ||
], | ||
threads = "emscripten", | ||
) |