Skip to content

Commit eda26f6

Browse files
Updating build process and launch.json definition for VSCode (#373)
* updated build proc and lauch for vscode * updated launcher json * cleaned up launcher * fixed publish output of launcher * fixed target output name * fixed post build for macos env
1 parent f4dd52e commit eda26f6

File tree

5 files changed

+88
-124
lines changed

5 files changed

+88
-124
lines changed

.vscode/launch.json

Lines changed: 30 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,104 +2,64 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": "Sandbox3D (Darwin Debug)",
6-
"type": "cppdbg",
5+
"name": "Panzerfaust (Windows Debug)",
6+
"type": "coreclr",
77
"request": "launch",
8-
"program": "${workspaceFolder}/Result.Darwin.x64.Debug/Examples/Sandbox3D/src/sandbox3d",
8+
"program": "${workspaceFolder}/Result.Windows.x64.MultiConfig/Panzerfaust/Debug/net6.0/win-x64/publish/Panzerfaust.dll",
99
"args": [],
10-
"stopAtEntry": false,
1110
"cwd": "${workspaceFolder}",
12-
"environment": [],
13-
"externalConsole": false,
14-
"MIMode": "lldb"
11+
"stopAtEntry": false,
12+
"console": "internalConsole",
1513
},
1614
{
17-
"name": "Sandbox3D (Darwin Release)",
18-
"type": "cppdbg",
15+
"name": "Panzerfaust (Windows Release)",
16+
"type": "coreclr",
1917
"request": "launch",
20-
"program": "${workspaceFolder}/Result.Darwin.x64.Release/Examples/Sandbox3D/src/sandbox3d",
18+
"program": "${workspaceFolder}/Result.Windows.x64.MultiConfig/Panzerfaust/Release/net6.0/win-x64/publish/Panzerfaust.dll",
2119
"args": [],
22-
"stopAtEntry": false,
2320
"cwd": "${workspaceFolder}",
24-
"environment": [],
25-
"externalConsole": false,
26-
"MIMode": "lldb"
21+
"stopAtEntry": false,
22+
"console": "internalConsole",
2723
},
2824
{
29-
"name": "Sandbox3D (Linux Debug)",
30-
"type": "cppdbg",
25+
"name": "Panzerfaust (macOS x64 Debug)",
26+
"type": "coreclr",
3127
"request": "launch",
32-
"program": "${workspaceFolder}/Result.Linux.x64.Debug/Examples/Sandbox3D/src/sandbox3d",
28+
"program": "${workspaceFolder}/Result.Darwin.x64.Debug/Panzerfaust/Debug/net6.0/osx-x64/publish/Panzerfaust.dll",
3329
"args": [],
30+
"cwd": "${workspaceFolder}",
3431
"stopAtEntry": false,
35-
"cwd": "${workspaceFolder}",
36-
"environment": [],
37-
"externalConsole": false,
38-
"MIMode": "gdb",
39-
"setupCommands": [
40-
{
41-
"description": "Enable pretty-printing for gdb",
42-
"text": "-enable-pretty-printing",
43-
"ignoreFailures": true
44-
}
45-
]
32+
"console": "internalConsole",
4633
},
4734
{
48-
"name": "Sandbox3D (Linux Release)",
49-
"type": "cppdbg",
35+
"name": "Panzerfaust (macOS x64 Release)",
36+
"type": "coreclr",
5037
"request": "launch",
51-
"program": "${workspaceFolder}/Result.Linux.x64.Release/Examples/Sandbox3D/src/sandbox3d",
38+
"program": "${workspaceFolder}/Result.Darwin.x64.Release/Panzerfaust/Release/net6.0/osx-x64/publish/Panzerfaust.dll",
5239
"args": [],
53-
"stopAtEntry": false,
5440
"cwd": "${workspaceFolder}",
55-
"environment": [],
56-
"externalConsole": false,
57-
"MIMode": "gdb",
58-
"setupCommands": [
59-
{
60-
"description": "Enable pretty-printing for gdb",
61-
"text": "-enable-pretty-printing",
62-
"ignoreFailures": true
63-
}
64-
]
41+
"stopAtEntry": false,
42+
"console": "internalConsole",
6543
},
6644
{
67-
"name": "Sandbox2D (Linux Debug)",
68-
"type": "cppdbg",
45+
"name": "Panzerfaust (macOS ARM64 Debug)",
46+
"type": "coreclr",
6947
"request": "launch",
70-
"program": "${workspaceFolder}/Result.Linux.x64.Debug/Examples/Sandbox/src/sandbox2d",
48+
"program": "${workspaceFolder}/Result.Darwin.x64.Debug/Panzerfaust/Debug/net6.0/osx-arm64/publish/Panzerfaust.dll",
7149
"args": [],
72-
"stopAtEntry": false,
7350
"cwd": "${workspaceFolder}",
74-
"environment": [],
75-
"externalConsole": false,
76-
"MIMode": "gdb",
77-
"setupCommands": [
78-
{
79-
"description": "Enable pretty-printing for gdb",
80-
"text": "-enable-pretty-printing",
81-
"ignoreFailures": true
82-
}
83-
]
51+
"stopAtEntry": false,
52+
"console": "internalConsole",
8453
},
8554
{
86-
"name": "Sandbox2D (Linux Release)",
87-
"type": "cppdbg",
55+
"name": "Panzerfaust (macOS ARM64 Release)",
56+
"type": "coreclr",
8857
"request": "launch",
89-
"program": "${workspaceFolder}/Result.Linux.x64.Release/Examples/Sandbox/src/sandbox2d",
58+
"program": "${workspaceFolder}/Result.Darwin.x64.Release/Panzerfaust/Release/net6.0/osx-arm64/publish/Panzerfaust.dll",
9059
"args": [],
91-
"stopAtEntry": false,
9260
"cwd": "${workspaceFolder}",
93-
"environment": [],
94-
"externalConsole": false,
95-
"MIMode": "gdb",
96-
"setupCommands": [
97-
{
98-
"description": "Enable pretty-printing for gdb",
99-
"text": "-enable-pretty-printing",
100-
"ignoreFailures": true
101-
}
102-
]
61+
"stopAtEntry": false,
62+
"console": "internalConsole",
10363
}
10464
]
10565
}

