[single branch] Introduce preview.h and Makefile option LIBDRAGON_PREVIEW - #954
Open
Dragorn421 wants to merge 3 commits into
Open
[single branch] Introduce preview.h and Makefile option LIBDRAGON_PREVIEW#954Dragorn421 wants to merge 3 commits into
preview.h and Makefile option LIBDRAGON_PREVIEW#954Dragorn421 wants to merge 3 commits into
Conversation
Dragorn421
force-pushed
the
experimental
branch
8 times, most recently
from
July 23, 2026 19:19
528c7c8 to
936df79
Compare
LIBDRAGON_PREVIEW
LIBDRAGON_PREVIEWpreview.h and Makefile option LIBDRAGON_PREVIEW
Dragorn421
marked this pull request as ready for review
July 29, 2026 21:02
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Goal
Not have to maintain two different branches: trunk and preview
To that end, the idea is to drop the trunk branch and keep only the preview branch.
However to keep the ability of experimenting with new APIs that are not yet stable, there still needs to be a clear distinction between stable APIs and preview APIs
A choice has also been made to make the preview opt-in switch a n64.mk option, that is, NOT a libdragon build time option. So an installed libdragon toolchain will be able to be used for compiling both stable-using and preview-using projects.
The changes
n64.mknow hasLIBDRAGON_PREVIEW ?= 0. Setting to 1 enables usage of preview APIs.This variable controls appending
-DLIBDRAGON_PREVIEWor not to the compiler/assembler flags, which controls the definitions of macros in new fileinclude/preview.h. These are the macros under stable (i.e. the defaultLIBDRAGON_PREVIEW=0):HAVE_PREVIEWASSERT_PREVIEWto make compilation error on including themPREVIEW_API, making compilation error on calling themBuilding libdragon
Building libdragon, in particular building the preview APIs parts, requires preview APIs to be usable. To that effect, the
Makefileandtools/Makefilemakefiles unconditionally define theLIBDRAGON_BUILD_TIMEmacro (i.e. pass-DLIBDRAGON_BUILD_TIMEto the compiler) which makespreview.h(see above) behave as ifLIBDRAGON_PREVIEWwas defined, allowing usage and compilation of preview APIs.CI
CI (github actions) has been amended to build examples and test roms for both stable and preview.
The system in action
The rest of the changes are about tagging the OpenGL implementation and APIs/tools building upon it as preview, for demonstration purposes. For example:
GL/gl.husesASSERT_PREVIEWto make compilation error unless previewHAVE_PREVIEWis used to conditionally includemodel64.hfromlibdragon.honly if preview APIs are availableHAVE_PREVIEWis also used in the test rom source to only include opengl tests under preview (otherwise the build would error)