Skip to content
Jeffrey Carpenter edited this page Jul 16, 2026 · 31 revisions

scratchpad

nomlib-builder

docker images

  • i8degrees/nomlib-builder:0.13.1-amd64

  • i8degrees/nomlib-builder:0.13.1-amd64-libs

nomlib-builder

amd64/libs

  • cleanup after each build, i.e.:
    • make distclean || make clean

osx

  1. git clone git@github.com:i8degrees/nomlib.git
  2. download existing deps from nomlib.479831.xyz/frs -- common and osx
  3. extract to third-party/common and third-party/osx
  4. mkdir build && cd build
  5. cmake -DDEBUG=on -DDEBUG_ASSERT=on -DEXAMPLES=on -DNOM_BUILD_TESTS=off -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_INSTALL_PREFIX=$HOME/Library/Frameworks ..

x86_64-apple-darwin22.4-clang x86_64-apple-darwin22.4-clang++

windows

cmake -S $(pwd) -B $(pwd)/build --preset build-debug-clang-cl ...

clang-cl

linux

cmake -S $(pwd) -B $(pwd)/build --preset build-debug-clang-linux

cmake -S/app --preset debug-clang-linux
cmake --build /app/build/debug-clang-linux
cmake --build /app/build/debug-clang-linux --target help
cmake --build /app/build/debug-clang-linux --target device_info

macos

docker run --rm -it -v /home/jeff/Projects/nomlib.git:/app
-v nomlib-libs:/app/vendor
i8degrees/nomlib-builder:0.13.1-amd64-macos

cmake -S/app -B/app/build.osx.test.2 -DFRAMEWORK=off -DEXAMPLES=on
-DNOM_BUILD_TESTS=off -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
-DCMAKE_TOOLCHAIN_FILE=/app/cmake/toolchains/osxcross.cmake
-DNOMLIB_DEPS_DIR=/app/third-party/osx
-DSDL2_LIBRARY=/app/third-party/osx/SDL2.framework
-DSDL2_INCLUDE_DIR=/app/third-party/osx/SDL2.framework/Headers/
-DSDL2_IMAGE_LIBRARY=/app/third-party/osx/SDL2_image.framework/
-DSDL2_IMAGE_INCLUDE_DIR=/app/third-party/osx/SDL2_image.framework/Headers
-DSDL2_TTF_LIBRARY=/app/third-party/osx/SDL2_ttf.framework/
-DSDL2_TTF_INCLUDE_DIR=/app/third-party/osx/SDL2_ttf.framework/Headers
-DLIBROCKET_CORE_LIBRARY=/app/third-party/osx/librocket/lib/libRocketCore.1.dylib
-DLIBROCKET_CONTROLS_LIBRARY=/app/third-party/osx/librocket/lib/libRocketControls.1.dylib
-DLIBROCKET_DEBUGGER_LIBRARY=/app/third-party/osx/librocket/lib/libRocketDebugger.1.dylib
-DLIBROCKET_CORE_INCLUDE_DIR=/app/third-party/osx/librocket/include
-DLIBROCKET_CONTROLS_INCLUDE_DIR=/app/third-party/osx/librocket/include
-DLIBROCKET_DEBUGGER_INCLUDE_DIR=/app/third-party/osx/librocket/include

SDL2_IMAGE_INCLUDE_DIR:PATH=/usr/local/osxcross/target/macports/pkgs/opt/local/include/SDL2/SDL_image.h SDL2_IMAGE_LIBRARY:FILEPATH=/usr/local/osxcross/target/macports/pkgs/opt/local/lib/libSDL2_image-2.0.0.dylib SDL2_INCLUDE_DIR:PATH=/usr/local/osxcross/target/macports/pkgs/opt/local/include/SDL2 SDL2_LIBRARY:STRING=/usr/local/osxcross/target/macports/pkgs/opt/local/lib/libSDL2.dylib SDL2_TTF_INCLUDE_DIR:PATH=/usr/local/osxcross/target/macports/pkgs/opt/local/include/SDL2/SDL_ttf.h SDL2_TTF_LIBRARY:FILEPATH=/usr/local/osxcross/target/macports/pkgs/opt/local/lib/libSDL2_ttf-2.0.0.dylib

MacOSX11.1.sdk

NOMLIB_DEPS_DIR=$2 # script arg
# "$HOME/Projects/nomlib.git/third-party/vcpkg_vendor.zip"
BUILD_DIR=$1 # script arg
# ~/Projects/nomlib.git/build/debug/
mkdir $BUILD_DIR && cd $BUILD_DIR
bsdtar -xf ~/Projects/nomlib.git/third-party/vcpkg_vendor.zip --strip-components 1

VCPKG_ROOT=/home/jeff/.local/share/vcpkg VCPKG_OVERLAY_PORTS=$VCPKG_ROOT/ports/librocket VCPKG_TARGET_TRIPLET=x64-linux CMAKE_TOOLCHAIN_FILE=/home/jeff/.local/share/vcpkg/scripts/buildsystems/vcpkg.cmake

  • fix link errors by investigating the API (diff) for the two method calls:
/usr/bin/ld: CMakeFiles/libRocketDataGridTest.dir/datagrid/CardsPageDataSource.cpp.o: undefined reference to symbol '_ZN6Rocket8Controls10DataSource15NotifyRowChangeERKNS_4Core10StringBaseIcEE'
/usr/bin/ld: /home/jeff/Projects/nomlib.git/build/release/vcpkg_installed/x64-linux-dynamic/lib/libRocketControls.so.1: error adding symbols: DSO missing from command line

