Skip to content

Commit

Permalink
add basic header file setup
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
slimsag committed Oct 6, 2023
1 parent 6dd8823 commit 4eb81f6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
lib.installHeadersDirectory("include/mach", "mach");
b.installArtifact(lib);

const main_tests = b.addTest(.{
Expand Down
51 changes: 51 additions & 0 deletions include/mach/core.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef MACH_CORE_H_
#define MACH_CORE_H_

#if defined(MACH_SHARED_LIBRARY)
# if defined(_WIN32)
# if defined(MACH_IMPLEMENTATION)
# define MACH_EXPORT __declspec(dllexport)
# else
# define MACH_EXPORT __declspec(dllimport)
# endif
# else // defined(_WIN32)
# if defined(MACH_IMPLEMENTATION)
# define MACH_EXPORT __attribute__((visibility("default")))
# else
# define MACH_EXPORT
# endif
# endif // defined(_WIN32)
#else // defined(MACH_SHARED_LIBRARY)
# define MACH_EXPORT
#endif // defined(MACH_SHARED_LIBRARY)

#if !defined(MACH_OBJECT_ATTRIBUTE)
#define MACH_OBJECT_ATTRIBUTE
#endif
#if !defined(MACH_ENUM_ATTRIBUTE)
#define MACH_ENUM_ATTRIBUTE
#endif
#if !defined(MACH_STRUCTURE_ATTRIBUTE)
#define MACH_STRUCTURE_ATTRIBUTE
#endif
#if !defined(MACH_FUNCTION_ATTRIBUTE)
#define MACH_FUNCTION_ATTRIBUTE
#endif
#if !defined(MACH_NULLABLE)
#define MACH_NULLABLE
#endif

#include <stdint.h>
#include <stddef.h>

// TODO: implement this section
// see e.g. https://github.com/webgpu-native/webgpu-headers/blob/main/webgpu.h
// for how to write a modern C API header

#endif // !defined(MACH_SKIP_DECLARATIONS)

#ifdef __cplusplus
} // extern "C"
#endif

#endif // MACH_CORE_H_

0 comments on commit 4eb81f6

Please sign in to comment.