Skip to content

Conversation

@ThomasParenteau
Copy link
Member

@ThomasParenteau ThomasParenteau commented Oct 9, 2025

Solution to #289

Pass OutputPath dynamically via MSBuild command-line parameter instead of hardcoding it in the .csproj file. This allows each build configuration to output to its correct directory.

Changes

  1. Nexo.csproj.in:

    • Removed hardcoded
    • Moved AppendTargetFrameworkToOutputPath settings to main PropertyGroup
  2. CMakeLists.txt:

    • Removed NEXO_MANAGED_OUTPUT_DIR_REL variable
    • Added OutputPath=${CMAKE_BINARY_DIR} to dotnet build command
    • Updated ADDITIONAL_CLEAN_FILES to use CMAKE_BINARY_DIR directly

Summary by CodeRabbit

  • Chores
    • Aligned managed build outputs to support multi-configuration builds and standardized cleanup to the new artifact location.
  • Refactor
    • Simplified project settings by consolidating output path handling and removing redundant configuration.
  • Notes
    • No user-facing features or API changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

The build now passes OutputPath to the managed project via MSBuild (/p:OutputPath) from CMake, removing prior NEXO_MANAGED_OUTPUT_DIR logic and related relative-path computation. The .csproj consolidates properties and no longer hard-sets OutputPath. Clean-up targets were updated to reference artifacts under ${CMAKE_BINARY_DIR}.

Changes

Cohort / File(s) Summary
CMake: Managed build output and cleanup
engine/src/scripting/managed/CMakeLists.txt
Removed NEXO_MANAGED_OUTPUT_DIR and relative path calc; invoke msbuild with /p:OutputPath for multi-config; adjusted clean file list to ${CMAKE_BINARY_DIR} Nexo artifacts; updated target comment to include configuration.
.NET project properties consolidation
engine/src/scripting/managed/Nexo.csproj.in
Moved AppendTargetFrameworkToOutputPath and AppendRuntimeIdentifierToOutputPath into main PropertyGroup; removed dedicated PropertyGroup that set OutputPath to @NEXO_MANAGED_OUTPUT_DIR_REL@; OutputPath now supplied via command line.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title “fix: multi profile on scripting” is phrased like a commit message and uses vague terminology that does not clearly summarize the main change of enabling multi-configuration builds by dynamically passing the OutputPath in CMake and the .csproj file. It doesn’t specify what aspect of scripting is affected or how it was fixed, making it difficult for reviewers to understand the core update at a glance. Consider renaming the pull request to something more descriptive, for example “Enable multi-config scripting builds by passing OutputPath via CMake,” so that it clearly highlights the dynamic OutputPath change and its impact on multi-configuration builds.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/scripting-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ThomasParenteau
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af845f6 and e985807.

📒 Files selected for processing (2)
  • engine/src/scripting/managed/CMakeLists.txt (1 hunks)
  • engine/src/scripting/managed/Nexo.csproj.in (1 hunks)
🔇 Additional comments (2)
engine/src/scripting/managed/Nexo.csproj.in (1)

11-13: LGTM! Clean consolidation of OutputPath handling.

The changes correctly:

  • Consolidate the append properties into the main PropertyGroup
  • Remove the hardcoded OutputPath in favor of command-line parameter
  • Document the new approach with a clear comment

This aligns with the PR objective of supporting multi-config builds by making OutputPath dynamic.

Note: If OutputPath is not provided via command line (e.g., manual dotnet build), MSBuild will use its default output structure (bin/<config>/<framework>/). This is acceptable since the project is intended to be built via CMake.

engine/src/scripting/managed/CMakeLists.txt (1)

75-82: Update clean paths for configuration-specific outputs
ADDITIONAL_CLEAN_FILES doesn’t expand generator expressions (e.g. $), so you’ll need to:
• Define a custom clean target that resolves config-specific paths at generate time
• Or explicitly list each configuration’s output directories (Debug, Release, etc.)
• Or use a supported glob pattern to match all configs

Comment on lines +64 to 72
# Build step with OutputPath passed as parameter to support multi-config builds
add_custom_target(nexoManaged ALL
COMMAND ${DOTNET_EXECUTABLE} build Nexo.csproj
${ARCH_ARG}
-c $<CONFIG> # Matches Debug/Release configuration
/p:OutputPath=${CMAKE_BINARY_DIR}/ # Pass OutputPath dynamically based on build directory
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} # Working directory for the build
COMMENT "Building .NET managed project (Nexo.csproj)..."
COMMENT "Building .NET managed project (Nexo.csproj) for $<CONFIG> configuration..."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: OutputPath doesn't separate configurations for multi-config generators.

The OutputPath is set to ${CMAKE_BINARY_DIR}/ without including the configuration subdirectory. For multi-config generators (Visual Studio, Ninja Multi-Config), Debug and Release builds will output to the same directory and overwrite each other's artifacts.

Apply this diff to properly separate configurations:

-                  /p:OutputPath=${CMAKE_BINARY_DIR}/  # Pass OutputPath dynamically based on build directory
+                  /p:OutputPath=${CMAKE_BINARY_DIR}/$<CONFIG>/  # Pass OutputPath dynamically with config subdirectory

This ensures each configuration (Debug/Release/etc.) outputs to its own subdirectory (e.g., build/Debug/, build/Release/), preventing artifacts from overwriting each other in multi-config builds.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Build step with OutputPath passed as parameter to support multi-config builds
add_custom_target(nexoManaged ALL
COMMAND ${DOTNET_EXECUTABLE} build Nexo.csproj
${ARCH_ARG}
-c $<CONFIG> # Matches Debug/Release configuration
/p:OutputPath=${CMAKE_BINARY_DIR}/ # Pass OutputPath dynamically based on build directory
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} # Working directory for the build
COMMENT "Building .NET managed project (Nexo.csproj)..."
COMMENT "Building .NET managed project (Nexo.csproj) for $<CONFIG> configuration..."
)
# Build step with OutputPath passed as parameter to support multi-config builds
add_custom_target(nexoManaged ALL
COMMAND ${DOTNET_EXECUTABLE} build Nexo.csproj
${ARCH_ARG}
-c $<CONFIG> # Matches Debug/Release configuration
/p:OutputPath=${CMAKE_BINARY_DIR}/$<CONFIG>/ # Pass OutputPath dynamically with config subdirectory
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} # Working directory for the build
COMMENT "Building .NET managed project (Nexo.csproj) for $<CONFIG> configuration..."
)
🤖 Prompt for AI Agents
In engine/src/scripting/managed/CMakeLists.txt around lines 64 to 72, OutputPath
is set to ${CMAKE_BINARY_DIR}/ which causes different configurations to write to
the same folder; change the OutputPath to include the configuration subdirectory
so multi-config generators separate outputs (for example set
/p:OutputPath=${CMAKE_BINARY_DIR}/$<CONFIG>/ or equivalent) so
Debug/Release/etc. produce isolated build directories and avoid overwriting
artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants