]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge branch 'msys2' into 'master'
authorThomas Debesse <gitlab@illwieckz.net>
Sat, 1 Jun 2019 20:55:27 +0000 (20:55 +0000)
committerThomas Debesse <gitlab@illwieckz.net>
Sat, 1 Jun 2019 20:55:27 +0000 (20:55 +0000)
msys2: fix build instructions, improve library bundling <3 @Mario

See merge request xonotic/netradiant!126

14 files changed:
CMakeLists.txt
README.md
contrib/CMakeLists.txt
icons/netradiant.ico [new file with mode: 0644]
icons/netradiant.png
icons/radiant.ico [deleted file]
plugins/CMakeLists.txt
radiant/CMakeLists.txt
radiant/radiant.ico [deleted file]
radiant/radiant.rc
radiant/radiant_old.ico [deleted file]
tools/quake3/CMakeLists.txt
tools/quake3/q3data/q3data.rc [new file with mode: 0644]
tools/quake3/q3map2/q3map2.rc

index ad592edfadc8e76234bb2cf2591962e5d0230aac..d7a6abe19f94601adc364f8c7af19207febfdad3 100644 (file)
@@ -25,14 +25,14 @@ endif ()
 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 ()
 
 #-----------------------------------------------------------------------
@@ -172,8 +172,8 @@ 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
@@ -189,8 +189,8 @@ if (BUILD_BINARIES)
         )
     else ()
         if (BUILD_RADIANT)
-        set(XWINDOWS ON)
-        endif()
+             set(XWINDOWS ON)
+        endif ()
 
         add_definitions(
                 -DPOSIX=1
@@ -217,14 +217,37 @@ if (BUILD_BINARIES)
     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 ()
 
 #-----------------------------------------------------------------------
@@ -266,9 +289,12 @@ if (BUILD_BINARIES)
 
     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()
 
@@ -316,9 +342,9 @@ endif()
 
 if (BUILD_BINARIES)
     install(DIRECTORY
-            setup/data/tools/
+            setup/data/tools
             docs
-            DESTINATION ${RADIANT_DATA_SUBDIR}/.
+            DESTINATION ${RADIANT_DATA_DIR}
     )
 endif ()
 
@@ -328,9 +354,14 @@ if (DOWNLOAD_GAMEPACKS)
     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)
index 6270506950b4f123153f45e6ea08ed6ae40fa9c4..9cbbde5c0c521ef95efbf9472b8dad03d723be6c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -8,9 +8,11 @@ The open source, cross platform level editor for idtech games (Radiant fork).
 # 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:
@@ -34,22 +36,30 @@ See also https://gitlab.com/xonotic/netradiant/ for a source browser, issues and
 * 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:
 
 ```
@@ -136,7 +146,7 @@ Run `./gamepacks-manager -h` to know about available licenses and other availabl
 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)
 
@@ -145,6 +155,12 @@ target:
 * `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.
index 468b4f12f26f2ab4f030fc4994a937167ee8dd00..f2515bf8bb235d8f91e7db81b88fa34619d96472 100644 (file)
@@ -8,7 +8,7 @@ macro(radiant_plugin name)
     copy_dlls(${name})
     install(
             TARGETS ${name}
-            LIBRARY DESTINATION ${RADIANT_LIB_SUBDIR}/plugins
+            LIBRARY DESTINATION ${RADIANT_LIB_DIR}/plugins
     )
 endmacro()
 
diff --git a/icons/netradiant.ico b/icons/netradiant.ico
new file mode 100644 (file)
index 0000000..b3f99e4
Binary files /dev/null and b/icons/netradiant.ico differ
index 720e9857940c093f1f188b28bb49c639386e94e8..4ec03fafa646af019a4facc3dff9e3be5dab86e7 100644 (file)
Binary files a/icons/netradiant.png and b/icons/netradiant.png differ
diff --git a/icons/radiant.ico b/icons/radiant.ico
deleted file mode 100644 (file)
index d377f82..0000000
Binary files a/icons/radiant.ico and /dev/null differ
index 808f31108576304930fb248611dee58c3f24d822..b3d2909174cfe8490633cdb2767f04b0f356e528 100644 (file)
@@ -8,7 +8,7 @@ macro(radiant_plugin name)
     copy_dlls(${name})
     install(
             TARGETS ${name}
-            LIBRARY DESTINATION ${RADIANT_LIB_SUBDIR}/modules
+            LIBRARY DESTINATION ${RADIANT_LIB_DIR}/modules
     )
 endmacro()
 
index 6fcb36809d27fa167e98fa8a4661672d42f47e66..424c42d6675e97bab647222f69af668cc74bd129 100644 (file)
@@ -131,3 +131,4 @@ if (X11_LIBRARIES)
 endif ()
 
 copy_dlls(${RADIANT_BASENAME})
+bundle_stuff(${RADIANT_BASENAME})
diff --git a/radiant/radiant.ico b/radiant/radiant.ico
deleted file mode 100644 (file)
index 45e8258..0000000
Binary files a/radiant/radiant.ico and /dev/null differ
index 51087c04cca3deddff4099013dca23ce771ce3f4..8380a5222e9f5f6bb83fb34853216792529c031f 100644 (file)
@@ -28,7 +28,7 @@
 
 // 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
 /////////////////////////////////////////////////////////////////////////////
diff --git a/radiant/radiant_old.ico b/radiant/radiant_old.ico
deleted file mode 100644 (file)
index b45ef36..0000000
Binary files a/radiant/radiant_old.ico and /dev/null differ
index b1e8e67b3dd8fbd29af0d142a6147908db94b6a5..e0bb8989138233bfe67714c52bf336e50fe05fcd 100644 (file)
@@ -59,6 +59,8 @@ set(q3map2_games
         )
 
 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
@@ -152,6 +154,8 @@ target_link_libraries(q3map2
         )
 
 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
diff --git a/tools/quake3/q3data/q3data.rc b/tools/quake3/q3data/q3data.rc
new file mode 100644 (file)
index 0000000..dd5c1d4
--- /dev/null
@@ -0,0 +1 @@
+101                     ICON    DISCARDABLE     "..\\..\\..\\icons\\q3data.ico"
index bc12037506f726d44a4150ba969b36477a2b36e8..d3db89b124f7478206d0f72a5a0c64219b6e9da9 100644 (file)
@@ -1 +1 @@
-101                     ICON    DISCARDABLE     "q3map2.ico"
+101                     ICON    DISCARDABLE     "..\\..\\..\\icons\\q3map2.ico"