From 797baf4de3d82294752b513d465224b78b1cf3fd Mon Sep 17 00:00:00 2001 From: rexim Date: Sun, 9 Jun 2024 10:41:56 +0700 Subject: [PATCH] Factor out everything related to the buidl to src_build/ folder --- nob.c | 14 +++++++------- src/nob.h => nob.h | 0 src/hotreload.h | 4 ++-- src/plug.c | 6 +++--- {src => src_build}/nob_linux.c | 6 +++--- {src => src_build}/nob_macos.c | 6 +++--- {src => src_build}/nob_openbsd.c | 6 +++--- {src => src_build}/nob_win64_mingw.c | 6 +++--- {src => src_build}/nob_win64_msvc.c | 12 ++++++------ {src => src_build}/targets.h | 0 10 files changed, 30 insertions(+), 30 deletions(-) rename src/nob.h => nob.h (100%) rename {src => src_build}/nob_linux.c (97%) rename {src => src_build}/nob_macos.c (97%) rename {src => src_build}/nob_openbsd.c (97%) rename {src => src_build}/nob_win64_mingw.c (98%) rename {src => src_build}/nob_win64_msvc.c (97%) rename {src => src_build}/targets.h (100%) diff --git a/nob.c b/nob.c index 8268e79..531d9c0 100644 --- a/nob.c +++ b/nob.c @@ -7,13 +7,13 @@ #include #define NOB_IMPLEMENTATION -#include "./src/nob.h" +#include "./nob.h" #define CONFIG_PATH "./build/config.h" #ifdef CONFIGURED -#include "./src/targets.h" +#include "./src_build/targets.h" #include CONFIG_PATH #define RAYLIB_VERSION "5.0" @@ -37,15 +37,15 @@ static const char *raylib_modules[] = { }; #if MUSIALIZER_TARGET == TARGET_LINUX -#include "src/nob_linux.c" +#include "src_build/nob_linux.c" #elif MUSIALIZER_TARGET == TARGET_MACOS -#include "src/nob_macos.c" +#include "src_build/nob_macos.c" #elif MUSIALIZER_TARGET == TARGET_WIN64_MINGW -#include "src/nob_win64_mingw.c" +#include "src_build/nob_win64_mingw.c" #elif MUSIALIZER_TARGET == TARGET_WIN64_MSVC -#include "src/nob_win64_msvc.c" +#include "src_build/nob_win64_msvc.c" #elif MUSIALIZER_TARGET == TARGET_OPENBSD -#include "src/nob_openbsd.c" +#include "src_build/nob_openbsd.c" #endif // MUSIALIZER_TARGET void log_available_subcommands(const char *program, Nob_Log_Level level) diff --git a/src/nob.h b/nob.h similarity index 100% rename from src/nob.h rename to nob.h diff --git a/src/hotreload.h b/src/hotreload.h index fd947ad..5ac06c7 100644 --- a/src/hotreload.h +++ b/src/hotreload.h @@ -4,8 +4,8 @@ #include #include "plug.h" -#include "targets.h" -#include "config.h" +#include "src_build/targets.h" +#include "build/config.h" #ifdef MUSIALIZER_HOTRELOAD #define PLUG(name, ...) extern name##_t *name; diff --git a/src/plug.c b/src/plug.c index dcded1e..c79f8e1 100644 --- a/src/plug.c +++ b/src/plug.c @@ -6,8 +6,8 @@ #include #include -#include "targets.h" -#include "config.h" +#include "src_build/targets.h" +#include "build/config.h" #include "plug.h" #include "ffmpeg.h" #define NOB_IMPLEMENTATION @@ -27,7 +27,7 @@ LIST_OF_PLUGS #undef PLUG #ifndef MUSIALIZER_UNBUNDLE -#include "bundle.h" +#include "build/bundle.h" MUSIALIZER_PLUG void plug_free_resource(void *data) { diff --git a/src/nob_linux.c b/src_build/nob_linux.c similarity index 97% rename from src/nob_linux.c rename to src_build/nob_linux.c index 2fdbab7..8900f6e 100644 --- a/src/nob_linux.c +++ b/src_build/nob_linux.c @@ -13,7 +13,7 @@ bool build_musializer(void) // Like `clang` for instance nob_cmd_append(&cmd, "cc"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-fPIC", "-shared"); nob_cmd_append(&cmd, "-o", "./build/libplug.so"); @@ -29,7 +29,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "cc"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, @@ -51,7 +51,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "cc"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, diff --git a/src/nob_macos.c b/src_build/nob_macos.c similarity index 97% rename from src/nob_macos.c rename to src_build/nob_macos.c index 306dac1..6c36729 100644 --- a/src/nob_macos.c +++ b/src_build/nob_macos.c @@ -14,7 +14,7 @@ bool build_musializer(void) // Like `clang` for instance nob_cmd_append(&cmd, "clang"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-g"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-fPIC", "-shared"); nob_cmd_append(&cmd, "-o", "./build/libplug.dylib"); @@ -28,7 +28,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "clang"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-g"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, @@ -46,7 +46,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "clang"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-g"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, diff --git a/src/nob_openbsd.c b/src_build/nob_openbsd.c similarity index 97% rename from src/nob_openbsd.c rename to src_build/nob_openbsd.c index 22fae4e..4fdb700 100644 --- a/src/nob_openbsd.c +++ b/src_build/nob_openbsd.c @@ -13,7 +13,7 @@ bool build_musializer(void) // Like `clang` for instance nob_cmd_append(&cmd, "cc"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-fPIC", "-shared"); nob_cmd_append(&cmd, "-o", "./build/libplug.so"); @@ -29,7 +29,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "cc"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, @@ -51,7 +51,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "cc"); nob_cmd_append(&cmd, "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, diff --git a/src/nob_win64_mingw.c b/src_build/nob_win64_mingw.c similarity index 98% rename from src/nob_win64_mingw.c rename to src_build/nob_win64_mingw.c index 8ce63ed..8807784 100644 --- a/src/nob_win64_mingw.c +++ b/src_build/nob_win64_mingw.c @@ -23,7 +23,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "x86_64-w64-mingw32-gcc"); nob_cmd_append(&cmd, "-mwindows", "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-fPIC", "-shared"); nob_cmd_append(&cmd, "-static-libgcc"); @@ -40,7 +40,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "x86_64-w64-mingw32-gcc"); nob_cmd_append(&cmd, "-mwindows", "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, @@ -62,7 +62,7 @@ bool build_musializer(void) cmd.count = 0; nob_cmd_append(&cmd, "x86_64-w64-mingw32-gcc"); nob_cmd_append(&cmd, "-mwindows", "-Wall", "-Wextra", "-ggdb"); - nob_cmd_append(&cmd, "-I./build/"); + nob_cmd_append(&cmd, "-I."); nob_cmd_append(&cmd, "-I./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "-o", "./build/musializer"); nob_cmd_append(&cmd, diff --git a/src/nob_win64_msvc.c b/src_build/nob_win64_msvc.c similarity index 97% rename from src/nob_win64_msvc.c rename to src_build/nob_win64_msvc.c index ae3a707..ff5f4e7 100644 --- a/src/nob_win64_msvc.c +++ b/src_build/nob_win64_msvc.c @@ -19,7 +19,7 @@ bool build_musializer(void) nob_cmd_append(&cmd, "cl.exe"); nob_cmd_append(&cmd, "/LD"); nob_cmd_append(&cmd, "/Fobuild\\", "/Fe./build/libplug.dll"); - nob_cmd_append(&cmd, "/I", "./build/"); + nob_cmd_append(&cmd, "/I", "./"); nob_cmd_append(&cmd, "/I", "./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "src/plug.c", @@ -30,10 +30,10 @@ bool build_musializer(void) "raylib.lib"); nob_cmd_append(&cmd, "Winmm.lib", "gdi32.lib", "User32.lib", "Shell32.lib"); nob_da_append(&procs, nob_cmd_run_async(cmd)); - + cmd.count = 0; nob_cmd_append(&cmd, "cl.exe"); - nob_cmd_append(&cmd, "/I", "./build/"); + nob_cmd_append(&cmd, "/I", "./"); nob_cmd_append(&cmd, "/I", "./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "/Fobuild\\", "/Febuild\\musializer.exe"); nob_cmd_append(&cmd, @@ -52,7 +52,7 @@ bool build_musializer(void) #else cmd.count = 0; nob_cmd_append(&cmd, "cl.exe"); - nob_cmd_append(&cmd, "/I", "./build/"); + nob_cmd_append(&cmd, "/I", "./"); nob_cmd_append(&cmd, "/I", "./raylib/raylib-"RAYLIB_VERSION"/src/"); nob_cmd_append(&cmd, "/Fobuild\\", "/Febuild\\musializer.exe"); nob_cmd_append(&cmd, @@ -141,7 +141,7 @@ bool build_raylib(void) if (!nob_cmd_run_sync(cmd)) nob_return_defer(false); } #endif // MUSIALIZER_HOTRELOAD - + defer: nob_cmd_free(cmd); nob_da_free(object_files); @@ -157,4 +157,4 @@ bool build_dist(void) nob_log(NOB_ERROR, "TODO: Creating distro for MSVC build is not implemented yet"); return false; #endif // MUSIALIZER_HOTRELOAD -} \ No newline at end of file +} diff --git a/src/targets.h b/src_build/targets.h similarity index 100% rename from src/targets.h rename to src_build/targets.h