]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge branch 'quake2' into 'master'
authorThomas Debesse <gitlab@illwieckz.net>
Tue, 18 Jun 2019 21:38:06 +0000 (21:38 +0000)
committerThomas Debesse <gitlab@illwieckz.net>
Tue, 18 Jun 2019 21:38:06 +0000 (21:38 +0000)
cmake: building quake2 and heretic2 tools to be on par with legacy makefile

See merge request xonotic/netradiant!134

17 files changed:
icons/h2data.ico
icons/h2data.xcf [new file with mode: 0644]
icons/q2map.ico
icons/q3data.ico
icons/q3data.xcf [new file with mode: 0644]
icons/q3map2.ico
tools/CMakeLists.txt
tools/quake2/CMakeLists.txt [new file with mode: 0644]
tools/quake2/q2map/q2map.rc [new file with mode: 0644]
tools/quake2/qdata/qdata.rc [new file with mode: 0644]
tools/quake2/qdata_heretic2/CMakeLists.txt [new file with mode: 0644]
tools/quake2/qdata_heretic2/common/threads.c
tools/quake2/qdata_heretic2/h2data.rc [new file with mode: 0644]
tools/quake2/qdata_heretic2/icon1.ico [deleted file]
tools/quake2/qdata_heretic2/images.c
tools/quake2/qdata_heretic2/script1.aps [deleted file]
tools/quake2/qdata_heretic2/script1.rc [deleted file]

index 8f44194128ade27ac79a97e16a0100032e36fc90..cc465b8f488e71bc8dbc2979920c6f0d9dffcc2f 100644 (file)
Binary files a/icons/h2data.ico and b/icons/h2data.ico differ
diff --git a/icons/h2data.xcf b/icons/h2data.xcf
new file mode 100644 (file)
index 0000000..90bb093
Binary files /dev/null and b/icons/h2data.xcf differ
index 5c508c916d6f6acbd73a33fbfa54412068cd1aea..fdbefc29d694d92759eafe6ea3f094ddea779c44 100644 (file)
Binary files a/icons/q2map.ico and b/icons/q2map.ico differ
index 8f44194128ade27ac79a97e16a0100032e36fc90..cc4f2d3f92303f4a962377d592a509bb2fca2414 100644 (file)
Binary files a/icons/q3data.ico and b/icons/q3data.ico differ
diff --git a/icons/q3data.xcf b/icons/q3data.xcf
new file mode 100644 (file)
index 0000000..9097384
Binary files /dev/null and b/icons/q3data.xcf differ
index 4fe56fa66b6c64f555216795121402f9f324afbc..52758dc46e98d02ce7bcc0dccae8eff0011343f7 100644 (file)
Binary files a/icons/q3map2.ico and b/icons/q3map2.ico differ
index 4c2c5d28f8a2c81359e1f328831db320091dffc5..b36bb6cf399f9a8761477c021c30d9e6da792d9f 100644 (file)
@@ -1,6 +1,8 @@
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
 
+add_subdirectory(quake2)
+add_subdirectory(quake2/qdata_heretic2)
 add_subdirectory(quake3)
 
 add_custom_target(tools)
