mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add a proper make install
command
It will install data into `share/ddnet`, client and server binaries into `bin` and tools into `lib/ddnet`. Fixes #1269.
This commit is contained in:
parent
48d1757793
commit
cb09161dec
|
@ -77,10 +77,15 @@ option(MYSQL "Enable mysql support" OFF)
|
|||
option(CLIENT "Compile client" ON)
|
||||
option(DOWNLOAD_GTEST "Download and compile GTest" ${AUTO_DEPENDENCIES_DEFAULT})
|
||||
option(PREFER_BUNDLED_LIBS "Prefer bundled libraries over system libraries" ${AUTO_DEPENDENCIES_DEFAULT})
|
||||
option(DEV "Don't generate stuff necessary for packaging" OFF)
|
||||
|
||||
# Set the default build type to Release
|
||||
if(NOT(CMAKE_BUILD_TYPE))
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
if(DEV)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(DBG $<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>)
|
||||
|
@ -1067,7 +1072,6 @@ foreach(ABS_T ${TOOLS})
|
|||
string(REGEX REPLACE "\\.cpp$" "" TOOL "${T}")
|
||||
set(TOOL_DEPS ${DEPS})
|
||||
set(TOOL_LIBS ${LIBS})
|
||||
set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
|
||||
if(TOOL MATCHES "^(tileset_.*|dilate|map_extract|map_replace_image)$")
|
||||
list(APPEND TOOL_DEPS ${PNGLITE_DEP})
|
||||
list(APPEND TOOL_LIBS ${PNGLITE_LIBRARIES})
|
||||
|
@ -1076,8 +1080,9 @@ foreach(ABS_T ${TOOLS})
|
|||
if(TOOL MATCHES "^config_")
|
||||
list(APPEND EXTRA_TOOL_SRC "src/tools/config_common.h")
|
||||
endif()
|
||||
if(TOOL MATCHES "^(config_retrieve|config_store|dilate|map_diff|map_extract)$")
|
||||
set(EXCLUDE_FROM_ALL)
|
||||
set(EXCLUDE_FROM_ALL)
|
||||
if(DEV)
|
||||
set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
add_executable(${TOOL} ${EXCLUDE_FROM_ALL}
|
||||
${TOOL_DEPS}
|
||||
|
@ -1299,16 +1304,22 @@ if(TARGET_OS STREQUAL "windows")
|
|||
list(APPEND CPACK_FILES other/config_directory.bat)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${CPACK_TARGETS} DESTINATION bin)
|
||||
install(DIRECTORY data DESTINATION share/ddnet)
|
||||
if(NOT DEV)
|
||||
install(DIRECTORY data DESTINATION share/ddnet COMPONENT data)
|
||||
install(TARGETS ${TARGET_CLIENT} DESTINATION bin COMPONENT client)
|
||||
install(TARGETS ${TARGET_SERVER} DESTINATION bin COMPONENT server)
|
||||
install(TARGETS ${TARGETS_TOOLS} DESTINATION lib/ddnet COMPONENT tools)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6)
|
||||
if(DEV)
|
||||
# Don't generate CPack targets.
|
||||
elseif(CMAKE_VERSION VERSION_LESS 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6)
|
||||
message(WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer.")
|
||||
else()
|
||||
set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable EXCLUDE_FROM_ALL)
|
||||
install(TARGETS ${CPACK_TARGETS} ${EXTRA_ARGS})
|
||||
install(DIRECTORY ${CPACK_DIRS} ${EXTRA_ARGS})
|
||||
install(FILES ${CPACK_FILES} ${EXTRA_ARGS})
|
||||
else()
|
||||
message(WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer.")
|
||||
endif()
|
||||
|
||||
set(PACKAGE_TARGETS)
|
||||
|
|
Loading…
Reference in a new issue