Skip to content

Commit

Permalink
add CI CPack mode, create CMake CI package presets
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastaZIuk committed Jul 3, 2023
1 parent 2034cef commit 473a179
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 12 deletions.
53 changes: 50 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"NBL_BUILD_OPTIX": "OFF",
"NBL_BUILD_MITSUBA_LOADER": "OFF",
"NBL_BUILD_RADEON_RAYS": "OFF",
"NBL_RUN_TESTS": "ON"
"NBL_RUN_TESTS": "ON",
"NBL_CPACK_CI": "ON"
}
},
{
Expand Down Expand Up @@ -107,14 +108,14 @@
"name": "ci-build-static-ninja-multi",
"configurePreset": "ci-configure-static-ninja-multi",
"displayName": "CI build-static Ninja Multi-Config",
"description": "CI preset for static build inheritance",
"description": "CI static build using Ninja Multi-Config generator",
"inherits": "ci-build-static-dev"
},
{
"name": "ci-build-dynamic-ninja-multi",
"configurePreset": "ci-configure-dynamic-ninja-multi",
"displayName": "CI build-dynamic Ninja Multi-Config",
"description": "CI preset for dynamic build inheritance",
"description": "CI dynamic build using Ninja Multi-Config generator",
"inherits": "ci-build-dynamic-dev"
},
{
Expand All @@ -131,5 +132,51 @@
"description": "CI dynamic build using Visual Studio generator and MSVC toolset, windows as host only",
"inherits": "ci-build-dynamic-dev"
}
],
"packagePresets": [
{
"name": "ci-package-dev",
"hidden": true
},
{
"name": "ci-package-static-dev",
"hidden": true,
"inherits": "ci-package-dev",
"packageName": "nabla-static-ci"
},
{
"name": "ci-package-dynamic-dev",
"hidden": true,
"inherits": "ci-package-dev",
"packageName": "nabla-dynamic-ci"
},
{
"name": "ci-build-static-ninja-multi",
"inherits": "ci-package-static-dev",
"configurePreset": "ci-configure-static-ninja-multi",
"displayName": "CI package-static Ninja Multi-Config",
"description": "CI static package using Ninja Multi-Config generator"
},
{
"name": "ci-build-dynamic-ninja-multi",
"inherits": "ci-package-dynamic-dev",
"configurePreset": "ci-configure-dynamic-ninja-multi",
"displayName": "CI package-dynamic Ninja Multi-Config",
"description": "CI dynamic package using Ninja Multi-Config generator"
},
{
"name": "ci-build-static-msvc",
"inherits": "ci-package-static-dev",
"configurePreset": "ci-configure-static-msvc",
"displayName": "CI package-static Visual Studio MSVC windows-host-only",
"description": "CI static package using Visual Studio generator and MSVC toolset, windows as host only"
},
{
"name": "ci-build-dynamic-msvc",
"inherits": "ci-package-dynamic-dev",
"configurePreset": "ci-configure-dynamic-msvc",
"displayName": "CI package-dynamic Visual Studio MSVC windows-host-only",
"description": "CI dynamic package using Visual Studio generator and MSVC toolset, windows as host only"
}
]
}
22 changes: 13 additions & 9 deletions cmake/cpack/package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

if(NBL_CPACK_CI)
message(WARNING "CI CPack mode turned ON, CPack will install only projects which have been built successfully by overriding CPACK_INSTALL_CMAKE_PROJECTS")
else()
set(CPACK_COMPONENTS_ALL Headers Libraries Runtimes)
endif()

if(WIN32)
set(CPACK_GENERATOR "ZIP")
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
Expand All @@ -32,8 +38,6 @@ set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

set(CPACK_COMPONENTS_ALL Headers Libraries Runtimes)

set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers")
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_RUNTIMES_DISPLAY_NAME "Runtimes")
Expand All @@ -42,18 +46,18 @@ set(CPACK_COMPONENT_HEADERS_GROUP "development")
set(CPACK_COMPONENT_LIBRARIES_GROUP "development")
set(CPACK_COMPONENT_RUNTIMES_GROUP "development")

if(NBL_CPACK_INCLUDE_EXAMPLES)
list(APPEND CPACK_COMPONENTS_ALL Media) # TODO: add Executables conditionally only if there is at least 1 which has been built successfully
if(NBL_CPACK_INCLUDE_EXAMPLES AND NOT NBL_CPACK_CI)
list(APPEND CPACK_COMPONENTS_ALL Media)

#set(CPACK_COMPONENT_EXECUTABLES_DISPLAY_NAME "Examples")
set(CPACK_COMPONENT_EXECUTABLES_DISPLAY_NAME "Examples")
set(CPACK_COMPONENT_MEDIA_DISPLAY_NAME "Media")

#set(CPACK_COMPONENT_EXECUTABLES_DESCRIPTION "Example executables built with Nabla library")
set(CPACK_COMPONENT_EXECUTABLES_DESCRIPTION "Example executables built with Nabla library")
set(CPACK_COMPONENT_MEDIA_DESCRIPTION "Media files Nabla example executables load resources from")

#set(CPACK_COMPONENT_EXECUTABLES_DEPENDS Media)
set(CPACK_COMPONENT_EXECUTABLES_DEPENDS Media)

#set(CPACK_COMPONENT_EXECUTABLES_GROUP "executables")
set(CPACK_COMPONENT_EXECUTABLES_GROUP "executables")
set(CPACK_COMPONENT_MEDIA_GROUP "executables")
endif()

Expand All @@ -68,6 +72,6 @@ endif()

set(CPACK_COMPONENT_HEADERS_DEPENDS Libraries Runtimes)

set(CPACK_THREADS 0) # try to use all threads for compression
set(CPACK_THREADS 0) # try to use all threads for compression

include(CPack)

0 comments on commit 473a179

Please sign in to comment.