-add_dependencies(tools quake3)
+add_dependencies(tools quake2 heretic2 quake3)
diff --git a/tools/quake2/CMakeLists.txt b/tools/quake2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6945ee6
--- /dev/null
@@ -0,0 +1,99 @@
+include_directories(BEFORE common)
+
+find_package(LibXml2 REQUIRED)
+include_directories(${LIBXML2_INCLUDE_DIR})
+
+radiant_tool(q2map
+    WIN32 q2map/q2map.rc
+
+    common/bspfile.c common/bspfile.h
+    common/cmdlib.c common/cmdlib.h
+    common/inout.c common/inout.h
+    common/l3dslib.c common/l3dslib.h
+    common/lbmlib.c common/lbmlib.h
+    common/mathlib.c common/mathlib.h
+    common/md4.c common/md4.h
+    common/path_init.c
+    common/qfiles.h
+    common/polylib.c common/polylib.h
+    common/scriplib.c common/scriplib.h
+    common/threads.c common/q2_threads.h
+    common/trilib.c common/trilib.h
+    
+    q2map/brushbsp.c
+    q2map/csg.c
+    q2map/faces.c
+    q2map/flow.c
+#   q2map/gldraw.c
+    q2map/glfile.c
+    q2map/leakfile.c
+    q2map/lightmap.c
+    q2map/main.c q2map/q2map.h
+    q2map/map.c
+    q2map/nodraw.c
+    q2map/patches.c
+    q2map/portals.c
+    q2map/prtfile.c
+    q2map/qbsp.c
+    q2map/qbsp.h
+    q2map/qrad.c
+    q2map/qrad.h
+    q2map/qvis.c
+    q2map/qvis.h
+    q2map/textures.c
+    q2map/trace.c
+    q2map/tree.c
+    q2map/writebsp.c
+)
+
+target_compile_definitions(q2map
+    PRIVATE
+)
+
+target_link_libraries(q2map
+    ${LIBXML2_LIBRARIES}
+    l_net
+)
+
+radiant_tool(qdata3
+    WIN32 qdata/qdata.rc
+
+    common/bspfile.c common/bspfile.h
+    common/cmdlib.c common/cmdlib.h
+    common/inout.c common/inout.h
+    common/l3dslib.c common/l3dslib.h
+    common/lbmlib.c common/lbmlib.h
+    common/mathlib.c common/mathlib.h
+    common/md4.c common/md4.h
+    common/path_init.c
+    common/qfiles.h
+    common/polylib.c common/polylib.h
+    common/scriplib.c common/scriplib.h
+    common/threads.c common/q2_threads.h
+    common/trilib.c common/trilib.h
+
+    qdata/anorms.h
+    qdata/images.c
+    qdata/models.c
+    qdata/qdata.c qdata/qdata.h
+    qdata/sprites.c
+    qdata/tables.c
+    qdata/video.c
+)
+
+target_compile_definitions(qdata3
+    PRIVATE
+)
+
+target_link_libraries(qdata3
+    ${LIBXML2_LIBRARIES}
+    l_net
+)
+
+add_custom_target(quake2)
+add_dependencies(quake2 q2map qdata3)
+
+if (UNIX)
+    target_link_libraries(q2map pthread m)
+    target_link_libraries(qdata3 pthread m)
+endif ()
diff --git a/tools/quake2/q2map/q2map.rc b/tools/quake2/q2map/q2map.rc
new file mode 100644 (file)
index 0000000..29e1dbd
--- /dev/null
@@ -0,0 +1 @@
+101                     ICON    DISCARDABLE     "..\\..\\..\\icons\\q2map.ico"
diff --git a/tools/quake2/qdata/qdata.rc b/tools/quake2/qdata/qdata.rc
new file mode 100644 (file)
index 0000000..d6e75b9
--- /dev/null
@@ -0,0 +1 @@
+101                     ICON    DISCARDABLE     "..\\..\\..\\icons\\qdata3.ico"
diff --git a/tools/quake2/qdata_heretic2/CMakeLists.txt b/tools/quake2/qdata_heretic2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..aae4659
--- /dev/null
@@ -0,0 +1,73 @@
+include_directories(BEFORE . common qcommon)
+
+find_package(OpenGL REQUIRED)
+
+find_package(LibXml2 REQUIRED)
+include_directories(${LIBXML2_INCLUDE_DIR})
+
+radiant_tool(h2data
+    WIN32 h2data.rc
+
+    common/bspfile.c common/bspfile.h
+    common/cmdlib.c common/cmdlib.h
+    common/inout.c common/inout.h
+    common/l3dslib.c common/l3dslib.h
+    common/lbmlib.c common/lbmlib.h
+    common/mathlib.c common/mathlib.h
+    common/md4.c common/md4.h
+    common/path_init.c
+    common/polylib.c common/polylib.h
+    common/qfiles.c common/qfiles.h
+    common/scriplib.c common/scriplib.h
+    common/threads.c common/her2_threads.h
+    common/token.c common/token.h
+    common/trilib.c common/trilib.h
+
+    qcommon/angles.h
+    qcommon/arrayedlist.h
+    qcommon/flex.h
+    qcommon/fmodel.h
+    qcommon/h2common.h
+    qcommon/placement.h
+    qcommon/qfiles.h
+    qcommon/q_typedef.h
+    qcommon/reference.c qcommon/reference.h
+    qcommon/resourcemanager.c qcommon/resourcemanager.h
+    qcommon/skeletons.c qcommon/skeletons.h
+
+    adpcm.h
+    animcomp.c animcomp.h 
+    anorms.h
+    book.c
+    fmodels.c qd_fmodel.h
+    images.c
+    jointed.c
+    jointed.h
+    joints.h
+    models.c
+    pics.c
+    qdata.c qdata.h
+    qd_skeletons.c qd_skeletons.h
+    resource.h
+    sprites.c
+    svdcmp.c
+    tables.c
+    tmix.c
+    video.c
+)
+
+target_compile_definitions(h2data
+    PRIVATE
+)
+
+target_link_libraries(h2data
+    ${LIBXML2_LIBRARIES}
+    l_net
+)
+
+add_custom_target(heretic2)
+add_dependencies(heretic2 h2data)
+
+if (UNIX)
+    target_link_libraries(h2data pthread m)
+endif ()
index 5fe2894098480d6320f54b6b35c6ce91c0e7c62b..239226b776f454f7054e39bc4ce314a2efec4fc8 100644 (file)
@@ -86,7 +86,7 @@ void ThreadWorkerFunction( int threadnum ){
                if ( work == -1 ) {
                        break;
                }
-//Sys_Printf ("thread %i, work %i\n", threadnum, work);
+               //Sys_Printf ("thread %i, work %i\n", threadnum, work);
                workfunction( work );
        }
 }
