Skip to content

Commit

Permalink
CMake: move packaging related stuff from utils.cmake to packaging.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Feb 7, 2024
1 parent 52c3e2e commit b0ba60a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 45 deletions.
52 changes: 33 additions & 19 deletions cmake/packaging.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
if (UNIX)
if (EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
set(CPACK_PACKAGE_VENDOR "OpenXRay Team")
set(CPACK_PACKAGE_CONTACT "OpenXRay <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
set(CPACK_PACKAGE_VENDOR "OpenXRay Team")
set(CPACK_PACKAGE_CONTACT "OpenXRay <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})

set(CPACK_PACKAGE_FILE_NAME "openxray-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")

set(CPACK_PACKAGE_FILE_NAME "openxray-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_SOURCE_IGNORE_FILES "/.gitattributes")
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/License.txt)

set(CPACK_STRIP_FILES TRUE)
set(CPACK_SOURCE_IGNORE_FILES "/.gitattributes")
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/License.txt)
if (UNIX)
# Try to find specific OS files to determine type of linux distribution
find_file(FEDORA_FOUND fedora-release PATHS /etc)
find_file(REDHAT_FOUND redhat-release inittab.RH PATHS /etc)
find_file(CENTOS_FOUND centos-release PATHS /etc)
# If we found debian then we don't need to check further for ubuntu
# as it uses debian core.
find_file(DEBIAN_FOUND debian_version debconf.conf PATHS /etc)

# --------------------------------------------------
# Uninstall target
# --------------------------------------------------
# To clean system folder from libraries and binaries
# that was installed with `sudo make install`
# just run `sudo make uninstall`
if (NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

if (exists "${CMAKE_ROOT}/Modules/CPack.cmake")
# --- SELECT PROPER CPACK GENERATOR ---
if (DEBIAN_FOUND)
set(CPACK_GENERATOR DEB)
Expand All @@ -37,12 +60,3 @@ if (UNIX)
include(CPack)
endif()
endif()

# TODO: Need to be implemented in future
if (WIN32)
#set(CPACK_GENERATOR NSIS)
endif()

if (APPLE)
#set(CPACK_GENERATOR "DRAGNDROP")
endif()
26 changes: 0 additions & 26 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,6 @@ else (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCH_TYPE x86)
endif()

# Unix system configuration
if (UNIX)
# Try to find specific OS files to determine type of linux distribution
find_file(FEDORA_FOUND fedora-release PATHS /etc)
find_file(REDHAT_FOUND redhat-release inittab.RH PATHS /etc)
find_file(CENTOS_FOUND centos-release PATHS /etc)
# If we found debian then we don't need to check further for ubuntu
# as it uses debian core.
find_file(DEBIAN_FOUND debian_version debconf.conf PATHS /etc)

# --------------------------------------------------
# Uninstall target
# --------------------------------------------------
# To clean system folder from libraries and binaries
# that was installed with `sudo make install`
# just run `sudo make uninstall`
if (NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
endif()

function(set_git_info)
execute_process(COMMAND git rev-parse --verify HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
Expand Down

0 comments on commit b0ba60a

Please sign in to comment.