Skip to content

Commit

Permalink
igl | third-party | Replace a patch with a Python script
Browse files Browse the repository at this point in the history
Reviewed By: xiendong

Differential Revision: D67150237

fbshipit-source-id: ea69f176892801f5335f24496dfd3389576fa1b4
  • Loading branch information
corporateshark authored and facebook-github-bot committed Dec 12, 2024
1 parent d48d29b commit 9ee800e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 58 deletions.
5 changes: 2 additions & 3 deletions third-party/bootstrap-deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@
{
"name": "nanovg",
"postprocess" : {
"type" : "patch",
"file" : "nanovg.patch",
"pnum" : "0"
"type": "script",
"file": "nanovg.py"
},
"source": {
"type": "git",
Expand Down
55 changes: 0 additions & 55 deletions third-party/deps/patches/nanovg.patch

This file was deleted.

30 changes: 30 additions & 0 deletions third-party/deps/patches/nanovg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3

import os
import shutil
from pathlib import Path

base_dir=os.getcwd()
lib_dir=os.path.join(base_dir, "src", "nanovg")

file = Path(os.path.join(lib_dir, "example/demo.c"))
file.write_text(file.read_text()
.replace("#include <GLFW/glfw3.h>", "")
.replace("#define STB_IMAGE_WRITE_IMPLEMENTATION", "")
.replace("glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, image);", "// glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, image);")
)

file = Path(os.path.join(lib_dir, "example/perf.c"))
file.write_text(file.read_text()
.replace("void startGPUTimer(GPUtimer* timer)",
("""#if 0
void startGPUTimer(GPUtimer* timer)
"""))
.replace("void initGraph(PerfGraph* fps, int style, const char* name)",
("""#endif
void initGraph(PerfGraph* fps, int style, const char* name)
"""))
)


0 comments on commit 9ee800e

Please sign in to comment.