-
Notifications
You must be signed in to change notification settings - Fork 38
CMake changes for NixOS #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
40ed7c3
da9d27f
305a0ae
c294a1c
ca7d0ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,8 +34,9 @@ all: configure build sign-dmg verify-signed | |||||||||||||||||||||
| apple: notarize staple verify-notarization | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| configure: | ||||||||||||||||||||||
| @echo "Configuring build for type $(BUILD_TYPE) in directory $(BUILD_DIR), using Python from $(PYTHON_TO_USE)" | ||||||||||||||||||||||
| cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DPYTHON_EXECUTABLE=$(PYTHON_TO_USE) -DCODESIGN_CERTIFICATE_NAME="$(APPLE_DEVELOPER_IDENTITY)" | ||||||||||||||||||||||
| export KNOBKRAFT_EXTERNAL_VERSION="$(cmake -P cmake/calc_version.cmake)" | ||||||||||||||||||||||
| @echo "Configuring build for type $(BUILD_TYPE) in directory $(BUILD_DIR), using Python from $(PYTHON_TO_USE). Version is $KNOBKRAFT_EXTERNAL_VERSION" | ||||||||||||||||||||||
| cmake -S . -B $(BUILD_DIR) -DKNOBKRAFT_EXTERNAL_VERSION=$KNOBKRAFT_EXTERNAL_VERSION -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DPYTHON_EXECUTABLE=$(PYTHON_TO_USE) -DCODESIGN_CERTIFICATE_NAME="$(APPLE_DEVELOPER_IDENTITY)" | ||||||||||||||||||||||
|
Comment on lines
36
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Fix Makefile syntax error. Line 37 is indented, making it a recipe command that appears before the target's prerequisites, which violates Make syntax. The pipeline error "commands commence before first target" confirms this. Apply this diff to fix the syntax: configure:
- export KNOBKRAFT_EXTERNAL_VERSION="$(cmake -P cmake/calc_version.cmake)"
- @echo "Configuring build for type $(BUILD_TYPE) in directory $(BUILD_DIR), using Python from $(PYTHON_TO_USE). Version is $KNOBKRAFT_EXTERNAL_VERSION"
- cmake -S . -B $(BUILD_DIR) -DKNOBKRAFT_EXTERNAL_VERSION=$KNOBKRAFT_EXTERNAL_VERSION -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DPYTHON_EXECUTABLE=$(PYTHON_TO_USE) -DCODESIGN_CERTIFICATE_NAME="$(APPLE_DEVELOPER_IDENTITY)"
+ $(eval KNOBKRAFT_EXTERNAL_VERSION := $(shell cmake -P cmake/calc_version.cmake))
+ @echo "Configuring build for type $(BUILD_TYPE) in directory $(BUILD_DIR), using Python from $(PYTHON_TO_USE). Version is $(KNOBKRAFT_EXTERNAL_VERSION)"
+ cmake -S . -B $(BUILD_DIR) -DKNOBKRAFT_EXTERNAL_VERSION=$(KNOBKRAFT_EXTERNAL_VERSION) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DPYTHON_EXECUTABLE=$(PYTHON_TO_USE) -DCODESIGN_CERTIFICATE_NAME="$(APPLE_DEVELOPER_IDENTITY)"📝 Committable suggestion
Suggested change
🧰 Tools🪛 checkmake (0.2.2)[warning] 36-36: Target "configure" should be declared PHONY. (phonydeclared) 🪛 GitHub Actions: macOS KnobKraft Orm[error] 38-38: Makefile:38: *** commands commence before first target. Stop. 🤖 Prompt for AI Agents
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did I fix it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: Length of output: 707 @christofmuc Good news and bad news! ✅ You fixed the indentation issue - all three lines now use tabs correctly, so the "commands commence before first target" error should be gone.
In Makefiles, each recipe line runs in its own separate shell. So when line 37 runs Two solutions:
configure:
$(eval KNOBKRAFT_EXTERNAL_VERSION := $(shell cmake -P cmake/calc_version.cmake))
@echo "Configuring build for type $(BUILD_TYPE) in directory $(BUILD_DIR), using Python from $(PYTHON_TO_USE). Version is $(KNOBKRAFT_EXTERNAL_VERSION)"
cmake -S . -B $(BUILD_DIR) -DKNOBKRAFT_EXTERNAL_VERSION=$(KNOBKRAFT_EXTERNAL_VERSION) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DPYTHON_EXECUTABLE=$(PYTHON_TO_USE) -DCODESIGN_CERTIFICATE_NAME="$(APPLE_DEVELOPER_IDENTITY)"
configure:
export KNOBKRAFT_EXTERNAL_VERSION="$$(cmake -P cmake/calc_version.cmake)"; \
echo "Configuring build for type $(BUILD_TYPE) in directory $(BUILD_DIR), using Python from $(PYTHON_TO_USE). Version is $$KNOBKRAFT_EXTERNAL_VERSION"; \
cmake -S . -B $(BUILD_DIR) -DKNOBKRAFT_EXTERNAL_VERSION=$$KNOBKRAFT_EXTERNAL_VERSION -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DPYTHON_EXECUTABLE=$(PYTHON_TO_USE) -DCODESIGN_CERTIFICATE_NAME="$(APPLE_DEVELOPER_IDENTITY)"Note the I'd recommend option 1 as it's cleaner and more Makefile-idiomatic. |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| .PHONY: build | ||||||||||||||||||||||
| build $(KNOBKRAFT_DMG): | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,19 +6,8 @@ | |
|
|
||
| cmake_minimum_required(VERSION 3.14) | ||
|
|
||
| # Get the version from our sub cmakefile | ||
| execute_process( | ||
| COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_LIST_DIR}/gitversion.cmake" | ||
| ERROR_VARIABLE PROJECT_VERSION | ||
| ERROR_STRIP_TRAILING_WHITESPACE | ||
| ) | ||
| # Cleanup output | ||
| string(REGEX REPLACE "^[[:space:]]+|[[:space:]]+$" "" PROJECT_VERSION "${PROJECT_VERSION}") | ||
| string(REGEX REPLACE "\n$" "" PROJECT_VERSION "${PROJECT_VERSION}") | ||
| message(STATUS "Project version is '${PROJECT_VERSION}'") | ||
|
|
||
| # Start project | ||
| project(KnobKraftOrm VERSION ${PROJECT_VERSION}) | ||
| project(KnobKraftOrm VERSION ${KNOBKRAFT_EXTERNAL_VERSION}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add validation for KNOBKRAFT_EXTERNAL_VERSION. If +if(NOT DEFINED KNOBKRAFT_EXTERNAL_VERSION OR KNOBKRAFT_EXTERNAL_VERSION STREQUAL "")
+ message(FATAL_ERROR "KNOBKRAFT_EXTERNAL_VERSION must be set. Please pass -DKNOBKRAFT_EXTERNAL_VERSION=<version> to CMake.")
+endif()
+
project(KnobKraftOrm VERSION ${KNOBKRAFT_EXTERNAL_VERSION})🤖 Prompt for AI Agents |
||
|
|
||
| # Now you can use PROJECT_DEV_TAG in your CMake scripts or in your code to handle the "-dev" part. | ||
| # For example, you could add a preprocessor definition that your code could use: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Get the version from our sub cmakefile | ||
| execute_process( | ||
| COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_LIST_DIR}/gitversion.cmake" | ||
| ERROR_VARIABLE PROJECT_VERSION | ||
| ERROR_STRIP_TRAILING_WHITESPACE | ||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| # Cleanup output | ||
| string(REGEX REPLACE "^[[:space:]]+|[[:space:]]+$" "" PROJECT_VERSION "${PROJECT_VERSION}") | ||
| string(REGEX REPLACE "\n$" "" PROJECT_VERSION "${PROJECT_VERSION}") | ||
| message("${PROJECT_VERSION}") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.