]> git.xonotic.org Git - xonotic/netradiant.git/blob - CMakeLists.txt
Merge commit '70b21eafbe10c90172922d8a7af4f06b9a3b242d' into master-merge
[xonotic/netradiant.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
2
3 project(NetRadiant C CXX)
4
5 #-----------------------------------------------------------------------
6 # Builtins: configuration
7 #-----------------------------------------------------------------------
8
9 set(BUILTINS_INSTALL_DIR "${CMAKE_BINARY_DIR}/builtins")
10 set(BUILTINS_INCLUDE_DIR "${BUILTINS_INSTALL_DIR}/include")
11 set(BUILTINS_LIB_DIR "${BUILTINS_INSTALL_DIR}/lib")
12 set(BUILTINS_PKGCONFIG_DIR "${BUILTINS_INSTALL_DIR}/lib/pkgconfig")
13
14 option(BUILTIN_GTKGLEXT "Builtin GtkGLExt" OFF)
15 option(BUILTIN_GTKTHEME_MOJAVE "Builtin Mojave GTK theme" OFF)
16
17 if (APPLE)
18     set(BUILTIN_GTKGLEXT ON)
19     set(BUILTIN_GTKTHEME_MOJAVE ON)
20 endif ()
21
22 set(BUILTIN_GTKGLEXT_BUILT OFF CACHE INTERNAL "...")
23 if (EXISTS "${BUILTINS_PKGCONFIG_DIR}/gtkglext-1.0.pc")
24     set(BUILTIN_GTKGLEXT_BUILT ON)
25 endif ()
26
27 if (EXISTS "${BUILTINS_INCLUDE_DIR}")
28     include_directories("${BUILTINS_INCLUDE_DIR}")
29 endif ()
30
31 if (EXISTS "${BUILTINS_LIB_DIR}")
32     set(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${BUILTINS_LIB_DIR}")
33     link_directories("${BUILTINS_LIB_DIR}")
34 endif ()
35
36 if (EXISTS "${BUILTINS_PKGCONFIG_DIR}")
37     set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${BUILTINS_PKGCONFIG_DIR}")
38 endif ()
39
40 #-----------------------------------------------------------------------
41 # CMake modules
42 #-----------------------------------------------------------------------
43
44 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
45
46 #-----------------------------------------------------------------------
47 # Submodules
48 #-----------------------------------------------------------------------
49
50 if (EXISTS "${PROJECT_SOURCE_DIR}/libs/crunch/inc/crn_decomp.h")
51     set(DEFAULT_BUILD_CRUNCH ON CACHE INTERNAL "...")
52 else ()
53     set(DEFAULT_BUILD_CRUNCH OFF CACHE INTERNAL "...")
54 endif ()
55
56 if (EXISTS "${PROJECT_SOURCE_DIR}/tools/unvanquished/daemonmap/tools/quake3/q3map2/main.c")
57     set(DEFAULT_BUILD_DAEMONMAP ON CACHE INTERNAL "...")
58 else ()
59     set(DEFAULT_BUILD_DAEMONMAP OFF CACHE INTERNAL "...")
60 endif ()
61
62 #-----------------------------------------------------------------------
63 # Build options
64 #-----------------------------------------------------------------------
65
66 option(BUILD_RADIANT "Build the GUI" ON)
67 option(BUILD_TOOLS "Build the tools" ON)
68 option(BUILD_CRUNCH "Build Crunch image support" ${DEFAULT_BUILD_CRUNCH})
69 option(BUILD_DAEMONMAP "Build daemonmap navigation mesh generator" ${DEFAULT_BUILD_DAEMONMAP})
70 option(DOWNLOAD_GAMEPACKS "Download game packs" ON)
71 option(USE_WERROR "Build with -Werror -pedantic-errors" OFF)
72 option(FHS_INSTALL "Install according to Filesystem Hierarchy Standard" OFF)
73 option(FHS_INSTALL_ABSOLUTE "Install using absolute paths (requires FHS_INSTALL)" OFF)
74
75 set(BUILD_BINARIES OFF CACHE INTERNAL "...")
76 if (BUILD_RADIANT OR BUILD_TOOLS)
77     set(BUILD_BINARIES ON)
78 endif ()
79
80 if (BUILD_BINARIES)
81     if (WIN32
82         OR APPLE
83         OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"
84         OR "${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD" )
85         set(BUNDLING_SUPPORTED ON)
86     endif()
87
88     if (BUNDLING_SUPPORTED)
89         if(WIN32 AND NOT CMAKE_CROSSCOMPILING)
90             set(BUNDLE_LIBRARIES_DEFAULT ON)
91         else ()
92             set(BUNDLE_LIBRARIES_DEFAULT OFF)
93         endif ()
94
95         option(BUNDLE_LIBRARIES "Bundle libraries" ${BUNDLE_LIBRARIES_DEFAULT})
96     endif ()
97
98     if (BUNDLE_LIBRARIES AND BUNDLING_SUPPORTED)
99         set(FHS_INSTALL OFF CACHE PATH "Disabled because of BUNDLE_LIBRARIES is enabled" FORCE)
100     endif ()
101
102     if (NOT FHS_INSTALL AND FHS_INSTALL_ABSOLUTE)
103         set(FHS_INSTALL_ABSOLUTE OFF CACHE PATH "Disabled because of FHS_INSTALL is disabled" FORCE)
104     endif ()
105 endif ()
106
107 #-----------------------------------------------------------------------
108 # Paths
109 #-----------------------------------------------------------------------
110
111 if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
112     set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install" CACHE PATH "..." FORCE)
113 endif ()
114
115 if (APPLE)
116     set(APPLE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/NetRadiant.app)
117     set(FINAL_INSTALL_PREFIX ${APPLE_INSTALL_PREFIX}/Contents/Prefix)
118 else ()
119     set(FINAL_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
120 endif ()
121
122 set(RADIANT_NAME "NetRadiant" CACHE INTERNAL "...")
123 add_definitions(-DRADIANT_NAME="${RADIANT_NAME}")
124 set(RADIANT_BASENAME "netradiant" CACHE INTERNAL "...")
125 add_definitions(-DRADIANT_BASENAME="${RADIANT_BASENAME}")
126
127 set(RADIANT_BIN_DIR ${FINAL_INSTALL_PREFIX} CACHE INTERNAL "...")
128 set(RADIANT_LIB_DIR ${FINAL_INSTALL_PREFIX}/lib CACHE INTERNAL "...")
129 set(RADIANT_ADDONS_DIR ${FINAL_INSTALL_PREFIX} CACHE INTERNAL "...")
130 set(RADIANT_SHARE_DIR ${FINAL_INSTALL_PREFIX}/share CACHE INTERNAL "...")
131 set(RADIANT_DATA_DIR ${FINAL_INSTALL_PREFIX} CACHE INTERNAL "...")
132
133 if (FHS_INSTALL)
134     add_definitions(-DRADIANT_FHS_INSTALL='ON')
135
136     set(RADIANT_BIN_DIR ${FINAL_INSTALL_PREFIX}/bin)
137     set(RADIANT_LIB_DIR ${FINAL_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE})
138     set(RADIANT_ADDONS_DIR ${RADIANT_LIB_DIR}/${RADIANT_BASENAME})
139     set(RADIANT_SHARE_DIR ${FINAL_INSTALL_PREFIX}/share)
140     set(RADIANT_DATA_DIR ${RADIANT_SHARE_DIR}/${RADIANT_BASENAME})
141     set(RADIANT_LIB_DIR ${FINAL_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE})
142
143     if (FHS_INSTALL_ABSOLUTE)
144         add_definitions(-DRADIANT_ADDONS_DIR="${RADIANT_ADDONS_DIR}")
145         add_definitions(-DRADIANT_DATA_DIR="${RADIANT_DATA_DIR}")
146     else ()
147         add_definitions(-DRADIANT_LIB_ARCH="${CMAKE_LIBRARY_ARCHITECTURE}")
148     endif ()
149 endif ()
150
151
152 set(GAMEPACKS_DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/download CACHE PATH "Where to store downloaded game packs")
153
154 #-----------------------------------------------------------------------
155 # Version
156 #-----------------------------------------------------------------------
157
158 # CMake 3.0+ would allow this in project()
159 set(RADIANT_VERSION_MAJOR 1)
160 set(RADIANT_VERSION_MINOR 5)
161 set(RADIANT_VERSION_PATCH 0)
162 set(RADIANT_VERSION "${RADIANT_VERSION_MAJOR}.${RADIANT_VERSION_MINOR}.${RADIANT_VERSION_PATCH}")
163
164 set(RADIANT_ABOUTMSG "Custom build" CACHE STRING "About message")
165
166 set(RADIANT_VERSION_STRING "${RADIANT_VERSION}n")
167
168 if (NOT DEFINED GIT_VERSION)
169      find_package(Git REQUIRED)
170
171      execute_process(
172           COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
173           WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
174           OUTPUT_VARIABLE GIT_VERSION
175           OUTPUT_STRIP_TRAILING_WHITESPACE
176      )
177
178      if (GIT_VERSION)
179          set(RADIANT_VERSION_STRING "${RADIANT_VERSION_STRING}-git-${GIT_VERSION}")
180      endif ()
181 endif ()
182
183 message(STATUS "Building ${PROJECT_NAME} ${RADIANT_VERSION_STRING} ${RADIANT_ABOUTMSG}")
184
185 #-----------------------------------------------------------------------
186 # Language standard
187 #-----------------------------------------------------------------------
188
189 if (BUILD_BINARIES)
190     set(CMAKE_CXX_STANDARD 11)
191     set(CMAKE_CXX_STANDARD_REQUIRED ON)
192     set(CMAKE_CXX_EXTENSIONS OFF)
193
194     if (CMAKE_VERSION VERSION_LESS "3.1")
195         if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
196             include(CheckCXXCompilerFlag)
197             check_cxx_compiler_flag(--std=c++${CMAKE_CXX_STANDARD} STD_CXX)
198             if (STD_CXX)
199                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++${CMAKE_CXX_STANDARD}")
200             else ()
201                 message(SEND_ERROR "Requires C++${CMAKE_CXX_STANDARD} or better")
202             endif ()
203         else ()
204             message(WARNING "Unrecognized compiler: ${CMAKE_CXX_COMPILER_ID}, make sure it supports C++${CMAKE_CXX_STANDARD}")
205         endif ()
206     endif ()
207 endif ()
208
209 #-----------------------------------------------------------------------
210 # Flags
211 #-----------------------------------------------------------------------
212
213 if (BUILD_BINARIES)
214     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
215
216     macro (addflags_c args)
217         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${args}")
218     endmacro ()
219
220     macro (addflags_cxx args)
221         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${args}")
222     endmacro ()
223
224     macro (addflags args)
225         addflags_c("${args}")
226         addflags_cxx("${args}")
227     endmacro ()
228
229     addflags("-fno-strict-aliasing")
230     if (NOT WIN32)
231         addflags("-fvisibility=hidden")
232     endif ()
233
234     if (USE_WERROR)
235         addflags("-Werror")
236         addflags("-pedantic-errors")
237     endif ()
238
239     addflags("-Wall")
240     addflags("-Wextra")
241     addflags("-pedantic")
242
243     addflags_c("-Wno-deprecated-declarations") # vfs.c: g_strdown
244
245     addflags("-Wno-unused-function")
246     addflags("-Wno-unused-variable")
247     addflags("-Wno-unused-parameter")
248
249     if (APPLE)
250         add_definitions(-DGL_SILENCE_DEPRECATION=1)
251     endif()
252
253     set(CMAKE_POSITION_INDEPENDENT_CODE 1)
254 endif ()
255
256 if (BUILD_RADIANT)
257     set(GTK_TARGET 2 CACHE STRING "GTK target")
258     add_definitions(-DGTK_TARGET=${GTK_TARGET})
259
260     if (WIN32)
261         add_definitions(-DWORKAROUND_WINDOWS_FLOATING_WINDOW=1)
262
263         if (GTK_TARGET EQUAL 2)
264             add_definitions(-DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1)
265         endif ()
266     endif ()
267
268     if (APPLE)
269         if (GTK_TARGET EQUAL 2)
270             add_definitions(-DWORKAROUND_MACOS_GTK2_DESTROY=1)
271             add_definitions(-DWORKAROUND_MACOS_GTK2_GLWIDGET=1)
272             add_definitions(-DWORKAROUND_MACOS_GTK2_LAGGYPOINTER=1)
273         endif ()
274     endif ()
275 endif ()
276
277 #-----------------------------------------------------------------------
278 # Defs
279 #-----------------------------------------------------------------------
280
281 if (BUILD_BINARIES)
282     add_definitions(-DRADIANT_VERSION="${RADIANT_VERSION}")
283     add_definitions(-DRADIANT_VERSION_STRING="${RADIANT_VERSION_STRING}")
284
285     if (NOT CMAKE_BUILD_TYPE MATCHES Release)
286         add_definitions(-D_DEBUG=1)
287     endif ()
288 endif ()
289
290 if (BUILD_RADIANT)
291     add_definitions(-DRADIANT_ABOUTMSG="${RADIANT_ABOUTMSG}")
292
293     macro (disable_deprecated name gtk2only)
294         add_definitions(-D${name}_DISABLE_SINGLE_INCLUDES)
295         if ((${gtk2only} EQUAL 0) OR (GTK_TARGET EQUAL 2))
296             add_definitions(-D${name}_DISABLE_DEPRECATED)
297         endif ()
298     endmacro ()
299
300     disable_deprecated(ATK 0)
301     disable_deprecated(G 0)
302     disable_deprecated(GDK 0)
303     disable_deprecated(GDK_PIXBUF 0)
304     disable_deprecated(GTK 1)
305     disable_deprecated(PANGO 0)
306 endif ()
307
308 if (BUILD_BINARIES)
309     add_custom_target(binaries ALL)
310
311     if(APPLE OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
312         link_directories(
313             /usr/local/lib
314         )
315     endif ()
316
317     if (WIN32)
318         add_definitions(
319             -DWIN32=1
320             -D_WIN32=1
321         )
322     else ()
323         add_definitions(
324             -DPOSIX=1
325         )
326     endif ()
327 endif ()
328
329 if (BUILD_RADIANT AND NOT APPLE AND NOT WIN32)
330     set(XWINDOWS ON)
331     find_package(X11 REQUIRED)
332     include_directories(${X11_INCLUDE_DIR})
333     add_definitions(-DXWINDOWS=1)
334 endif ()
335
336 if (BUILD_BINARIES)
337     include_directories("${PROJECT_SOURCE_DIR}/include")
338     include_directories("${PROJECT_SOURCE_DIR}/libs")
339
340     macro (copy_dlls target)
341         if (BUNDLE_LIBRARIES AND BUNDLING_SUPPORTED)
342             add_custom_command(TARGET ${target} POST_BUILD
343                 COMMAND "${PROJECT_SOURCE_DIR}/library-bundler"
344                 "register" "${PROJECT_BINARY_DIR}" "$<TARGET_FILE:${target}>"
345                 VERBATIM
346             )
347             add_dependencies(bundle ${target})
348         endif ()
349     endmacro ()
350 endif ()
351
352 #-----------------------------------------------------------------------
353 # Bundle
354 #-----------------------------------------------------------------------
355
356 if (BUILD_BINARIES)
357     if (BUNDLE_LIBRARIES AND BUNDLING_SUPPORTED)
358         add_subdirectory(bundle)
359     endif ()
360 endif ()
361
362 #-----------------------------------------------------------------------
363 # Builtins: targets
364 #-----------------------------------------------------------------------
365
366 add_custom_target(builtins)
367
368 if (BUILTIN_GTKGLEXT OR BUILTIN_GTKTHEME_MOJAVE)
369     include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
370 endif ()
371
372 if (BUILTIN_GTKGLEXT)
373     set(GTKGLEXT_PKGNAMES "gdk-2.0 gtk+-2.0 glib-2.0")
374
375     if (NOT APPLE)
376         set(GTKGLEXT_PKGNAMES "${GTKGLEXT_PKGNAMES} gl")
377     endif ()
378
379     execute_process(COMMAND pkg-config --libs ${GTKGLEXT_PKGNAMES}
380         OUTPUT_VARIABLE GTKGLEXT_LDFLAGS
381         OUTPUT_STRIP_TRAILING_WHITESPACE
382     )
383
384     set(GTKGLEXT_LDFLAGS "$ENV{LDFLAGS} -lm ${GTKGLEXT_LDFLAGS}")
385
386     execute_process(COMMAND pkg-config --cflags ${GTKGLEXT_PKGNAMES}
387         OUTPUT_VARIABLE GTKGLEXT_CFLAGS
388         OUTPUT_STRIP_TRAILING_WHITESPACE
389     )
390
391     set(GTKGLEXT_CFLAGS "$ENV{CFLAGS} ${GTKGLEXT_CFLAGS}")
392
393
394     set(CONFIGURE_OPTIONS --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-dependency-tracking --without-x)
395
396     if (CMAKE_BUILD_TYPE MATCHES Release)
397         set(CONFIGURE_OPTIONS ${CONFIGURE_OPTIONS} --disable-debug)
398     endif ()
399
400     if (APPLE)
401         set(GTKGLEXT_GIT_TAG macos)
402     else ()
403         set(GTKGLEXT_GIT_TAG fixes)
404     endif ()
405
406     if (APPLE)
407         set(GTKGLEXT_CFLAGS "${GTKGLEXT_CFLAGS} -DGL_SILENCE_DEPRECATION=1 -Wno-deprecated-declarations")
408     endif ()
409
410     ExternalProject_Add(gtkglext
411         GIT_REPOSITORY https://gitlab.gnome.org/illwieckz/gtkglext.git
412         GIT_TAG ${GTKGLEXT_GIT_TAG}
413         BUILD_IN_SOURCE ON
414         CONFIGURE_COMMAND export CCFLAGS=${GTKGLEXT_CFLAGS}
415         CONFIGURE_COMMAND && export LDFLAGS=${GTKGLEXT_LDFLAGS}
416         CONFIGURE_COMMAND && export NOCONFIGURE=1
417         CONFIGURE_COMMAND && ./autogen.sh
418         CONFIGURE_COMMAND && ./configure --prefix "${BUILTINS_INSTALL_DIR}" ${CONFIGURE_OPTIONS}
419         BUILD_COMMAND $(MAKE)
420         BUILD_COMMAND CFLAGS=${GTKGLEXT_CFLAGS}
421         BUILD_COMMAND LDFLAGS=${GTKGLEXT_LDFLAGS}
422         INSTALL_COMMAND $(MAKE) install
423     )
424
425     include_directories("${BUILTINS_INCLUDE_DIR}/gtkglext-1.0")
426     include_directories("${BUILTINS_LIB_DIR}/gtkglext-1.0/include")
427
428     add_dependencies(builtins gtkglext)
429     set_target_properties(gtkglext PROPERTIES EXCLUDE_FROM_ALL ON)
430 endif ()
431
432 if (BUNDLE_LIBRARIES)
433     # It was required to tell cmake to not patch rpath on macos builtins.
434     # It was also required to tell cmake to not patch rpath on freebsd binaries.
435     # Patching rpath is done in library_bundler instead so we can skip this
436     # step entirely when bundling.
437     set(CMAKE_SKIP_RPATH ON)
438 endif()
439
440 if (BUILTIN_GTKTHEME_MOJAVE)
441     ExternalProject_Add(gtktheme-mojave
442         GIT_REPOSITORY https://github.com/vinceliuice/Mojave-gtk-theme.git
443         GIT_TAG master
444         BUILD_IN_SOURCE ON
445         CONFIGURE_COMMAND echo
446         BUILD_COMMAND echo
447         INSTALL_COMMAND ./install.sh -o standard -a standard -s standard -i standard -d "${PROJECT_BINARY_DIR}/themes"
448     )
449     add_dependencies(builtins gtktheme-mojave)
450     set_target_properties(gtktheme-mojave PROPERTIES EXCLUDE_FROM_ALL ON)
451 endif ()
452
453 #-----------------------------------------------------------------------
454 # Libraries
455 #-----------------------------------------------------------------------
456
457 if (BUILD_BINARIES)
458     add_subdirectory(libs)
459 endif ()
460
461 if (BUILD_RADIANT)
462     add_subdirectory(include)
463 endif ()
464
465 #-----------------------------------------------------------------------
466 # Plugins
467 #-----------------------------------------------------------------------
468
469 if (BUILD_RADIANT)
470     add_subdirectory(contrib)
471 endif ()
472
473 #-----------------------------------------------------------------------
474 # Modules
475 #-----------------------------------------------------------------------
476
477 if (BUILD_RADIANT)
478     add_subdirectory(plugins)
479 endif ()
480
481 #-----------------------------------------------------------------------
482 # Radiant
483 #-----------------------------------------------------------------------
484
485 if (BUILD_BINARIES)
486     macro (radiant_tool name)
487         add_dependencies(binaries ${name})
488
489         if (WIN32)
490             add_executable(${name} ${ARGN} ${PROJECT_SOURCE_DIR}/include/lib.rc)
491         else ()
492             add_executable(${name} ${ARGN})
493         endif()
494
495         copy_dlls(${name})
496
497         install(
498             TARGETS ${name}
499             RUNTIME DESTINATION ${RADIANT_BIN_DIR}
500         )
501     endmacro ()
502
503     if (BUILD_RADIANT)
504         add_subdirectory(radiant)
505     endif ()
506 endif ()
507
508 #-----------------------------------------------------------------------
509 # Tools
510 #-----------------------------------------------------------------------
511
512 if (BUILD_TOOLS)
513     add_subdirectory(tools)
514
515     file(GLOB DATA_FILES "${PROJECT_SOURCE_DIR}/setup/data/tools/*")
516
517     if (NOT (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR))
518         # Copy data files from sources to the build directory
519         message(STATUS "Copying data files")
520         file(COPY ${DATA_FILES} DESTINATION "${PROJECT_BINARY_DIR}")
521     endif ()
522 endif ()
523
524 #-----------------------------------------------------------------------
525 # Game packs
526 #-----------------------------------------------------------------------
527
528 set(GAMEPACKS_LICENSE_LIST free CACHE STRING "Download game packs by license")
529 set(GAMEPACKS_NAME_LIST none CACHE STRING "Download game packs by name")
530
531 if (DOWNLOAD_GAMEPACKS)
532     add_custom_target(gamepacks ALL
533        COMMAND "${PROJECT_SOURCE_DIR}/gamepack-manager" --license ${GAMEPACKS_LICENSE_LIST} --name ${GAMEPACKS_NAME_LIST} --download-dir "${GAMEPACKS_DOWNLOAD_DIR}" --install-dir "${PROJECT_BINARY_DIR}/gamepacks" --download --install
534        COMMENT "Downloading game packs"
535     )
536 endif ()
537
538 #-----------------------------------------------------------------------
539 # Install
540 #-----------------------------------------------------------------------
541
542 if (BUILD_BINARIES)
543     install(DIRECTORY
544         setup/data/tools/base
545         setup/data/tools/bitmaps
546         setup/data/tools/gl
547         setup/data/tools/plugins
548         docs
549         DESTINATION ${RADIANT_DATA_DIR}
550     )
551
552     install(FILES
553         setup/data/tools/global.xlink
554         DESTINATION ${RADIANT_DATA_DIR}
555     )
556 endif ()
557
558 if (DOWNLOAD_GAMEPACKS)
559     install(DIRECTORY
560         ${PROJECT_BINARY_DIR}/gamepacks
561         DESTINATION ${RADIANT_DATA_DIR}
562     )
563 endif ()
564
565 if (BUILD_BINARIES AND FHS_INSTALL AND NOT WIN32 AND NOT APPLE)
566     install(FILES
567         icons/netradiant.png
568         DESTINATION ${RADIANT_SHARE_DIR}/pixmaps
569     )
570     install(FILES
571         icons/netradiant.desktop
572         DESTINATION ${RADIANT_SHARE_DIR}/applications
573     )
574     install(FILES
575         icons/x-netradiant-map.xml
576         DESTINATION ${RADIANT_SHARE_DIR}/mime/application
577     )
578 endif ()
579
580 if (APPLE)
581     install(DIRECTORY
582         setup/macos/Contents
583         DESTINATION ${APPLE_INSTALL_PREFIX}
584     )
585     install(DIRECTORY
586     ${PROJECT_BINARY_DIR}/themes
587         DESTINATION ${APPLE_INSTALL_PREFIX}/Contents/Prefix/share
588     )
589     install(PROGRAMS
590         setup/macos/NetRadiant
591         DESTINATION ${APPLE_INSTALL_PREFIX}/Contents/MacOS
592     )
593 endif ()
594
595 include(cmake/scripts/package.cmake)