Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,11 @@ WASM target configured with `-DNAJA_SCHEMATIC_WASM_MODULE=ON` (single file,
wasm inlined, `createNajaSchematic({canvas, ...})` factory, one instance per
canvas), built by `.github/workflows/python-package.yml`, which also tests
the wheel and publishes it to PyPI on a `v<version>` tag (version in
`naja_schematic/__init__.py`). For local work set `NAJA_SCHEMATIC_BUNDLE` to
a locally built bundle (see `_bundle.py`). Tests: `pytest python/tests`.
`naja_schematic/__init__.py`, the project's single version: `CMakeLists.txt`
also reads it into `NAJA_SCHEMATIC_VERSION_STRING` for the C++ app's About
dialog, so a release is one edit plus a tag). For local work set
`NAJA_SCHEMATIC_BUNDLE` to a locally built bundle (see `_bundle.py`). Tests:
`pytest python/tests`.

## Architecture

Expand Down
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ else()
endif()
message(STATUS "naja-schematic commit: ${NAJA_SCHEMATIC_GIT_HASH}")

# ------------------------------------------------------------
# naja-schematic version: single source of truth is the Python package's
# __version__ (what hatch builds the wheel from and CI checks the release
# tag against), so the app's About dialog can't drift from the release
# ------------------------------------------------------------
file(STRINGS ${CMAKE_SOURCE_DIR}/python/naja_schematic/__init__.py
NAJA_SCHEMATIC_VERSION_LINE REGEX "^__version__ = \"[^\"]*\"")
string(REGEX REPLACE ".*\"([^\"]*)\".*" "\\1" NAJA_SCHEMATIC_VERSION
"${NAJA_SCHEMATIC_VERSION_LINE}")
if(NOT NAJA_SCHEMATIC_VERSION)
message(FATAL_ERROR
"Could not read __version__ from python/naja_schematic/__init__.py")
endif()
message(STATUS "naja-schematic version: ${NAJA_SCHEMATIC_VERSION}")

# ------------------------------------------------------------
# naja version (read from the submodule's literal, not built — needed on
# both targets since both interface with naja: native links it directly,
Expand Down Expand Up @@ -149,6 +164,7 @@ if(EMSCRIPTEN_BUILD)
set_target_properties(naja-schematic PROPERTIES SUFFIX ${NAJA_SCHEMATIC_WASM_SUFFIX})
target_compile_definitions(naja-schematic PRIVATE
NAJA_SCHEMATIC_GIT_HASH="${NAJA_SCHEMATIC_GIT_HASH}"
NAJA_SCHEMATIC_VERSION_STRING="${NAJA_SCHEMATIC_VERSION}"
NAJA_VERSION_STRING="${NAJA_VERSION}"
)

Expand Down Expand Up @@ -198,6 +214,7 @@ else()

target_compile_definitions(naja-schematic-standalone PRIVATE
NAJA_SCHEMATIC_GIT_HASH="${NAJA_SCHEMATIC_GIT_HASH}"
NAJA_SCHEMATIC_VERSION_STRING="${NAJA_SCHEMATIC_VERSION}"
NAJA_VERSION_STRING="${NAJA_VERSION}"
)

Expand Down
2 changes: 2 additions & 0 deletions python/naja_schematic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- From a shell: ``naja-schematic --verilog design.v --open`` serves the
viewer page and opens it in a browser.
"""
# Single version for the whole project: CMakeLists.txt reads this line into the
# C++ app too (NAJA_SCHEMATIC_VERSION_STRING), so keep it a plain literal.
__version__ = "0.1.1"

from .protocol import diagnosis_response, handle_request
Expand Down
3 changes: 1 addition & 2 deletions src/AppLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ using json = nlohmann::json;
#include "SelectionStore.h"
#include "PropertiesView.h"
#include "DroidSansFont.h"
#include "Version.h"

#ifndef __EMSCRIPTEN__
#include <fstream>
Expand Down Expand Up @@ -721,7 +720,7 @@ bool appFrame(AppState& state) {
ImGui::Separator();
ImGui::Spacing();

ImGui::Text("Version: %s", naja_schematic::VERSION.c_str());
ImGui::Text("Version: %s", NAJA_SCHEMATIC_VERSION_STRING);
ImGui::Text("Commit: %s", NAJA_SCHEMATIC_GIT_HASH);
ImGui::Text("naja: %s", NAJA_VERSION_STRING);
ImGui::Text("Project: github.com/najaeda/naja-schematic");
Expand Down
36 changes: 0 additions & 36 deletions src/Version.h

This file was deleted.

Loading