Skip to content

update rgbds 1.0.3 - #151

Closed
SelvinPL wants to merge 4 commits into
gbdev:masterfrom
SelvinPL:feature/rgbds_v1.0.3
Closed

update rgbds 1.0.3#151
SelvinPL wants to merge 4 commits into
gbdev:masterfrom
SelvinPL:feature/rgbds_v1.0.3

Conversation

@SelvinPL

@SelvinPL SelvinPL commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

apply fixes for build:

  • createSymbol(intern(name))
  • ZLIB::ZLIB and PNG::PNG
  • temporarily override execute_process for passing rgbds version correctly

apply fixes for build:
- createSymbol(intern(name))
- ZLIB::ZLIB and PNG::PNG
- temporarily override execute_process for passing rgbds version correctly
@Rangi42
Rangi42 requested a review from ISSOtm August 3, 2026 10:00
@SelvinPL

SelvinPL commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

instead hacking execute_process it would be nice if rgbds would not use git for obtaining version if fx there is some CMAKE var already

Comment thread CMakeLists.txt Outdated
# we need only those targets from rgbds
set(RGBDS_TARGETS rgbasm rgblink rgbfix)

# no git for you rgbds

@SelvinPL SelvinPL Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that current build takes version from tag ... but ... with our build ${CMAKE_SOURCE_DIR}
points to rgbds-live not rgbds ...
this change forces cmake to land in this path https://github.com/gbdev/rgbds/blob/v1.0.3/CMakeLists.txt#L100C5-L100C96

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems simpler to modify it to be CMAKE_CURRENT_SOURCE_DIR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. i belive i tried it
  2. there will be "-dirty" problem still

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap

-- Determining RGBDS version from Git history
-- Determining RGBDS version from Git history - 9d3bf94-dirty
CMake Warning at rgbds/CMakeLists.txt:109 (message):
  No `v*` Git tag reachable; falling back
# # no git for you rgbds
# # this hack will stop rgbds build from obtain rgbds-live version from git
# # it will be passed via BUILD_VERSION_STRING
# macro(execute_process)
#     if("${ARGV}" MATCHES "describe")
#         set(result 1)
#     else()
#         _execute_process(${ARGV})
#     endif()
# endmacro()

set(CMAKE_CURRENT_SOURCE_DIR_BCKUP ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rgbds)

# and we will put em into this target
add_custom_target(rgbds)

# importing rgbds
add_subdirectory(rgbds EXCLUDE_FROM_ALL)

# restore execute_process
macro(execute_process)
    _execute_process(${ARGV})
endmacro()

# target specific configuration for rgbds
foreach(TGT ${RGBDS_TARGETS})
    if(TARGET ${TGT})
        set_target_properties(${TGT} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${RGBDS_LIVE_OUT_DIR}")
        if("${TGT}" STREQUAL "rgbasm")
            set(EXP_NAME "createRgbAsm")
        elseif("${TGT}" STREQUAL "rgblink")
            set(EXP_NAME "createRgbLink")
        elseif("${TGT}" STREQUAL "rgbfix")
            set(EXP_NAME "createRgbFix")
        endif()
        target_compile_definitions(${TGT} PRIVATE BUILD_VERSION_STRING="${RGBDS_VERSION_FROM_GIT}")
        target_link_options(${TGT} PRIVATE 
            "-sEXPORT_NAME=${EXP_NAME}"
            "-sEXPORTED_RUNTIME_METHODS=['FS']"
            )
        add_dependencies(rgbds ${TGT})
    endif()
endforeach()
add_dependencies(rgbds_live rgbds)

set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR_BCKUP})

still not working

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've tried with

