set(RADIANT_BASENAME netradiant CACHE INTERNAL "...")
add_definitions(-DRADIANT_BASENAME="${RADIANT_BASENAME}")
-set(RADIANT_LIB_SUBDIR . CACHE INTERNAL "...")
-set(RADIANT_BIN_SUBDIR . CACHE INTERNAL "...")
-set(RADIANT_DATA_SUBDIR . CACHE INTERNAL "...")
+set(RADIANT_LIB_DIR ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "...")
+set(RADIANT_BIN_DIR ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "...")
+set(RADIANT_DATA_DIR ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "...")
if (FHS_INSTALL)
- set(RADIANT_LIB_SUBDIR lib/${RADIANT_BASENAME})
- set(RADIANT_BIN_SUBDIR bin)
- set(RADIANT_DATA_SUBDIR share/${RADIANT_BASENAME})
+ set(RADIANT_LIB_DIR lib/${RADIANT_BASENAME})
+ set(RADIANT_BIN_DIR bin)
+ set(RADIANT_DATA_DIR share/${RADIANT_BASENAME})
endif ()
#-----------------------------------------------------------------------
if (BUILD_BINARIES)
if (APPLE)
if (BUILD_RADIANT)
- option(XWINDOWS "Build against X11" ON)
- endif ()
+ option(XWINDOWS "Build against X11" ON)
+ endif()
add_definitions(
-DPOSIX=1
)
else ()
if (BUILD_RADIANT)
- set(XWINDOWS ON)
- endif()
+ set(XWINDOWS ON)
+ endif ()
add_definitions(
-DPOSIX=1
option(BUNDLE_LIBRARIES "Bundle libraries" ${BUNDLE_LIBRARIES_DEFAULT})
macro(copy_dlls target)
- if (BUNDLE_LIBRARIES)
+ if (BUNDLE_LIBRARIES AND WIN32)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND bash
- ARGS -c "ldd '$<TARGET_FILE:${target}>' | egrep -i '\\.dll ' | grep -iv '/c/Windows' | awk '{ print $1 }' | while read dll; do cp --preserve=timestamps \"$(which $dll)\" '${PROJECT_BINARY_DIR}'; done"
+ ARGS -c "ldd '$<TARGET_FILE:${target}>' | egrep -i '\\.dll ' | grep -iv '/c/Windows' | awk '{ print $1 }' | while read dll; do dllbasename=\"$(which \"$dll\")\"; [ -f \"${PROJECT_BINARY_DIR}/$dllbasename\" ] || cp --preserve=timestamps \"$dllbasename\" '${PROJECT_BINARY_DIR}'; done"
VERBATIM
- )
+ )
endif ()
endmacro()
+
+ macro(bundle_stuff target)
+ if (BUNDLE_LIBRARIES AND WIN32)
+ add_custom_command(TARGET ${target} POST_BUILD
+ COMMAND bash
+ ARGS -c "mkdir -p '${PROJECT_BINARY_DIR}/share/themes'; mkdir -p '${PROJECT_BINARY_DIR}/lib'; mingw=\"$(echo '${CMAKE_C_COMPILER}' | sed -e 's|/bin/.*||')\"; [ -d '${PROJECT_BINARY_DIR}/share/themes/MS-Windows' ] || cp -r --preserve=timestamps \"$mingw/share/themes/MS-Windows\" '${PROJECT_BINARY_DIR}/share/themes/'; [ -d '${PROJECT_BINARY_DIR}/lib/gdk-pixbuf-2.0' ] || cp -r --preserve=timestamps \"$mingw/lib/gdk-pixbuf-2.0\" '${PROJECT_BINARY_DIR}/lib/'; [ -d '${PROJECT_BINARY_DIR}/lib/gtk-2.0' ] || cp -r --preserve=timestamps \"$mingw/lib/gtk-2.0\" '${PROJECT_BINARY_DIR}/lib/'"
+ VERBATIM
+ )
+
+ file(GLOB DLL_FILES ${PROJECT_BINARY_DIR}/*.dll)
+
+ install(FILES
+ ${DLL_FILES}
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ )
+
+ install(DIRECTORY
+ ${PROJECT_BINARY_DIR}/lib
+ ${PROJECT_BINARY_DIR}/share
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ )
+ endif ()
+ endmacro ()
endif ()
#-----------------------------------------------------------------------
macro(radiant_tool name)
add_executable(${name} ${ARGN})
+
+ copy_dlls(${name})
+
install(
TARGETS ${name}
- RUNTIME DESTINATION ${RADIANT_BIN_SUBDIR}/.
+ RUNTIME DESTINATION ${RADIANT_BIN_DIR}
)
endmacro()
if (BUILD_BINARIES)
install(DIRECTORY
- setup/data/tools/
+ setup/data/tools
docs
- DESTINATION ${RADIANT_DATA_SUBDIR}/.
+ DESTINATION ${RADIANT_DATA_DIR}
)
endif ()
else ()
set(GAME_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif ()
- install(CODE
- "execute_process(COMMAND \"${PROJECT_SOURCE_DIR}/gamepack-manager\" --license ${GAMEPACKS_LICENSE_LIST} --name ${GAMEPACKS_NAME_LIST} --download-dir \"${PROJECT_BINARY_DIR}/download\" --install-dir \"${GAME_INSTALL_PREFIX}\" --install)"
- )
+
+ file(GLOB GAME_DIRS ${PROJECT_BINARY_DIR}/*.game)
+
+ install(DIRECTORY
+ ${PROJECT_BINARY_DIR}/games
+ ${GAME_DIRS}
+ DESTINATION ${RADIANT_DATA_DIR}
+ )
endif()
if(BUILD_BINARIES AND FHS_INSTALL AND NOT WIN32 AND NOT APPLE)
# Getting the sources
The latest source is available from the git repository:
+
https://gitlab.com/xonotic/netradiant.git
The git client can be obtained from the Git website:
+
http://git-scm.org
To get a copy of the source using the command line git client:
* Minizip
* ZLib
-## msys2
+To fetch default game packages you'll need Git and to fetch some optional ones you'll need Subversion.
+
+## MSYS2
-Under MSYS2, the mingw shell must be used
+Under MSYS2, the mingw shell must be used.
-### 32 bit:
+If you use MSYS2 over SSH, add `mingw64` to the path this way (given you compile for 64 bit windows):
```
-pacman -S --needed base-devel mingw-w64-i686-{toolchain,cmake,make,gtk2,gtkglexti,libwebp}
+export PATH="/mingw64/bin:${PATH}"`
```
-### 64 bit:
+Install the dependencies this way:
+
```
-pacman -S --needed base-devel mingw-w64-x86_64-{toolchain,cmake,make,gtk2,gtkglext,libwebp}
+pacman -S --needed base-devel mingw-w64-$(uname -m)-{toolchain,cmake,make,gtk2,gtkglext,libwebp,minizip-git} git
```
+Explicitely use `mingw-w64-x86_64-` or `mingw-w64-i686-` prefix if you need to target a non-default architecture.
+
+You may have to install `subversion` to fetch some non-default game packages.
+
+
## macOS:
```
options:
* `FHS_INSTALL=ON`
- Install files following the Filesystem Hierarchy Standard (bin, lib, share, etc.), also setup XDG mime and application support on POSIX systems (default: `OFF`, install like in 1999)
+ Available for POSIX systems: install files following the Filesystem Hierarchy Standard (bin, lib, share, etc.), also setup XDG mime and application support on Linux-like systems (default: `OFF`, install like in 1999)
* `CMAKE_INSTALL_PREFIX=/usr`
Install system-wide on Posix systems, always set `FHS_INSTALL` to `ON` when doing this (default: install in `install/` directory within source tree)
* `install`
Install files
+Note that because of both the way NetRadiant works and the way bundled library loading works CMake has to do some globbing to detect some of the produced/copied files it has to install. So you have to run cmake again before installing:
+
+```
+cmake -H. -Bbuild && cmake --build build -- install
+```
+
## Note about Crunch
The crnlib used to decode `.crn` files is the one from [Dæmon](http://github.com/DaemonEngine/Daemon) which is the one by [Unity](https://github.com/Unity-Technologies/crunch/tree/unity) made cross-platform and slightly improved. Since Unity brokes compatibility with [BinomialLLC's legacy tree](https://github.com/BinomialLLC/crunch) it's required to use either the `crunch` tool from Dæmon or the one from Unity to compress textures that have to be read by radiant or q3map2.
copy_dlls(${name})
install(
TARGETS ${name}
- LIBRARY DESTINATION ${RADIANT_LIB_SUBDIR}/plugins
+ LIBRARY DESTINATION ${RADIANT_LIB_DIR}/plugins
)
endmacro()
copy_dlls(${name})
install(
TARGETS ${name}
- LIBRARY DESTINATION ${RADIANT_LIB_SUBDIR}/modules
+ LIBRARY DESTINATION ${RADIANT_LIB_DIR}/modules
)
endmacro()
endif ()
copy_dlls(${RADIANT_BASENAME})
+bundle_stuff(${RADIANT_BASENAME})
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_RADIANT ICON DISCARDABLE "radiant.ico"
+IDI_RADIANT ICON DISCARDABLE "..\\icons\\netradiant.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
)
radiant_tool(q3map2
+ WIN32 q3map2/q3map2.rc
+
common/cmdlib.c common/cmdlib.h
common/imagelib.c common/imagelib.h
common/inout.c common/inout.h
)
radiant_tool(q3data
+ WIN32 q3data/q3data.rc
+
common/aselib.c common/aselib.h
common/bspfile.c common/bspfile.h
common/cmdlib.c common/cmdlib.h
--- /dev/null
+101 ICON DISCARDABLE "..\\..\\..\\icons\\q3data.ico"
-101 ICON DISCARDABLE "q3map2.ico"
+101 ICON DISCARDABLE "..\\..\\..\\icons\\q3map2.ico"