]> git.mcshandy.xyz Git - barrow_crawler/commitdiff
Start removing windows things that never really worked. Small updates to CMakeLists...
authorRandy McShandy <randy@mcshandy.xyz>
Sun, 10 Aug 2025 01:43:25 +0000 (20:43 -0500)
committerRandy McShandy <randy@mcshandy.xyz>
Sun, 10 Aug 2025 01:43:25 +0000 (20:43 -0500)
CMakeLists.txt
bin/posix_BC
build_win.sh
src/platforms/platform_win.c [deleted file]

index f6c5c88ae7e038793ddaa19b523f5ef57e9ec0c0..849b59fce7629698d352ac1481b01b72f2f910e1 100644 (file)
@@ -8,23 +8,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 set(CMAKE_C_COMPILER gcc)
 
 FILE(GLOB POSIX_SRC src/*.c src/platforms/platform_posix.c)
-FILE(GLOB WINDOWS_SRC src/*.c src/platforms/platform_win.c)
+FILE(GLOB WINDOWS_SRC src/*.c src/platforms/platform_posix.c)
 
 add_executable(posix_BC ${POSIX_SRC})
-add_executable(ng_posix_BC ${POSIX_SRC})
 add_executable(windows_BC ${WINDOWS_SRC})
 
 target_compile_definitions(posix_BC PUBLIC POSIX_BC=1)
-target_compile_definitions(ng_posix_BC PUBLIC POSIX_BC=1)
 target_compile_definitions(windows_BC PUBLIC WINDOWS_BC=1)
 
-target_compile_options(posix_BC PUBLIC -Wall -g -DENABLE_BARROWGEN)
-target_compile_options(ng_posix_BC PUBLIC -Wall -g)
+target_compile_options(posix_BC PUBLIC -Wall -g)
 
 target_link_libraries(posix_BC -lm -lpthread -lraylib)
-target_link_libraries(ng_posix_BC -lm -lpthread -lraylib)
 target_link_libraries(windows_BC -lm -lpthread -lraylib)
 
 set_target_properties(posix_BC PROPERTIES RUNTIME_OUTPUT_DIRECTORY ./bin/)
-set_target_properties(ng_posix_BC PROPERTIES RUNTIME_OUTPUT_DIRECTORY ./bin/)
 set_target_properties(windows_BC PROPERTIES RUNTIME_OUTPUT_DIRECTORY ./bin/)
index 72246313d40bacb8d8cca3b144077e948e3fb3c6..a37f5529fecce6880485648752142735614893bc 100755 (executable)
Binary files a/bin/posix_BC and b/bin/posix_BC differ
index aa12d560660bc8e6d8882654f3d3c02746161d46..49bedfcbad51df32de4a145355df1215067028fa 100755 (executable)
@@ -11,7 +11,7 @@ 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_win.c"
+SRCS="./src/*.c ./src/platforms/platform_posix.c"
 OUTDIR="./release/win"
 
 rm -rf ./release/win
@@ -31,4 +31,4 @@ cp CHANGELOG.TXT                                      $OUTDIR/
 
 # package things up
 zip -r zipfile $OUTDIR/*
-mv zipfile.zip ./release/barrow_0.0.2_win.zip
+mv zipfile.zip ./release/barrow_0.1.0_win.zip
diff --git a/src/platforms/platform_win.c b/src/platforms/platform_win.c
deleted file mode 100644 (file)
index 77cb6fa..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-#warning TODO: Support windowschuds
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../structs.h"
-
-worker_arg warg;
-int waiting_workers;
-
-extern FVec2 ** grid;
-extern FVec2 ** grid_prime;
-extern FVec2 ** grid_temp;
-extern IVec2 grid_size;
-
-pthread_t* threads;
-pthread_mutex_t mutex;
-pthread_barrier_t barrier;
-
-/* TODO: This should go in a header, platforms don't care. */
-float rd_a_prime(FVec2 **source_grid, RD_Opts opts, int x, int y, Mat3 kernel, float A, float B);
-float rd_b_prime(FVec2** source_grid, RD_Opts opts, int x, int y, Mat3 kernel, float A, float B);
-
-void* iterator(void* _arg)
-{
-       worker_arg* warg = (worker_arg*)_arg;
-       RD_Opts opts = warg->opts;
-       int start_x = warg->start_x;
-       int start_y = warg->start_y;
-       int w = warg->width;
-       int h = warg->height;
-
-       for (warg->iterations = 0; warg->iterations < warg->max_iterations; warg->iterations++)
-       {
-               for (int x = start_x; x < w + start_x && x < grid_size.x; x++)
-               {
-                       for (int y = start_y; y < h + start_y && y < grid_size.y; y++)
-                       {
-                               FVec2 each = grid[x][y];
-                               if (each.c >= 0.5f)
-                               {
-                                       each.b = 1.0f;
-                                       each.c -= 5.0f/((float)(opts.max_iterations/100.0f));
-                               }
-                               grid_prime[x][y].a = rd_a_prime(grid, opts, x, y, laplacian_kernel, each.a, each.b);
-                               grid_prime[x][y].b = rd_b_prime(grid, opts, x, y, laplacian_kernel, each.a, each.b);
-                       }
-               }
-
-               pthread_mutex_lock(&mutex);
-               if (++waiting_workers == warg->worker_count)
-               {
-                       grid_temp = grid;
-                       grid = grid_prime;
-                       grid_prime = grid_temp;
-                       waiting_workers = 0;
-                       resource_generation_progress = ((float)warg->iterations/(float)warg->max_iterations);
-               }
-               pthread_mutex_unlock(&mutex);
-               pthread_barrier_wait(&barrier);
-       }
-
-       // One last synchronization so boss thread doesn't die early
-       pthread_barrier_wait(&barrier);
-       playtime.should_quit = 1;
-
-       return _arg;
-}
-
-void start(int worker_count, RD_Opts active_opt)
-{
-       worker_arg warg = (worker_arg){
-               active_opt, grid, grid_prime,
-               0, 0, (grid_size.x), (grid_size.y),
-               .worker_count = worker_count,
-               .max_iterations = active_opt.max_iterations
-       };
-
-       threads = (pthread_t*)malloc(sizeof(pthread_t) * worker_count);
-       pthread_mutex_init(&mutex, NULL);
-       pthread_barrier_init(&barrier, NULL, warg.worker_count);
-
-       worker_arg wargs[worker_count];
-
-       for (int t = 0; t < warg.worker_count; t++)
-       {
-               wargs[t]                        = warg;
-               wargs[t].worker_id      = t;
-               wargs[t].width          = (grid_size.x/worker_count) + ((t == worker_count-1) ? 0 : 4);
-               wargs[t].start_x        = (wargs[t].width * t);
-               pthread_create(&threads[t], NULL, iterator, &wargs[t]);
-       }
-}
-
-/* TODO: Revisit this for any new additions. */
-int cleanup()
-{
-       for (int t = 0; t < warg.worker_count; t++)
-       {
-               pthread_join(threads[t], NULL);
-       }
-
-       /* TODO: Actually this probably shouldn't be freeing resources allocated outside of the unit. */
-       free(grid);
-       free(grid_prime);
-       free(threads);
-
-       return 0;
-}
-