@@ -112,7 +112,8 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )(
 
 #include <windows.h>
 
-int numthreads = -1;
+// Setting default Threads to 1
+int numthreads = 1;
 CRITICAL_SECTION crit;
 static int enter;
 
@@ -227,6 +228,7 @@ void ThreadSetDefault( void ){
        }
 }
 
+
 #include <pthread.h>
 
 pthread_mutex_t *my_mutex;
@@ -405,7 +407,8 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    =======================================================================
  */
 
-int numthreads = 4;
+// Setting default Threads to 1
+int numthreads = 1;
 
 void ThreadSetDefault( void ){
        if ( numthreads == -1 ) { // not set manually
@@ -527,12 +530,9 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
                if ( pthread_mutexattr_init( &mattrib ) != 0 ) {
                        Error( "pthread_mutexattr_init failed" );
                }
-#if __GLIBC_MINOR__ == 1
-               if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_FAST_NP ) != 0 )
-#else
-               if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_ADAPTIVE_NP ) != 0 )
-#endif
-               { Error( "pthread_mutexattr_settype failed" ); }
+               if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_ERRORCHECK ) != 0 ) {
+                       Error( "pthread_mutexattr_settype failed" );
+               }
                recursive_mutex_init( mattrib );
 
                for ( i = 0 ; i < numthreads ; i++ )
diff --git a/tools/quake2/qdata_heretic2/h2data.rc b/tools/quake2/qdata_heretic2/h2data.rc
new file mode 100644 (file)
index 0000000..21540bc
--- /dev/null
@@ -0,0 +1,115 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON    DISCARDABLE     "..\\..\\..\\icons\\h2data.ico"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "Heavily modified from original ID tool\0"
+            VALUE "CompanyName", "Raven Software\0"
+            VALUE "FileDescription", "qdata\0"
+            VALUE "FileVersion", "2.0\0"
+            VALUE "InternalName", "qdata\0"
+            VALUE "LegalCopyright", "Copyright © 1998\0"
+            VALUE "OriginalFilename", "qdata.exe\0"
+            VALUE "ProductName", "Raven Software qdata\0"
+            VALUE "ProductVersion", "2.0\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // !_MAC
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/tools/quake2/qdata_heretic2/icon1.ico b/tools/quake2/qdata_heretic2/icon1.ico
deleted file mode 100644 (file)
index 8f44194..0000000
Binary files a/tools/quake2/qdata_heretic2/icon1.ico and /dev/null differ
index a7138b11184be12bd9f6fcb2899e6f549f411189..555303bc4c66861f1e1fe6e84d99a7cdcb8cd4dc 100644 (file)
  #include <windows.h>
 #endif
 
+#if GDEF_OS_MACOS && !defined( XWINDOWS )
+#include <OpenGL/gl.h>
+#else
 #include <GL/gl.h>
+#endif
 
 #if 1
 extern char     *g_outputDir;
diff --git a/tools/quake2/qdata_heretic2/script1.aps b/tools/quake2/qdata_heretic2/script1.aps
deleted file mode 100644 (file)
index 6650b67..0000000
Binary files a/tools/quake2/qdata_heretic2/script1.aps and /dev/null differ
diff --git a/tools/quake2/qdata_heretic2/script1.rc b/tools/quake2/qdata_heretic2/script1.rc
deleted file mode 100644 (file)
index 7d05374..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_ICON1               ICON    DISCARDABLE     "icon1.ico"
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE 
-BEGIN
-    "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE 
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE 
-BEGIN
-    "\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "Comments", "Heavily modified from original ID tool\0"
-            VALUE "CompanyName", "Raven Software\0"
-            VALUE "FileDescription", "qdata\0"
-            VALUE "FileVersion", "2.0\0"
-            VALUE "InternalName", "qdata\0"
-            VALUE "LegalCopyright", "Copyright © 1998\0"
-            VALUE "OriginalFilename", "qdata.exe\0"
-            VALUE "ProductName", "Raven Software qdata\0"
-            VALUE "ProductVersion", "2.0\0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
-#endif    // !_MAC
-
-#endif    // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-