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(-DXONOTIC=1)
8 add_definitions(-DNDEBUG=1)
10 find_package(Git REQUIRED)
12 COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=~
13 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
14 OUTPUT_VARIABLE GIT_DESC
15 OUTPUT_STRIP_TRAILING_WHITESPACE
17 add_definitions(-DWATERMARK=\"${GIT_DESC}\")
19 set_source_files_properties(
20 qcsrc/client/progs.inc
21 qcsrc/server/progs.inc
25 HEADER_FILE_ONLY FALSE
28 add_executable(csprogs qcsrc/client/progs.inc)
29 target_compile_definitions(csprogs PRIVATE -DGAMEQC -DCSQC)
30 add_dependencies(csprogs gmqcc)
32 add_executable(progs qcsrc/server/progs.inc)
33 target_compile_definitions(progs PRIVATE -DGAMEQC -DSVQC)
34 add_dependencies(progs gmqcc)
36 add_executable(menu qcsrc/menu/progs.inc)
37 target_compile_definitions(menu PRIVATE -DMENUQC)
38 add_dependencies(menu gmqcc)
40 function(set_prelude target prelude)
41 get_target_property(MY_PROJECT_SOURCES target SOURCES)
42 foreach (source IN LISTS MY_PROJECT_SOURCES)
45 APPEND PROPERTY COMPILE_FLAGS
46 "-include ${PROJECT_SOURCE_DIR}/${prelude}"
50 # set_prelude(csprogs qcsrc/lib/_all.inc)
53 add_custom_command(TARGET ${prog} POST_BUILD
54 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}.dat"
55 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}.lno"
56 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
64 add_custom_target(${prog}.pk3
65 DEPENDS ${prog}-${GIT_DESC}.pk3
67 add_custom_command(OUTPUT ${prog}-${GIT_DESC}.pk3
69 COMMAND ${CMAKE_COMMAND} -E echo "http://xonotic.org" > "${prog}-${GIT_DESC}.txt"
70 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}-${GIT_DESC}.dat"
71 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}-${GIT_DESC}.lno"
72 COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${prog}-${GIT_DESC}.pk3" --format=zip
73 "${prog}-${GIT_DESC}.txt"
74 "${prog}-${GIT_DESC}.dat"
75 "${prog}-${GIT_DESC}.lno"