openspades/Resources/CMakeLists.txt

86 lines
3.0 KiB
CMake
Raw Normal View History

2014-04-28 02:21:34 +11:00
# this functionality now provided by install code in ../CMakeLists.txt
#
# if(RESDIR_DEFINED)
# add_custom_target(copy_resources ALL COMMENT "Copying resources")
# install(FILES
# ${RESDIR}/pak000-Base.pak
# ${RESDIR}/pak001-Sounds.pak
# ${RESDIR}/pak002-Models.pak
# ${RESDIR}/pak010-BaseSkin.pak
# ${RESDIR}/pak999-References.pak
# DESTINATION share/games/openspades/Resources)
#
# file(GLOB_RECURSE RESOURCES Shaders/* Scripts/* Icons/* Killfeed/*)
# foreach(FILE ${RESOURCES})
# string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR} ${RESDIR} TARGETFILE ${FILE})
# get_filename_component(TARGETDIR ${TARGETFILE} PATH)
# add_custom_command(TARGET copy_resources COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGETDIR}")
# add_custom_command(TARGET copy_resources COMMAND ${CMAKE_COMMAND} -E copy_if_different "${FILE}" "${TARGETFILE}")
# endforeach()
# endif()
2014-04-23 17:41:08 +11:00
2014-04-23 21:47:48 +11:00
if(OPENSPADES_RESOURCES)
add_custom_target(OpenSpades_Resources ALL COMMENT "Downloading external resources")
2014-04-23 17:41:08 +11:00
add_custom_command(
TARGET OpenSpades_Resources
2014-04-23 21:47:48 +11:00
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/downloadpak.sh ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
2014-04-27 12:52:28 +11:00
if(UNIX AND NOT APPLE)
add_custom_target(OpenSpades_Icons ALL COMMENT "Generating icons")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Icons)
add_custom_command(
TARGET OpenSpades_Icons
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Icons/converticons.sh ${CMAKE_CURRENT_SOURCE_DIR}/Icons
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Icons)
set(ICON_DIR ${CMAKE_CURRENT_BINARY_DIR}/Icons/hicolor/16x16/apps)
add_library(OpenSpades_BinaryExecutableIcon
STATIC
${ICON_DIR}/icon.o
)
set_target_properties(
OpenSpades_BinaryExecutableIcon
PROPERTIES
LINKER_LANGUAGE CXX
)
set_source_files_properties(
${ICON_DIR}/icon.o
PROPERTIES
EXTERNAL_OBJECT true
GENERATED true
)
add_custom_command(
OUTPUT ${ICON_DIR}/icon.o
COMMAND cd ${ICON_DIR} && ld -r -b binary -o icon.o openspades.png
COMMAND objcopy --rename-section .data=.rodata,alloc,load,readonly,data,contents ${ICON_DIR}/icon.o ${ICON_DIR}/icon.o
DEPENDS OpenSpades_Icons
)
2014-04-27 12:52:28 +11:00
2014-04-27 15:13:34 +11:00
add_custom_target(OpenSpades_Unix ALL COMMENT "Process unix stuff")
2014-04-27 12:52:28 +11:00
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Unix)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Unix/Debian)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Unix/Man)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Unix/Debian/copyright.in" "${CMAKE_CURRENT_BINARY_DIR}/Unix/Debian/copyright")
2014-04-27 15:13:34 +11:00
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Unix/Man/openspades.6.in" "${CMAKE_CURRENT_BINARY_DIR}/Unix/Man/openspades.6")
2014-04-27 12:52:28 +11:00
add_custom_command(
TARGET OpenSpades_Unix
COMMAND sh -c \"gzip -9 -c ${CMAKE_CURRENT_SOURCE_DIR}/Unix/Debian/changelog > changelog.gz\"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Unix/Debian
)
add_custom_command(
TARGET OpenSpades_Unix
COMMAND sh -c \"gzip -9 -c ${CMAKE_CURRENT_BINARY_DIR}/Unix/Man/openspades.6 > openspades.6.gz\"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Unix/Man
)
endif(UNIX AND NOT APPLE)