Skip to content

Commit

Permalink
ENH: Define and export version in configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasGandel committed Sep 18, 2024
1 parent 07b6a32 commit 792d00e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ endforeach()

project(CudaCommon)

## CudaCommon Version
set(CUDACOMMON_VERSION_MAJOR "2")
set(CUDACOMMON_VERSION_MINOR "0")
set(CUDACOMMON_VERSION_PATCH "0")
set(CUDACOMMON_VERSION_STRING "${CUDACOMMON_VERSION_MAJOR}.${CUDACOMMON_VERSION_MINOR}")

#=========================================================
# Installation variables
#=========================================================
if(NOT CudaCommon_INSTALL_INCLUDE_DIR)
set(CudaCommon_INSTALL_INCLUDE_DIR include/CudaCommon)
endif()

if(NOT ITK_SOURCE_DIR)
include(itk-module-init.cmake)
endif()
Expand All @@ -27,6 +40,12 @@ if(NOT ITK_SOURCE_DIR)
find_package(ITK 5.2 REQUIRED)
endif()

# Propagate cmake options in a header file
configure_file(${CudaCommon_SOURCE_DIR}/cudaCommonConfiguration.h.in
${CudaCommon_BINARY_DIR}/cudaCommonConfiguration.h)

list(APPEND CudaCommon_INCLUDE_DIRS ${CudaCommon_BINARY_DIR})

set(CudaCommon_EXPORT_CODE_BUILD "
# Pass source dir to allow other modules, e.g. RTK, to use CudaImage.i.init and CudaImage.i.in
set(CudaCommon_SOURCE_DIR ${CudaCommon_SOURCE_DIR})
Expand All @@ -43,3 +62,6 @@ else()
set(ITK_DIR ${CMAKE_BINARY_DIR})
itk_module_impl()
endif()

# Install configuration file
install(FILES ${CudaCommon_BINARY_DIR}/cudaCommonConfiguration.h DESTINATION ${CudaCommon_INSTALL_INCLUDE_DIR})
26 changes: 26 additions & 0 deletions cudaCommonConfiguration.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __cudaCommonConfiguration_h
#define __cudaCommonConfiguration_h

#define CUDACOMMON_VERSION_MAJOR @CUDACOMMON_VERSION_MAJOR@
#define CUDACOMMON_VERSION_MINOR @CUDACOMMON_VERSION_MINOR@
#define CUDACOMMON_VERSION_PATCH @CUDACOMMON_VERSION_PATCH@
#define CUDACOMMON_VERSION_STRING "@CUDACOMMON_VERSION_STRING@"

#endif
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "itk-cudacommon"
version = "1.1.0"
version = "2.0.0"
description = "Framework for processing images with Cuda"
readme = "README.md"
license = {file = "LICENSE"}
Expand Down

0 comments on commit 792d00e

Please sign in to comment.