]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - CMakeLists.txt
CMake: pk3, watermark
[xonotic/xonotic-data.pk3dir.git] / CMakeLists.txt
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)
4
5 include_directories(qcsrc)
6
7 add_definitions(-DNDEBUG=1)
8
9 find_package(Git REQUIRED)
10 execute_process(
11         COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=*
12         WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
13         OUTPUT_VARIABLE GIT_DESC
14         OUTPUT_STRIP_TRAILING_WHITESPACE
15 )
16 add_definitions(-DWATERMARK=\"${GIT_DESC}\")
17
18 set_source_files_properties(
19         qcsrc/client/progs.inc
20         qcsrc/server/progs.inc
21         qcsrc/menu/progs.inc
22         PROPERTIES
23         LANGUAGE ASM
24         HEADER_FILE_ONLY FALSE
25 )
26
27 add_executable(csprogs qcsrc/client/progs.inc)
28 target_compile_definitions(csprogs PRIVATE -DCSQC)
29 add_dependencies(csprogs gmqcc)
30
31 add_executable(progs qcsrc/server/progs.inc)
32 target_compile_definitions(progs PRIVATE -DSVQC)
33 add_dependencies(progs gmqcc)
34
35 add_executable(menu qcsrc/menu/progs.inc)
36 target_compile_definitions(menu PRIVATE -DMENUQC)
37 add_dependencies(menu gmqcc)
38
39 function(pack prog)
40     add_custom_target(${prog}.pk3
41             DEPENDS ${prog}-${GIT_DESC}.pk3
42             )
43     add_custom_command(OUTPUT ${prog}-${GIT_DESC}.pk3
44             DEPENDS ${prog}
45             COMMAND ${CMAKE_COMMAND} -E echo "http://xonotic.org" > "${prog}-${GIT_DESC}.txt"
46             COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.dat" "${prog}-${GIT_DESC}.dat"
47             COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE_DIR:${prog}>/${prog}.lno" "${prog}-${GIT_DESC}.lno"
48             COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${prog}-${GIT_DESC}.pk3" --format=zip
49             "${prog}-${GIT_DESC}.txt"
50             "${prog}-${GIT_DESC}.dat"
51             "${prog}-${GIT_DESC}.lno"
52              VERBATIM
53             )
54 endfunction()
55 pack(csprogs)