cmake(dotnet): Use USE_DOTNET_CORE_31 and USE_DOTNET_6
This commit is contained in:
@@ -232,14 +232,14 @@ if(BUILD_DOTNET)
|
||||
|
||||
# .Net Core 3.1 LTS is not available for osx arm64
|
||||
if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
|
||||
set(USE_DOTNET_TFM_31 OFF)
|
||||
set(USE_DOTNET_CORE_31 OFF)
|
||||
else()
|
||||
option(USE_DOTNET_TFM_31 "Use .Net Core 3.1 LTS support" ON)
|
||||
option(USE_DOTNET_CORE_31 "Use .Net Core 3.1 LTS support" ON)
|
||||
endif()
|
||||
message(STATUS ".Net: Use .Net Core 3.1 LTS support: ${USE_DOTNET_TFM_31}")
|
||||
message(STATUS ".Net: Use .Net Core 3.1 LTS support: ${USE_DOTNET_CORE_31}")
|
||||
|
||||
option(USE_DOTNET_TFM_60 "Use .Net 6.0 LTS support" ON)
|
||||
message(STATUS ".Net: Use .Net 6.0 LTS support: ${USE_DOTNET_TFM_60}")
|
||||
option(USE_DOTNET_6 "Use .Net 6.0 LTS support" ON)
|
||||
message(STATUS ".Net: Use .Net 6.0 LTS support: ${USE_DOTNET_6}")
|
||||
endif()
|
||||
|
||||
if(BUILD_JAVA)
|
||||
|
||||
@@ -194,6 +194,9 @@ cmake -S. -Bbuild -LH
|
||||
| `BUILD_JAVA_EXAMPLES` | ON\* | Build all Java examples<br>**Forced** to OFF if `BUILD_JAVA=OFF` or `BUILD_SAMPLE=OFF` |
|
||||
| `BUILD_DOTNET_EXAMPLES` | ON\* | Build all .Net examples<br>**Forced** to OFF if `BUILD_DOTNET=OFF` or `BUILD_SAMPLE=OFF` |
|
||||
| | | |
|
||||
| `USE_DOTNET_CORE_31` | ON | Enable .Net Core 3.1 LTS support<br>Only available if `BUILD_DOTNET=ON` |
|
||||
| `USE_DOTNET_6` | ON | Enable .Net 6 LTS support<br>Only available if `BUILD_DOTNET=ON` |
|
||||
| | | |
|
||||
| `SKIP_GPG` | OFF | Disable GPG sign<br>Only available if `BUILD_JAVA=ON` |
|
||||
| `UNIVERSAL_JAVA_PACKAGE` | OFF | Build a multi platform package (i.e. `ortools-java` will depends on all native packages)<br>Only available if `BUILD_JAVA=ON` |
|
||||
| `BUILD_FAT_JAR` | OFF | Build a `ortools-java` .jar that includes all of its own Maven dependencies, including the native package<br>Only available if `BUILD_JAVA=ON` |
|
||||
|
||||
@@ -23,7 +23,7 @@ COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN cmake -version
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install -v
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ WORKDIR /home/project
|
||||
COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN cmake -version
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install -v
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN cmake -version
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install -v
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN cmake -version
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install -v
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN cmake -version
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install -v
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ COPY . .
|
||||
FROM devel AS build
|
||||
RUN cmake -S. -Bbuild -DBUILD_DEPS=OFF \
|
||||
-DUSE_COINOR=ON -DUSE_GLPK=ON -DUSE_SCIP=OFF \
|
||||
-DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
-DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN cmake -version
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_TFM_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DUSE_DOTNET_CORE_31=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
RUN cmake --build build --target install -v
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ else()
|
||||
endif()
|
||||
|
||||
# see: https://docs.microsoft.com/en-us/dotnet/standard/frameworks
|
||||
if(USE_DOTNET_TFM_31 AND USE_DOTNET_TFM_60)
|
||||
if(USE_DOTNET_CORE_31 AND USE_DOTNET_6)
|
||||
set(DOTNET_TFM "<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>")
|
||||
elseif(USE_DOTNET_TFM_60)
|
||||
elseif(USE_DOTNET_6)
|
||||
set(DOTNET_TFM "<TargetFramework>net6.0</TargetFramework>")
|
||||
elseif(USE_DOTNET_TFM_31)
|
||||
elseif(USE_DOTNET_CORE_31)
|
||||
set(DOTNET_TFM "<TargetFramework>netcoreapp3.1</TargetFramework>")
|
||||
else()
|
||||
message(FATAL_ERROR "No .Net SDK selected !")
|
||||
@@ -396,13 +396,13 @@ function(add_dotnet_sample FILE_NAME)
|
||||
WORKING_DIRECTORY ${DOTNET_SAMPLE_DIR})
|
||||
|
||||
if(BUILD_TESTING)
|
||||
if(USE_DOTNET_TFM_31)
|
||||
if(USE_DOTNET_CORE_31)
|
||||
add_test(
|
||||
NAME dotnet_${COMPONENT_NAME}_${SAMPLE_NAME}_netcoreapp31
|
||||
COMMAND ${DOTNET_EXECUTABLE} run --no-build --framework netcoreapp3.1 -c Release
|
||||
WORKING_DIRECTORY ${DOTNET_SAMPLE_DIR})
|
||||
endif()
|
||||
if(USE_DOTNET_TFM_60)
|
||||
if(USE_DOTNET_6)
|
||||
add_test(
|
||||
NAME dotnet_${COMPONENT_NAME}_${SAMPLE_NAME}_net60
|
||||
COMMAND ${DOTNET_EXECUTABLE} run --no-build --framework net6.0 -c Release
|
||||
@@ -467,13 +467,13 @@ function(add_dotnet_example FILE_NAME)
|
||||
WORKING_DIRECTORY ${DOTNET_EXAMPLE_DIR})
|
||||
|
||||
if(BUILD_TESTING)
|
||||
if(USE_DOTNET_TFM_31)
|
||||
if(USE_DOTNET_CORE_31)
|
||||
add_test(
|
||||
NAME dotnet_${COMPONENT_NAME}_${EXAMPLE_NAME}_netcoreapp31
|
||||
COMMAND ${DOTNET_EXECUTABLE} run --no-build --framework netcoreapp3.1 -c Release
|
||||
WORKING_DIRECTORY ${DOTNET_EXAMPLE_DIR})
|
||||
endif()
|
||||
if(USE_DOTNET_TFM_60)
|
||||
if(USE_DOTNET_6)
|
||||
add_test(
|
||||
NAME dotnet_${COMPONENT_NAME}_${EXAMPLE_NAME}_net60
|
||||
COMMAND ${DOTNET_EXECUTABLE} run --no-build --framework net6.0 -c Release
|
||||
|
||||
@@ -8,7 +8,7 @@ WORKDIR /home/project
|
||||
COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN make dotnet CMAKE_ARGS="-DUSE_DOTNET_TFM_31=OFF"
|
||||
RUN make dotnet CMAKE_ARGS="-DUSE_DOTNET_CORE_31=OFF"
|
||||
|
||||
FROM build AS test
|
||||
RUN make test_dotnet
|
||||
|
||||
@@ -20,7 +20,7 @@ WORKDIR /home/project
|
||||
COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN make dotnet CMAKE_ARGS="-DUSE_DOTNET_TFM_31=OFF"
|
||||
RUN make dotnet CMAKE_ARGS="-DUSE_DOTNET_CORE_31=OFF"
|
||||
|
||||
FROM build AS test
|
||||
RUN make test_dotnet
|
||||
|
||||
@@ -89,7 +89,7 @@ RUN make archive_cpp
|
||||
## build
|
||||
FROM cpp_build AS dotnet_build
|
||||
RUN make detect_dotnet \
|
||||
&& make dotnet CMAKE_ARGS="-DUSE_DOTNET_TFM_31=OFF" JOBS=8
|
||||
&& make dotnet CMAKE_ARGS="-DUSE_DOTNET_CORE_31=OFF" JOBS=8
|
||||
## archive
|
||||
FROM dotnet_build AS dotnet_archive
|
||||
RUN make archive_dotnet
|
||||
|
||||
Reference in New Issue
Block a user