Skip to content

Commit e911370

Browse files
authored
fix: multi profile on scripting (#428)
## 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 <OutputPath> - 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 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents ded8f6a + b45a7c0 commit e911370

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

engine/src/scripting/managed/CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ cmake_minimum_required(VERSION 3.20)
1818
project(nexoManaged LANGUAGES NONE)
1919

2020
# Define variables for configuration
21-
set(NEXO_MANAGED_OUTPUT_DIR ${CMAKE_BINARY_DIR})
22-
file(RELATIVE_PATH NEXO_MANAGED_OUTPUT_DIR_REL "${CMAKE_CURRENT_LIST_DIR}" "${NEXO_MANAGED_OUTPUT_DIR}")
2321
set(NEXO_FRAMEWORK "net9.0")
2422

2523
set(SOURCES
@@ -63,21 +61,22 @@ else()
6361
endif()
6462

6563

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

7574
# Clean step
7675
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
77-
${NEXO_MANAGED_OUTPUT_DIR}/Nexo.dll
78-
${NEXO_MANAGED_OUTPUT_DIR}/Nexo.pdb
79-
${NEXO_MANAGED_OUTPUT_DIR}/Nexo.runtimeconfig.json
80-
${NEXO_MANAGED_OUTPUT_DIR}/Nexo.deps.json
76+
${CMAKE_BINARY_DIR}/Nexo.dll
77+
${CMAKE_BINARY_DIR}/Nexo.pdb
78+
${CMAKE_BINARY_DIR}/Nexo.runtimeconfig.json
79+
${CMAKE_BINARY_DIR}/Nexo.deps.json
8180
${CMAKE_CURRENT_LIST_DIR}/obj
8281
${CMAKE_CURRENT_LIST_DIR}/bin
8382
)

engine/src/scripting/managed/Nexo.csproj.in

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
<EnableDynamicLoading>true</EnableDynamicLoading>
99
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
1010
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
11+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
12+
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
13+
<!-- OutputPath is passed via command line from CMake to support multi-config builds -->
1114
</PropertyGroup>
1215

1316
<ItemGroup>
1417
<Compile Include="@SOURCES@" />
1518
</ItemGroup>
1619

17-
<PropertyGroup>
18-
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
19-
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
20-
<OutputPath>@NEXO_MANAGED_OUTPUT_DIR_REL@</OutputPath>
21-
</PropertyGroup>
22-
2320
</Project>

0 commit comments

Comments
 (0)