Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use a prefix for ar on windows hosts #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src_build/nob_win64_mingw.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#define MUSIALIZER_TARGET_NAME "win64-mingw"

// On windows, mingw doesn't have the `x86_64-w64-mingw32-` prefix for tools such as `windres` or `ar`.
// For gcc, you can use both `x86_64-w64-mingw32-gcc` and just `gcc`
#ifdef _WIN32
#define MAYBE_PREFIXED(x) x
#else
#define MAYBE_PREFIXED(x) "x86_64-w64-mingw32-"x
#endif // _WIN32

bool build_musializer(void)
{
bool result = true;
Nob_Cmd cmd = {0};
Nob_Procs procs = {0};

cmd.count = 0;
#ifdef _WIN32
// On windows, mingw doesn't have the `x86_64-w64-mingw32-` prefix for windres.
// For gcc, you can use both `x86_64-w64-mingw32-gcc` and just `gcc`
nob_cmd_append(&cmd, "windres");
#else
nob_cmd_append(&cmd, "x86_64-w64-mingw32-windres");
#endif // _WIN32
nob_cmd_append(&cmd, MAYBE_PREFIXED("windres"));
nob_cmd_append(&cmd, "./src/musializer.rc");
nob_cmd_append(&cmd, "-O", "coff");
nob_cmd_append(&cmd, "-o", "./build/musializer.res");
Expand Down Expand Up @@ -132,7 +134,8 @@ bool build_raylib()
const char *libraylib_path = nob_temp_sprintf("%s/libraylib.a", build_path);

if (nob_needs_rebuild(libraylib_path, object_files.items, object_files.count)) {
nob_cmd_append(&cmd, "x86_64-w64-mingw32-ar", "-crs", libraylib_path);
nob_cmd_append(&cmd, MAYBE_PREFIXED("ar"));
nob_cmd_append(&cmd, "-crs", libraylib_path);
for (size_t i = 0; i < NOB_ARRAY_LEN(raylib_modules); ++i) {
const char *input_path = nob_temp_sprintf("%s/%s.o", build_path, raylib_modules[i]);
nob_cmd_append(&cmd, input_path);
Expand Down
Loading