Skip to content

Commit

Permalink
Merge pull request #113 from tsoding/src-build
Browse files Browse the repository at this point in the history
Factor out everything related to the buidl to src_build/ folder
  • Loading branch information
rexim authored Jun 9, 2024
2 parents 8e7b64e + 797baf4 commit 0724c99
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
14 changes: 7 additions & 7 deletions nob.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#include <errno.h>

#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"
Expand All @@ -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)
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/hotreload.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <stdbool.h>

#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;
Expand Down
6 changes: 3 additions & 3 deletions src/plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <string.h>
#include <complex.h>

#include "targets.h"
#include "config.h"
#include "src_build/targets.h"
#include "build/config.h"
#include "plug.h"
#include "ffmpeg.h"
#define NOB_IMPLEMENTATION
Expand All @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/nob_linux.c → src_build/nob_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/nob_macos.c → src_build/nob_macos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/nob_openbsd.c → src_build/nob_openbsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/nob_win64_mingw.c → src_build/nob_win64_mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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,
Expand All @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions src/nob_win64_msvc.c → src_build/nob_win64_msvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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
}
}
File renamed without changes.

0 comments on commit 0724c99

Please sign in to comment.