1 cmake_minimum_required(VERSION 2.8.11)
2 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
3 project(xonotic-data LANGUAGES ASM)
5 include_directories(qcsrc)
7 add_definitions(-DNDEBUG=1)
9 find_package(Git REQUIRED)
11 COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=~
12 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
13 OUTPUT_VARIABLE GIT_DESC
14 OUTPUT_STRIP_TRAILING_WHITESPACE
16 add_definitions(-DWATERMARK=\"${GIT_DESC}\")
18 set_source_files_properties(
19 qcsrc/client/progs.inc
20 qcsrc/server/progs.inc
24 HEADER_FILE_ONLY FALSE
27 add_executable(csprogs qcsrc/client/progs.inc)
28 target_compile_definitions(csprogs PRIVATE -DCSQC)
29 add_dependencies(csprogs gmqcc)
31 add_executable(progs qcsrc/server/progs.inc)
32 target_compile_definitions(progs PRIVATE -DSVQC)
33 add_dependencies(progs gmqcc)
35 add_executable(menu qcsrc/menu/progs.inc)
36 target_compile_definitions(menu PRIVATE -DMENUQC)
37 add_dependencies(menu gmqcc)
39 function(set_prelude target prelude)
40 get_target_property(MY_PROJECT_SOURCES target SOURCES)
41 foreach (source IN LISTS MY_PROJECT_SOURCES)
44 APPEND PROPERTY COMPILE_FLAGS
45 "-include ${PROJECT_SOURCE_DIR}/${prelude}"
49 # set_prelude(csprogs qcsrc/lib/_all.inc)
52 add_custom_command(TARGET ${prog} POST_BUILD
53 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}.dat"
54 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}.lno"
55 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
63 add_custom_target(${prog}.pk3
64 DEPENDS ${prog}-${GIT_DESC}.pk3
66 add_custom_command(OUTPUT ${prog}-${GIT_DESC}.pk3
68 COMMAND ${CMAKE_COMMAND} -E echo "http://xonotic.org" > "${prog}-${GIT_DESC}.txt"
69 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}-${GIT_DESC}.dat"
70 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}-${GIT_DESC}.lno"
71 COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${prog}-${GIT_DESC}.pk3" --format=zip
72 "${prog}-${GIT_DESC}.txt"
73 "${prog}-${GIT_DESC}.dat"
74 "${prog}-${GIT_DESC}.lno"