set(CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rgbds" CACHE PATH "" FORCE)

also with CMAKE_SOURCE_DIR ... it doesn't work

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... it would be so much easier with gbdev/rgbds#1604

@SelvinPL SelvinPL Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set(CMAKE_DISABLE_FIND_PACKAGE_Git ON)
add_subdirectory(rgbds EXCLUDE_FROM_ALL)
unset(CMAKE_DISABLE_FIND_PACKAGE_Git)

less hacky

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but only if we do no use

find_program(RGBDS_LIVE_GIT NAMES git)
if(RGBDS_LIVE_GIT)

instead

find_package(Git REQUIRED)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.0.3 incorporates gbdev/rgbds@d5033a2bd, which does use find_package(Git). Either way, RGBDS needs a few build system fixes/improvements.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure were are we going here ...

  • adding patch is bad idea ... you change the cmake script and patch will stop working (that's why we are here - not build script but changes in source and patch incompatibility)
  • i've provied solution and i've tested "modify it to be CMAKE_CURRENT_SOURCE_DIR" - it is not working

@SelvinPL

SelvinPL commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

only caveat with latest solution is when we start tagging this repo with "vXXXX"
it will fail

-- Determining RGBDS version from Git history - v1.0.3-4-g3831883-dirty
CMake Error at rgbds/CMakeLists.txt:111 (message):
  Version mismatch! Git says v1.0.3,

            version.hpp says v!

Comment thread CMakeLists.txt
@SelvinPL

SelvinPL commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

for summary, I see 3 solutions:

  1. currently proposed
# setting version in common target sets it globaly
if(TARGET common)
    target_compile_definitions(common PRIVATE "BUILD_VERSION_STRING=\"${RGBDS_VERSION_FROM_GIT}\"")
    target_compile_options(common PRIVATE -Wno-macro-redefined)
endif()
  • pros: we are not hacking find_package behavior
  • cons: if we start tagging with "vXXX" this repo, there will be conflict
  1. disable ability to acces git in rgbds
  • pros: we are depending on fallback (as per @Rangi42 comment - but only if git access is disabled in other case we hit this), so in fact we could get rid of checking rgbds version with git at all
  • cons: it's hacky way ... so we need to switch from find_package to find_program in out script for accessing git (like applying patch)
  1. patching rgbd's cmake script
  • pros: i don't see any
  • cons: it will kick our bottoms every time rgbd's cmake script will be changed (well, it's exaggeration - only if patched part would be changed - i just hate when my "perfect" build script fails )

ISSOtm added a commit that referenced this pull request Aug 15, 2026
Inspired by @SelvinPL's change in #151, but avoiding `CACHE FORCE`,
and using the newer flag introduced in Emscripten 3.1.54 (2024).
Thanks for the reference!
@ISSOtm ISSOtm mentioned this pull request Aug 15, 2026
ISSOtm added a commit that referenced this pull request Aug 15, 2026
Inspired by @SelvinPL's change in #151, but avoiding `CACHE FORCE`,
and using the newer flag introduced in Emscripten 3.1.54 (2024).
Thanks for the reference!
ISSOtm added a commit that referenced this pull request Aug 15, 2026
Inspired by #151, but avoiding `CACHE FORCE`,
and using the newer flag introduced in Emscripten 3.1.54 (2024).
Thanks for the reference!

Co-authored-by: SelvinPL <przemek.sulikowski@gmail.com>
Rangi42 added a commit that referenced this pull request Aug 15, 2026
* Handle the patching of subprojects in a more debuggable way

Previously, if the patch failed to apply *for any reason*,
we would assume it was already applied.

Additionally, some of the provided options were sloppy
and turn out not to be necessary at this point anyway.

Finally, we now immediately abort configuring if any of the patches
fail to apply, preventing any spurious errors that our patches may
have been meant to avoid.

* Re-run CMake automatically if any patch file is changed

* Bridge Emscripten's ports system better

Inspired by #151, but avoiding `CACHE FORCE`,
and using the newer flag introduced in Emscripten 3.1.54 (2024).

* Update binjgb and configure it in a more robust way

Its `option` entries can (and do) override ours on first build,
whereas `set()` takes precedence (but requires forcing it to honour
a policy introduced in CMake 3.13, ugh).

Related binjgb updating work in #155, for reference.

* Force RGBDS to ignore its Git tags

* Build in parallel in CI

* Build with latest Node

We were being bumped automatically to Node 24 by GitHub anyway,
so might as well bite that bullet.

* Cache NPM packages in CI

* Build as many files as possible on CI failure

So that we can get the most failures out of a single run,
and thus the most info.

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: ISSOtm <me@eldred.fr>
Co-authored-by: SelvinPL <przemek.sulikowski@gmail.com>
Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
@Rangi42 Rangi42 closed this in #149 Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants