Skip to content

Commit

Permalink
need win32 example...
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Mar 7, 2024
1 parent b25bc2d commit d7d5bb1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/windows/build.hancho
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# hancho/examples/windows/build.hancho - Builds a trivial Win32 app.

compile = Rule(
desc = "Compile {files_in} -> {files_out}",
command = "cl.exe /nologo /c {files_in} /sourceDependencies {depfile} /Fo:{files_out} > NUL",
files_out = "{swap_ext(files_in, '.o')}",
depfile = "{swap_ext(files_out, '.d')}",
)

link = Rule(
desc = "Link {files_in} -> {files_out}",
command = "link.exe /nologo {files_in} /out:{files_out} > NUL",
)

def c_binary(files_in, files_out, **kwargs):
objs = [compile(file, **kwargs) for file in files_in]
return link(objs, files_out, **kwargs)


main_o = compile("src/main.cpp")
link([ain_o, , "app")
8 changes: 8 additions & 0 deletions examples/windows/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// src/main.cpp
#include "main.hpp"
#include <stdio.h>

int main(int argc, char** argv) {
printf("Hello World\n");
return 0;
}

0 comments on commit d7d5bb1

Please sign in to comment.