Add CMakeLists.txt
[xonotic/netradiant.git] / tools / quake3 / CMakeLists.txt
1 include_directories(BEFORE common)
2
3 set(Q3MAP_VERSION 2.5.17n)
4 find_package(Git REQUIRED)
5 execute_process(
6         COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
7         WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
8         OUTPUT_VARIABLE GIT_VERSION
9         OUTPUT_STRIP_TRAILING_WHITESPACE
10 )
11 if (GIT_VERSION)
12     set(Q3MAP_VERSION "${Q3MAP_VERSION}-git-${GIT_VERSION}")
13 endif ()
14 add_definitions(-DQ3MAP_VERSION="${Q3MAP_VERSION}")
15
16 find_package(GLIB REQUIRED)
17 include_directories(${GLIB_INCLUDE_DIRS})
18
19 find_package(JPEG REQUIRED)
20 include_directories(${JPEG_INCLUDE_DIR})
21
22 find_package(PNG REQUIRED)
23 include_directories(${PNG_INCLUDE_DIR})
24
25 find_package(LibXml2 REQUIRED)
26 include_directories(${LIBXML2_INCLUDE_DIR})
27
28 find_package(ZLIB REQUIRED)
29 include_directories(${ZLIB_INCLUDE_DIRS})
30
31 set(q3map2_games
32         q3map2/game_darkplaces.h
33         q3map2/game_dq.h
34         q3map2/game_ef.h
35         q3map2/game_etut.h
36         q3map2/game_ja.h
37         q3map2/game_jk2.h
38         q3map2/game_nexuiz.h
39         q3map2/game_prophecy.h
40         q3map2/game_qfusion.h
41         q3map2/game_quake3.h
42         q3map2/game_quakelive.h
43         q3map2/game_reaction.h
44         q3map2/game_sof2.h
45         q3map2/game_tenebrae.h
46         q3map2/game_tremulous.h
47         q3map2/game_wolf.h
48         q3map2/game_wolfet.h
49         q3map2/game_xonotic.h
50         )
51
52 radiant_tool(q3map2
53         common/cmdlib.c common/cmdlib.h
54         common/imagelib.c common/imagelib.h
55         common/inout.c common/inout.h
56         common/jpeg.c
57         common/md4.c common/md4.h
58         common/mutex.c common/mutex.h
59         common/polylib.c common/polylib.h
60         common/polyset.h
61         common/qfiles.h
62         common/qthreads.h
63         common/scriplib.c common/scriplib.h
64         common/surfaceflags.h
65         common/threads.c
66         common/unzip.c common/unzip.h
67         common/vfs.c common/vfs.h
68
69         q3map2/brush.c
70         q3map2/brush_primit.c
71         q3map2/bsp.c
72         q3map2/bspfile_abstract.c
73         q3map2/bspfile_ibsp.c
74         q3map2/bspfile_rbsp.c
75         q3map2/convert_ase.c
76         q3map2/convert_map.c
77         q3map2/convert_obj.c
78         q3map2/decals.c
79         q3map2/facebsp.c
80         q3map2/fog.c
81         ${q3map2_games} q3map2/game__null.h
82         q3map2/image.c
83         q3map2/leakfile.c
84         q3map2/light.c
85         q3map2/light_bounce.c
86         q3map2/light_trace.c
87         q3map2/light_ydnar.c
88         q3map2/lightmaps_ydnar.c
89         q3map2/main.c
90         q3map2/map.c
91         q3map2/mesh.c
92         q3map2/model.c
93         q3map2/patch.c
94         q3map2/path_init.c
95         q3map2/portals.c
96         q3map2/prtfile.c
97         q3map2/q3map2.h
98         q3map2/shaders.c
99         q3map2/surface.c
100         q3map2/surface_extra.c
101         q3map2/surface_foliage.c
102         q3map2/surface_fur.c
103         q3map2/surface_meta.c
104         q3map2/tjunction.c
105         q3map2/tree.c
106         q3map2/vis.c
107         q3map2/visflow.c
108         q3map2/writebsp.c
109         )
110
111 target_link_libraries(q3map2
112         ${GLIB_LIBRARIES}
113         ${JPEG_LIBRARIES}
114         ${PNG_LIBRARIES}
115         ${LIBXML2_LIBRARIES}
116         ${ZLIB_LIBRARIES}
117         ddslib
118         etclib
119         filematch
120         l_net
121         mathlib
122         picomodel
123         )
124
125 radiant_tool(q3data
126         common/aselib.c common/aselib.h
127         common/bspfile.c common/bspfile.h
128         common/cmdlib.c common/cmdlib.h
129         common/imagelib.c common/imagelib.h
130         common/inout.c common/inout.h
131         common/md4.c common/md4.h
132         common/scriplib.c common/scriplib.h
133         common/trilib.c common/trilib.h
134         common/unzip.c common/unzip.h
135         common/vfs.c common/vfs.h
136
137         q3data/3dslib.c q3data/3dslib.h
138         q3data/compress.c
139         q3data/images.c
140         q3data/md3lib.c q3data/md3lib.h
141         q3data/models.c
142         q3data/p3dlib.c q3data/p3dlib.h
143         q3data/polyset.c
144         q3data/q3data.c q3data/q3data.h
145         q3data/stripper.c
146         q3data/video.c
147         )
148
149 target_link_libraries(q3data
150         ${GLIB_LIBRARIES}
151         ${LIBXML2_LIBRARIES}
152         ${ZLIB_LIBRARIES}
153         filematch
154         etclib
155         l_net
156         mathlib
157         )
158
159 add_custom_target(quake3)
160 add_dependencies(quake3 q3map2 q3data)
161
162 if (UNIX)
163     target_link_libraries(q3map2 pthread m)
164     target_link_libraries(q3data m)
165 endif ()