1 cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
2 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
3 project(xonotic-data ASM)
6 add_custom_target(${checks})
10 add_dependencies(${checks} gmqcc)
13 add_dependencies(${checks} data-check-cvars)
14 add_custom_target(data-check-cvars
15 COMMENT "checking cvars"
16 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
17 VERBATIM COMMAND ${CMAKE_COMMAND} -E
19 "${PROJECT_SOURCE_DIR}/check-cvars.sh"
22 add_dependencies(${checks} qc-genmod)
23 add_custom_target(qc-genmod
25 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
26 VERBATIM COMMAND ./tools/genmod.sh
29 add_dependencies(${checks} qc-headerstyle)
30 add_custom_target(qc-headerstyle
31 COMMENT "headerstyle.sh"
32 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
33 VERBATIM COMMAND ${CMAKE_COMMAND} -E
35 ./tools/headerstyle.sh
38 add_dependencies(${checks} qc-whitespace)
39 add_custom_target(qc-whitespace
40 COMMENT "whitespace.sh"
41 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
42 VERBATIM COMMAND ./tools/whitespace.sh
45 include_directories(qcsrc)
47 add_definitions(-DXONOTIC=1)
48 add_definitions(-DNDEBUG=1)
49 add_definitions(-DENABLE_EFFECTINFO=0)
50 add_definitions(-DENABLE_DEBUGDRAW=0)
51 add_definitions(-DENABLE_DEBUGTRACE=0)
53 if (DEFINED ENV{VERSION})
54 set(GIT_DESC "$ENV{VERSION}")
56 find_package(Git REQUIRED)
58 COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=~
59 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
60 OUTPUT_VARIABLE GIT_DESC
61 OUTPUT_STRIP_TRAILING_WHITESPACE
64 add_definitions(-DWATERMARK=\"${GIT_DESC}\")
66 set_source_files_properties(
67 qcsrc/client/progs.inc
68 qcsrc/server/progs.inc
72 HEADER_FILE_ONLY FALSE
75 add_executable(csprogs qcsrc/client/progs.inc)
76 add_dependencies(csprogs ${checks})
77 target_compile_definitions(csprogs PRIVATE -DGAMEQC -DCSQC)
79 add_executable(progs qcsrc/server/progs.inc)
80 add_dependencies(progs ${checks})
81 target_compile_definitions(progs PRIVATE -DGAMEQC -DSVQC)
83 add_executable(menu qcsrc/menu/progs.inc)
84 add_dependencies(menu ${checks})
85 target_compile_definitions(menu PRIVATE -DMENUQC)
87 function(set_prelude target prelude)
88 get_target_property(MY_PROJECT_SOURCES target SOURCES)
89 foreach (source IN LISTS MY_PROJECT_SOURCES)
92 APPEND PROPERTY COMPILE_FLAGS
93 "-include ${PROJECT_SOURCE_DIR}/${prelude}"
97 # set_prelude(csprogs qcsrc/lib/_all.inc)
100 add_custom_command(TARGET ${prog} POST_BUILD
101 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}.dat"
102 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}.lno"
103 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
111 add_custom_target(${prog}.pk3
112 DEPENDS ${prog}-${GIT_DESC}.pk3
114 add_custom_command(OUTPUT ${prog}-${GIT_DESC}.pk3
116 COMMAND ${CMAKE_COMMAND} -E echo "http://xonotic.org" > "${prog}-${GIT_DESC}.txt"
117 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}-${GIT_DESC}.dat"
118 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}-${GIT_DESC}.lno"
119 COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${prog}-${GIT_DESC}.pk3" --format=zip
120 "${prog}-${GIT_DESC}.txt"
121 "${prog}-${GIT_DESC}.dat"
122 "${prog}-${GIT_DESC}.lno"