File tree 6 files changed +34
-13
lines changed
6 files changed +34
-13
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ execute_process(COMMAND dotnet --version
10
10
if (result)
11
11
message (WARNING "CMake failed: dotnet executable not found but by this build. You must install dotnet to generate csharp bindings" )
12
12
else ()
13
+ set (PLATFORM x64)
14
+ if (NOT DEFINED CMAKE_GENERATOR_PLATFORM)
15
+ set (PLATFORM x64)
16
+ elseif ("${CMAKE_GENERATOR_PLATFORM} " STREQUAL "Win32" )
17
+ set (PLATFORM x86)
18
+ ENDIF ()
13
19
message (STATUS "Found dotnet executable CSHARP bindings will be generated!" )
14
20
add_custom_command (OUTPUT ${OUTPUT}
15
21
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:screen_capture_lite_shared> ${CMAKE_CURRENT_LIST_DIR}
20
26
COMMAND ${CMAKE_COMMAND} -E copy
21
27
${CMAKE_CURRENT_LIST_DIR} /Program .cs
22
28
${CMAKE_BINARY_DIR} /Example_CSharp
23
- COMMAND dotnet build --configuration ${CMAKE_BUILD_TYPE} ${CMAKE_BINARY_DIR} /Example_CSharp/${CSPROJ} -o ${CMAKE_BINARY_DIR}
24
- COMMENT "Building DOTNET Example ${ CMAKE_BINARY_DIR} /${OUTPUT } "
29
+ COMMAND dotnet build --configuration ${CMAKE_BUILD_TYPE} /p:Platform= ${PLATFORM} ${CMAKE_BINARY_DIR} /Example_CSharp/${CSPROJ} -o ${CMAKE_BINARY_DIR}
30
+ COMMENT "Building ${PROJECT_NAME} dotnet build --configuration ${CMAKE_BUILD_TYPE} /p:Platform= ${PLATFORM} ${ CMAKE_BINARY_DIR} /Example_CSharp/ ${CSPROJ} -o ${CMAKE_BINARY_DIR } "
25
31
)
26
32
add_custom_target (${PROJECT_NAME} ALL DEPENDS ${OUTPUT} )
27
33
add_dependencies (${PROJECT_NAME} screen_capture_lite_csharp)
Original file line number Diff line number Diff line change 3
3
<PropertyGroup >
4
4
<OutputType >Exe</OutputType >
5
5
<TargetFramework >net5.0</TargetFramework >
6
- <EnableDefaultCompileItems >false</EnableDefaultCompileItems >
6
+ <EnableDefaultCompileItems >false</EnableDefaultCompileItems >
7
+ <Platforms >x64;x86</Platforms >
7
8
</PropertyGroup >
8
9
9
10
<ItemGroup >
Original file line number Diff line number Diff line change @@ -7,14 +7,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "screen_capture_lite_example
7
7
EndProject
8
8
Global
9
9
GlobalSection (SolutionConfigurationPlatforms ) = preSolution
10
- Debug| Any CPU = Debug| Any CPU
11
- Release| Any CPU = Release| Any CPU
10
+ Debug| x64 = Debug| x64
11
+ Debug| x86 = Debug| x86
12
+ Release| x64 = Release| x64
13
+ Release| x86 = Release| x86
12
14
EndGlobalSection
13
15
GlobalSection (ProjectConfigurationPlatforms ) = postSolution
14
- {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Debug| Any CPU .ActiveCfg = Debug| Any CPU
15
- {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Debug| Any CPU .Build .0 = Debug| Any CPU
16
- {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Release| Any CPU .ActiveCfg = Release| Any CPU
17
- {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Release| Any CPU .Build .0 = Release| Any CPU
16
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Debug| x64 .ActiveCfg = Debug| x64
17
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Debug| x64 .Build .0 = Debug| x64
18
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Debug| x86 .ActiveCfg = Debug| x86
19
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Debug| x86 .Build .0 = Debug| x86
20
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Release| x64 .ActiveCfg = Release| x64
21
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Release| x64 .Build .0 = Release| x64
22
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Release| x86 .ActiveCfg = Release| x86
23
+ {24D20C01-8959-4C09-99A0-9AD0681E1B53} .Release| x86 .Build .0 = Release| x86
18
24
EndGlobalSection
19
25
GlobalSection (SolutionProperties ) = preSolution
20
26
HideSolutionNode = FALSE
Original file line number Diff line number Diff line change 10
10
steps :
11
11
- task : CMake@1
12
12
inputs :
13
- cmakeArgs : ' .. -G"Visual Studio 16 2019" -A ${{ parameters.targetPlatform }} -DCMAKE_INSTALL_PREFIX=./output'
13
+ cmakeArgs : ' .. -G"Visual Studio 16 2019" -DCMAKE_GENERATOR_PLATFORM=${{ parameters.targetPlatform }} - A ${{ parameters.targetPlatform }} -DCMAKE_INSTALL_PREFIX=./output'
14
14
- task : CMake@1
15
15
inputs :
16
16
cmakeArgs : ' --build . --target INSTALL'
Original file line number Diff line number Diff line change @@ -9,7 +9,14 @@ execute_process(COMMAND dotnet --version
9
9
ERROR_QUIET)
10
10
if (result)
11
11
message (WARNING "CMake failed: dotnet executable not found but by this build. You must install dotnet to generate csharp bindings" )
12
- else ()
12
+ else ()
13
+ set (PLATFORM x64)
14
+ if (NOT DEFINED CMAKE_GENERATOR_PLATFORM)
15
+ set (PLATFORM x64)
16
+ elseif ("${CMAKE_GENERATOR_PLATFORM} " STREQUAL "Win32" )
17
+ set (PLATFORM x86)
18
+ ENDIF ()
19
+
13
20
message (STATUS "Found dotnet executable CSHARP bindings will be generated!" )
14
21
add_custom_command (OUTPUT ${OUTPUT}
15
22
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:screen_capture_lite_shared> ${CMAKE_CURRENT_LIST_DIR}
20
27
COMMAND ${CMAKE_COMMAND} -E copy
21
28
${CMAKE_CURRENT_LIST_DIR} /Screen_Capture_Lite.cs
22
29
${CMAKE_BINARY_DIR} /src_csharp
23
- COMMAND dotnet build --configuration ${CMAKE_BUILD_TYPE} ${CMAKE_BINARY_DIR} /src_csharp/${CSPROJ} -o ${CMAKE_BINARY_DIR}
24
- COMMENT "Building DOTNET assembly ${ CMAKE_BINARY_DIR} /${OUTPUT } "
30
+ COMMAND dotnet build --configuration ${CMAKE_BUILD_TYPE} /p:Platform= ${PLATFORM} ${CMAKE_BINARY_DIR} /src_csharp/${CSPROJ} -o ${CMAKE_BINARY_DIR}
31
+ COMMENT "Building ${PROJECT_NAME} dotnet build --configuration ${CMAKE_BUILD_TYPE} /p:Platform= ${PLATFORM} ${ CMAKE_BINARY_DIR} /src_csharp/ ${CSPROJ} -o ${CMAKE_BINARY_DIR } "
25
32
)
26
33
27
34
add_custom_target (${PROJECT_NAME} ALL DEPENDS ${OUTPUT} )
Original file line number Diff line number Diff line change 2
2
3
3
<PropertyGroup >
4
4
<TargetFramework >net5.0</TargetFramework >
5
+ <Platforms >x64;x86</Platforms >
5
6
</PropertyGroup >
6
7
7
8
</Project >
You can’t perform that action at this time.
0 commit comments