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(${all})
9 add_custom_target(${checks})
13 add_dependencies(${checks} gmqcc)
16 add_dependencies(${checks} data-check-cvars)
17 add_custom_target(data-check-cvars
18 COMMENT "checking cvars"
19 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
20 VERBATIM COMMAND ${CMAKE_COMMAND} -E
22 "${PROJECT_SOURCE_DIR}/check-cvars.sh"
25 add_dependencies(${checks} qc-genmod)
26 add_custom_target(qc-genmod
28 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
29 VERBATIM COMMAND ./tools/genmod.sh
32 add_dependencies(${checks} qc-headerstyle)
33 add_custom_target(qc-headerstyle
34 COMMENT "headerstyle.sh"
35 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
36 VERBATIM COMMAND ${CMAKE_COMMAND} -E
38 ./tools/headerstyle.sh
41 add_dependencies(${checks} qc-whitespace)
42 add_custom_target(qc-whitespace
43 COMMENT "whitespace.sh"
44 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/qcsrc"
45 VERBATIM COMMAND ./tools/whitespace.sh
48 include_directories(qcsrc)
50 add_definitions(-DXONOTIC=1)
51 add_definitions(-DNDEBUG=1)
52 add_definitions(-DENABLE_EFFECTINFO=0)
53 add_definitions(-DENABLE_DEBUGDRAW=0)
54 add_definitions(-DENABLE_DEBUGTRACE=0)
56 if (DEFINED ENV{VERSION})
57 set(GIT_DESC "$ENV{VERSION}")
59 find_package(Git REQUIRED)
61 COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=~
62 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
63 OUTPUT_VARIABLE GIT_DESC
64 OUTPUT_STRIP_TRAILING_WHITESPACE
67 add_definitions(-DWATERMARK=\"${GIT_DESC}\")
69 set_source_files_properties(
70 qcsrc/client/progs.inc
71 qcsrc/server/progs.inc
75 HEADER_FILE_ONLY FALSE
78 add_executable(csprogs qcsrc/client/progs.inc)
79 add_dependencies(${all} csprogs)
80 add_dependencies(csprogs ${checks})
81 target_compile_definitions(csprogs PRIVATE -DGAMEQC -DCSQC)
83 add_executable(progs qcsrc/server/progs.inc)
84 add_dependencies(${all} progs)
85 add_dependencies(progs ${checks})
86 target_compile_definitions(progs PRIVATE -DGAMEQC -DSVQC)
88 add_executable(menu qcsrc/menu/progs.inc)
89 add_dependencies(${all} menu)
90 add_dependencies(menu ${checks})
91 target_compile_definitions(menu PRIVATE -DMENUQC)
93 function(set_prelude target prelude)
94 get_target_property(MY_PROJECT_SOURCES target SOURCES)
95 foreach (source IN LISTS MY_PROJECT_SOURCES)
98 APPEND PROPERTY COMPILE_FLAGS
99 "-include ${PROJECT_SOURCE_DIR}/${prelude}"
103 # set_prelude(csprogs qcsrc/lib/_all.inc)
106 add_custom_command(TARGET ${prog} POST_BUILD
107 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}.dat"
108 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}.lno"
109 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
117 add_custom_target(${prog}.pk3
118 DEPENDS ${prog}-${GIT_DESC}.pk3
120 add_custom_command(OUTPUT ${prog}-${GIT_DESC}.pk3
122 COMMAND ${CMAKE_COMMAND} -E echo "http://xonotic.org" > "${prog}-${GIT_DESC}.txt"
123 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}-${GIT_DESC}.dat"
124 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}-${GIT_DESC}.lno"
125 COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${prog}-${GIT_DESC}.pk3" --format=zip
126 "${prog}-${GIT_DESC}.txt"
127 "${prog}-${GIT_DESC}.dat"
128 "${prog}-${GIT_DESC}.lno"