/usr/bin/ld: CMakeFiles/libRocketTest.dir/libRocketTest.cpp.o: undefined reference to symbol '_ZN6Rocket4Core7Element11SetPropertyERKNS0_10StringBaseIcEERKNS0_8PropertyE'
/usr/bin/ld: /home/jeff/Projects/nomlib.git/build/release/vcpkg_installed/x64-linux-dynamic/lib/libRocketCore.so.1: error adding symbols: DSO missing from command line
  • investigate why libRocket is returning custom for its version

  • file bug for renderfont example, the given file path should be transformed into an absolute path, or we should append the current working directory to the path that is given;

    • add cwd.currentPath() to file path
  • file bug for resolving ImageDiffTest errors due to resources path; add + "tests" + p.native()

    • const std::string RESOURCES_PATH = cwd.currentPath() + p.native() + "Resources" + p.native() + "tests" + p.native() + "ImageDiffTest" + p.native();
  • We must rethink nom::init() with the automatic current working directory path being set is what produces errors like the above and also seen in nom_font exe and likely others

    • The existing implementation is correct for when the executable is executed from within an isolated bundle, i.e.: MacOSX application or framework, or AppImage / Flatpak, but otherwise breaks for when the exe is operating within a global filesystem space such as when running from a terminal

cmake -S . --preset release-static cmake -S . --preset release-dynamic

cmake --build build/release-static --target all cmake --build build/release-dynamic --target all

cmake --install build/release-static
--component Runtime --component Development --component Documentation
--component Core

cmake --install build/release-dynamic
--component Runtime --component Development --component Documentation
--component Core

  • move unused cmake modules at cmake/modules/ to Resources/CMake or so

  • remove cmake/toolchains/vcpkg.cmake

  • add init_nom_cmdline_args function using TCLAP (privately)

  • add example with three cmdline args -- input & output filename and rescale algo (hqx or scale2x) -- for rescaling an image

  • pull latest gamecontrollerdb.txt from db in a FetchContent call inside vendor/CMakeLists.txt and add it to Resources/SharedSupport for redistribution

  • add license to licenses

  • wiki.git/patches/microtar.cmake

  • wiki.git/patches/CPackConfig.cmake

  • see if this accomplishes what we want!

Automatically copy dependencies into the install target

directory for executables. Requires CMake 3.14

X_VCPKG_APPLOCAL_DEPS_INSTALL=ON

  • macosx VCPKG_PREFER_SYSTEM_LIBS=ON

  • we need to update our libRocket v1.3.0.1 fork by creating a patch that removes the i386 arch out of OSX_ARCHITECTURES in Build/CMakeLists.txt; we fail to build nomlib on our MacOSX buildbox when building libRocket as a dynamic shared library with the debug-dynamic-osx cmake preset

  • as part of the BUILD_DOCS option, we should consider adding adding the documentation files of (at minimum) tclap

  • file a bug report on our JSON serialization and de-serialization classes missing several top-level fields of vcpkg.json that can be seen in both the parsing output and when we save the output to a file -- testme.json -- as of this writing

  • append to the end of existing git sha 35f888a --

Thanks to our nom_jsonpp example, we caught a bug in the serialization of an array value within an object when trying to parse the inventory.json test file at Resources/tests/serializers/json/inventory.json.

build/debug-dyn/bin/nom_jsonpp build/debug-dyn/bin/inventory.json
ERROR: Could not serialize values; an array cannot exist within another array.
INFO: Stubbed function bool nom::JsonCppSerializer::write_object(const Value &, Json::Value &) const was called
ERROR: Could not serialize values; invalid object?
ERROR: Could not serialize the source object.
  • patches/JsonCppSerializer.patch

  • investigate why we do not see the unused param / function warnings on Linux whereas we do on MacOSX -- I believe that we must have the wrong CXX flag applied for this, or that some flag(s) are applied only under MacOSX?

  • consider adding the detected OS stamp for the platform when using the visual unit testing framework -- we could do this as a comment, or better yet, introduce a new field named os_stamp or such with an option for modifying it by the end-user

  • update our library targets back to using the full semantic version for the VERSION target property

  • update our unit test library targets back to using the full semantic version for the VERSION target property

  • relocate library targets from tests/CMakeLists.txt to src

    • tests/include -> include/nomlib/tests
    • tests/src/* -> tests
    • Resources/tests -> tests/Resources
  • integrate .clang-tidy and .clang-format

xcodebuild cflags

fmessage-length\=135 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -std\=c++11 -stdlib\=libc++ -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Debug\" -Dnomlib_audio_EXPORTS -isysroot /Volumes/Developer/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body

macosx xcode gen

[macosx] building nomlib examples (and probably tests) are broken when using xcode generator due to missing dependencies, i.e.: libSDL2-image late into the build cycle (post build copy phase). I believe that if we were to NOT copy the dependencies that are shown in examples/<nom_app_ex>/CMakeLists.txt when the Xcode generator is detected.

additionally, the code signing build phase appears to be failing, perhaps due to a lack of explicit setting like we do in the library targets (see framework properties setup)

once we finish the packaging scripts (cmake) for Darwin, most of these issues are expected to be resolved, or at least resolvable.

[macosx] building nomlib's tests are broken when using the Xcode generator due to an unknown mixup with googletest's static archive lib being filed as libgtestd.a whereas it should be libgtest.a - without the debug lib suffix.

Clone this wiki locally