Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CPack to CMakeLists.txt #4645

Merged
merged 10 commits into from
Jan 29, 2024
7 changes: 7 additions & 0 deletions cmake/TileDB-Superbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,10 @@ if (TILEDB_TESTS)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tiledb
)
endif()

# make package (.tar.gz for Linux and MacOS, .zip for Windows)
add_custom_target(package
DEPENDS tiledb
COMMAND ${CMAKE_CPACK_COMMAND} --config CPackConfig.cmake -G "$<IF:$<PLATFORM_ID:Windows>,ZIP,TGZ>"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tiledb
)
18 changes: 18 additions & 0 deletions cmake/inputs/CustomCPackOptions.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set(CPACK_SOURCE_IGNORE_FILES ".*\\.git;.*build.*")

set(CPACK_PACKAGE_VENDOR "TileDB Inc.")
set(CPACK_PACKAGE_VERSION "@TILEDB_VERSION@")

set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)

# Append NOAVX2 if needed
if(NOT ${COMPILER_SUPPORTS_AVX2})
set(NOAVX2 "-noavx2")
endif()

# Set output name
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}${NOAVX2}-${CPACK_PACKAGE_VERSION}")
string(TOLOWER ${CPACK_PACKAGE_FILE_NAME} CPACK_PACKAGE_FILE_NAME )

# Enable HASH
set(CPACK_PACKAGE_CHECKSUM "SHA256")
18 changes: 18 additions & 0 deletions tiledb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1052,3 +1052,21 @@ configure_file(
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tiledb.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

# Packaging configuration
configure_file ("${PROJECT_SOURCE_DIR}/cmake/inputs/CustomCPackOptions.cmake.in"
"${PROJECT_BINARY_DIR}/CustomCPackOptions.cmake"
@ONLY)
set (CPACK_PROJECT_CONFIG_FILE
"${PROJECT_BINARY_DIR}/CustomCPackOptions.cmake")

# Not all options can be set in CustomCPackOptions.cmake
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(CPACK_SOURCE_GENERATOR "ZIP")
set(CPACK_GENERATOR "ZIP")
else()
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_GENERATOR "TGZ")
endif()

include(CPack)
Loading