CMakeLists.txt

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -79,54 +79,36 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
7979
set_property (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Panzerfaust)
8080
endif ()
8181

82-
8382
# Post build operation
8483
#
8584
set (SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
86-
87-
if (NOT LAUNCHER_ONLY)
88-
set (BUILD_LAUNCHER_DEPENDS_LIB zEngineLib tetragrama)
89-
endif ()
90-
91-
add_custom_target (BuildLauncher ALL
92-
COMMENT "Building Panzerfaust"
93-
DEPENDS ${BUILD_LAUNCHER_DEPENDS_LIB}
94-
)
95-
96-
if(APPLE)
97-
add_custom_command (TARGET BuildLauncher
98-
POST_BUILD
99-
COMMAND dotnet build ${CMAKE_CURRENT_SOURCE_DIR}/Panzerfaust/Panzerfaust.csproj -r $<IF:$<BOOL:${MACOSX_ARCHITECTURE_ARM64}>,osx-arm64,osx-x64> -c $<IF:$<CONFIG:Debug>,Debug,Release> -v n
100-
)
101-
else()
102-
add_custom_command (TARGET BuildLauncher
103-
POST_BUILD
104-
COMMAND dotnet build ${CMAKE_CURRENT_SOURCE_DIR}/Panzerfaust/Panzerfaust.csproj -c $<IF:$<CONFIG:Debug>,Debug,Release> -v n
105-
)
106-
endif ()
107-
108-
109-
add_custom_target (AssembleContent ALL
110-
COMMENT "Copying assets and resources contents"
111-
DEPENDS BuildLauncher
112-
)
113-
114-
115-
set (SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
116-
if ((${CMAKE_SYSTEM_NAME} STREQUAL "Windows") OR (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
117-
set (SYSTEM_ARCHITECTURE "x64")
85+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
86+
set (SYSTEM_ARCHITECTURE "win-x64")
87+
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
88+
set (SYSTEM_ARCHITECTURE "linux-x64")
11889
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
11990
if (MACOSX_ARCHITECTURE_ARM64)
12091
set (SYSTEM_ARCHITECTURE "osx-arm64")
12192
else ()
12293
set (SYSTEM_ARCHITECTURE "osx-x64")
12394
endif ()
12495
endif ()
125-
add_custom_command (TARGET AssembleContent
126-
POST_BUILD
96+
97+
add_custom_target (AssembleContent ALL
98+
COMMENT "Copying assets and resources contents"
12799
COMMAND pwsh ${CMAKE_CURRENT_SOURCE_DIR}/Scripts/PostBuild.ps1 -SystemName ${SYSTEM_NAME} -Architectures ${SYSTEM_ARCHITECTURE} -Configurations $<IF:$<CONFIG:Debug>,Debug,Release> $<$<BOOL:${LAUNCHER_ONLY}>:-LauncherOnly>
128100
)
129101

102+
if (NOT LAUNCHER_ONLY)
103+
add_dependencies(AssembleContent zEngineLib tetragrama)
104+
endif ()
105+
106+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
107+
add_dependencies(AssembleContent Panzerfaust-WinBuild)
108+
else ()
109+
add_dependencies(AssembleContent Panzerfaust)
110+
endif ()
111+
130112
# Copying Examples dir
131113
#
132114
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Examples/projectConfig.json)

Panzerfaust/CMakeLists.txt

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,40 @@ project (Panzerfaust
55
DESCRIPTION "Panzerfaust, the ZEngine Launcher"
66
)
77

8-
if ((APPLE) OR (CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022"))
9-
set(CSPROJ Panzerfaust)
10-
11-
restore_nuget_packages(
12-
${CMAKE_CURRENT_LIST_DIR}/${CSPROJ}.csproj)
13-
14-
include_external_msproject(
15-
${CSPROJ}
16-
${CMAKE_CURRENT_LIST_DIR}/${CSPROJ}.csproj
17-
PLATFORM "x64"
18-
TYPE "4301B74A-9ED7-48ED-9DE5-FC2E1457778D"
19-
GUID "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"
20-
)
8+
set(CSPROJ Panzerfaust)
9+
set (CSPROJ_SOURCE_FILE ${CMAKE_CURRENT_LIST_DIR}/${CSPROJ}.csproj)
10+
11+
if ((APPLE) OR (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
12+
13+
restore_nuget_packages(${CSPROJ_SOURCE_FILE})
14+
15+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
16+
include_external_msproject(
17+
${CSPROJ}
18+
${CSPROJ_SOURCE_FILE}
19+
PLATFORM "x64"
20+
TYPE "4301B74A-9ED7-48ED-9DE5-FC2E1457778D"
21+
GUID "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"
22+
)
23+
endif ()
2124
endif()
2225

26+
set (BUILD_CONFIGURATION -c $<IF:$<CONFIG:Debug>,Debug,Release>)
27+
if (APPLE)
28+
set (RUNTIME_IDENTIFIER -r $<IF:$<BOOL:${MACOSX_ARCHITECTURE_ARM64}>,osx-arm64,osx-x64>)
29+
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
30+
set (RUNTIME_IDENTIFIER -r win-x64)
31+
endif ()
32+
33+
set (CUSTOM_TARGET_NAME ${CSPROJ})
34+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
35+
set (CUSTOM_TARGET_NAME Panzerfaust-WinBuild)
36+
endif ()
37+
add_custom_target (${CUSTOM_TARGET_NAME} ALL)
38+
39+
add_custom_command (TARGET ${CUSTOM_TARGET_NAME} POST_BUILD
40+
COMMENT "Building and Publishing Panzerfaust"
41+
COMMAND dotnet build ${CSPROJ_SOURCE_FILE} ${RUNTIME_IDENTIFIER} ${BUILD_CONFIGURATION} -v n
42+
COMMAND dotnet publish ${CSPROJ_SOURCE_FILE} ${RUNTIME_IDENTIFIER} ${BUILD_CONFIGURATION}
43+
VERBATIM
44+
)

Panzerfaust/Panzerfaust.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PropertyGroup Condition=" $([MSBuild]::IsOSPlatform('Windows')) == 'true' AND '$(Configuration)' == 'Debug' ">
1515
<PlatformTarget>x64</PlatformTarget>
1616
<DebugSymbols>true</DebugSymbols>
17-
<DebugType>full</DebugType>
17+
<DebugType>portable</DebugType>
1818
<Optimize>false</Optimize>
1919
<OutputPath>$(BaseOutputPath)\Panzerfaust\$(Configuration)</OutputPath>
2020
<DefineConstants>TRACE;DEBUG;_WIN32</DefineConstants>

Scripts/PostBuild.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ param (
2828
[string[]] $SystemName = 'Windows',
2929

3030
[Parameter(HelpMessage="Architecture type to build, default to x64")]
31-
[ValidateSet('x64', 'arm64', 'osx-x64', 'osx-arm64')]
32-
[string[]] $Architectures = 'x64',
31+
[ValidateSet('win-x64', 'arm64', 'osx-x64', 'osx-arm64')]
32+
[string[]] $Architectures = 'win-x64',
3333

3434
[Parameter(HelpMessage="Configuration type to build, default to Debug")]
3535
[ValidateSet('Debug', 'Release')]
@@ -83,15 +83,15 @@ $ContentsToProcess = @(
8383
Contents = @(
8484
switch ($SystemName) {
8585
"Windows" {
86-
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\Editor"}
86+
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\$Architectures\publish\Editor"}
8787
}
8888
"Darwin" {
8989
switch ($Architectures) {
9090
"osx-x64" {
91-
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\$Architectures\Editor"}
91+
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\$Architectures\publish\Editor"}
9292
}
9393
"osx-arm64" {
94-
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\$Architectures\Editor"}
94+
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\$Architectures\publish\Editor"}
9595
}
9696
Default {
9797
throw 'This architecture is not supported'

0 commit comments

Comments
 (0)