]> git.mcshandy.xyz Git - barrow_crawler/commitdiff
Update windows build script for changes, verify that mingw-gcc build runs on a window...
authorRandy McShandy <randy@mcshandy.xyz>
Sun, 10 Aug 2025 15:03:58 +0000 (10:03 -0500)
committerRandy McShandy <randy@mcshandy.xyz>
Sun, 10 Aug 2025 15:03:58 +0000 (10:03 -0500)
CMakeLists.txt
build_win.sh
src/structs.c
src/structs.h
src/utils.c
src/utils.h [new file with mode: 0644]

index 849b59fce7629698d352ac1481b01b72f2f910e1..bb8962b97b6ee8b0f3716b4bd7472f9a4ba969dd 100644 (file)
@@ -8,6 +8,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 set(CMAKE_C_COMPILER gcc)
 
 FILE(GLOB POSIX_SRC src/*.c src/platforms/platform_posix.c)
+
+# Win is built with ./build_win.sh
 FILE(GLOB WINDOWS_SRC src/*.c src/platforms/platform_posix.c)
 
 add_executable(posix_BC ${POSIX_SRC})
index 49bedfcbad51df32de4a145355df1215067028fa..bd25e598b6496e409d6e3890e1c2a2237672be9b 100755 (executable)
@@ -6,23 +6,22 @@
 # https://wiki.winehq.org/Debug_Channels
 # WINEDEBUG=warn+module wine release/win/barrow.exe
 
-CC=x86_64-w64-mingw32-gcc
-RAYLIB_DIR=/home/randy/Downloads/raylib-5.0_win64_mingw-w64
-LIBDIR=/usr/x86_64-w64-mingw32
-RAYLIB=$RAYLIB_DIR/lib/libraylib.a
-PTH=$LIBDIR/bin/libwinpthread-1.dll
-SRCS="./src/*.c ./src/platforms/platform_posix.c"
-OUTDIR="./release/win"
+export CC=x86_64-w64-mingw32-gcc
+export RAYLIBDIR=./external/raylib-5.5_win64_mingw-w64
+export LIBDIR=/usr/x86_64-w64-mingw32
+export PTH=$LIBDIR/bin/libwinpthread-1.dll
+export SRCS="./src/*.c ./src/platforms/platform_posix.c"
+export OUTDIR="./release/win"
 
 rm -rf ./release/win
 mkdir ./release/win
 mkdir ./release/win/src
 mkdir ./release/win/src/shaders
 
-$CC $SRCS $PTH raylib.dll  -mthreads -mwindows -lwinmm -o ./release/win/barrow.exe
+$CC $RAYLIBDIR/lib/raylib.dll $SRCS $PTH -DMINGW -mthreads -mwindows -lwinmm -I$LIBDIR/include -I$RAYLIBDIR/include -o ./release/win/barrow.exe
 
 cp $PTH                                                                                $OUTDIR/
-cp $RAYLIB_DIR/lib/raylib.dll $OUTDIR/
+cp $RAYLIBDIR/lib/raylib.dll $OUTDIR/
 cp -r src/shaders                                      $OUTDIR/src/
 cp -r assets                                                   $OUTDIR/
 cp LICENSES.TXT                                                $OUTDIR/
index 620a025a85033a064f5bc2af8cf3bae493ecd753..55b71596b584a43cde01d291fa14a402e5ff81de 100644 (file)
@@ -1,4 +1,9 @@
+#ifdef MINGW
+#include <pthread.h>
+#else
 #include <bits/pthreadtypes.h>
+#endif
+
 #include <raylib.h>
 #include "structs.h"
 
index 8ab908af00604babddff248df617c6b81d6a144c..4836c8c6d3447c49fb1536d67658dd970d5b732f 100644 (file)
@@ -1,7 +1,12 @@
 #ifndef __RD_STRUCTS__
 #define __RD_STRUCTS__
 
+#ifdef MINGW
+#include <pthread.h>
+#else
 #include <bits/pthreadtypes.h>
+#endif
+
 #define GRID_X 256
 #define GRID_Y GRID_X
 
index 36c2faf767a309805b9f0af6be98a67e3bdf9342..9b805fc5f7fcc6d5ed698f12cc7bfdcac41d4536 100644 (file)
@@ -265,7 +265,12 @@ void* generate_rd(void* args)
 int save_game(PlaytimeData playtime)
 {
   int success = -1;
+
+#ifdef MINGW
+  success = mkdir("./save");
+#else
   success = mkdir("./save", 0755);
+#endif
 
   if ((success == 0) || (errno == EEXIST))
   {
diff --git a/src/utils.h b/src/utils.h
new file mode 100644 (file)
index 0000000..52c3737
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __UTILS_GUARD__
+#define __UTILS_GUARD__
+#include "structs.h"
+
+#ifdef MINGW
+#include <minwindef.h>
+#define MAX(a,b) max(a,b)
+#endif
+
+bool initialize_generation_info(const IVec2 pgrid_size, const int pworker_count);
+bool deinitialize_generation_info();
+
+int cleanup_generated_files();
+int delete_save();
+
+#endif /* __UTILS_GUARD__ */
+