init
This commit is contained in:
commit
17a4224cb8
30
build.zig
Normal file
30
build.zig
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// This file is licensed under the CC0 1.0 license.
|
||||||
|
// See: https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
||||||
|
|
||||||
|
const std = @import("std");
|
||||||
|
const cmark_build = @import("./cmark.build.zig");
|
||||||
|
|
||||||
|
pub fn build(b: *std.Build) void {
|
||||||
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
const cmark = b.addModule("cmark", .{
|
||||||
|
.source_file = .{ .path = "src/cmark.zig" },
|
||||||
|
});
|
||||||
|
|
||||||
|
const cmark_c = cmark_build.cmark_lib(b, .{
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
|
||||||
|
_ = cmark;
|
||||||
|
|
||||||
|
const cmarktest = b.addExecutable(.{
|
||||||
|
.name = "cmtest",
|
||||||
|
.root_source_file = .{ .path = "src/cmark.zig" },
|
||||||
|
});
|
||||||
|
|
||||||
|
cmarktest.linkLibrary(cmark_c);
|
||||||
|
|
||||||
|
b.installArtifact(cmarktest);
|
||||||
|
}
|
98
cmark.build.zig
Normal file
98
cmark.build.zig
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
// This file is licensed under the CC0 1.0 license.
|
||||||
|
// See: https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
||||||
|
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
const CmarkBuildOptions = struct {
|
||||||
|
name: []const u8 = "cmark-c",
|
||||||
|
target: std.zig.CrossTarget,
|
||||||
|
optimize: std.builtin.OptimizeMode,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn cmark_lib(
|
||||||
|
b: *std.Build,
|
||||||
|
options: CmarkBuildOptions,
|
||||||
|
) *std.Build.Step.Compile {
|
||||||
|
const lib = b.addStaticLibrary(.{
|
||||||
|
.name = options.name,
|
||||||
|
.target = options.target,
|
||||||
|
.optimize = options.optimize,
|
||||||
|
});
|
||||||
|
|
||||||
|
const cflags = [_][]const u8{};
|
||||||
|
|
||||||
|
lib.linkLibC();
|
||||||
|
lib.addCSourceFiles(&common_sources, &cflags);
|
||||||
|
lib.addIncludePath(.{ .path = cmark_src_prefix ++ "include" });
|
||||||
|
|
||||||
|
const config_h = b.addConfigHeader(.{
|
||||||
|
.style = .{ .cmake = .{ .path = cmark_src_prefix ++ "config.h.in" } },
|
||||||
|
}, .{
|
||||||
|
.HAVE_STDBOOL_H = void{},
|
||||||
|
.HAVE___ATTRIBUTE__ = void{},
|
||||||
|
.HAVE___BUILTIN_EXPECT = void{},
|
||||||
|
});
|
||||||
|
|
||||||
|
const cmark_version_h = b.addConfigHeader(.{
|
||||||
|
.style = .{ .cmake = .{ .path = cmark_src_prefix ++ "cmark_version.h.in" } },
|
||||||
|
}, .{
|
||||||
|
.PROJECT_VERSION_MAJOR = 0,
|
||||||
|
.PROJECT_VERSION_MINOR = 30,
|
||||||
|
.PROJECT_VERSION_PATCH = 3,
|
||||||
|
});
|
||||||
|
|
||||||
|
lib.addConfigHeader(config_h);
|
||||||
|
lib.addConfigHeader(cmark_version_h);
|
||||||
|
lib.addIncludePath(.{ .path = cmark_zig_prefix });
|
||||||
|
lib.installConfigHeader(cmark_version_h, .{ .dest_rel_path = "cmark_version.h" });
|
||||||
|
|
||||||
|
inline for (install_headers) |header| {
|
||||||
|
lib.installHeader(header.base_dir ++ header.name, header.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
b.installArtifact(lib);
|
||||||
|
|
||||||
|
return lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build(b: *std.Build) void {
|
||||||
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
_ = cmark_lib(b, .{ .target = target, .optimize = optimize });
|
||||||
|
}
|
||||||
|
|
||||||
|
const cmark_src_prefix = "deps/cmark/src/";
|
||||||
|
const cmark_zig_prefix = "src/";
|
||||||
|
|
||||||
|
const Header = struct {
|
||||||
|
base_dir: [:0]const u8,
|
||||||
|
name: [:0]const u8,
|
||||||
|
};
|
||||||
|
|
||||||
|
const install_headers = [_]Header{
|
||||||
|
.{ .base_dir = cmark_src_prefix, .name = "cmark.h" },
|
||||||
|
.{ .base_dir = cmark_zig_prefix, .name = "cmark_export.h" },
|
||||||
|
};
|
||||||
|
|
||||||
|
const common_sources = [_][]const u8{
|
||||||
|
cmark_src_prefix ++ "cmark.c",
|
||||||
|
cmark_src_prefix ++ "node.c",
|
||||||
|
cmark_src_prefix ++ "iterator.c",
|
||||||
|
cmark_src_prefix ++ "blocks.c",
|
||||||
|
cmark_src_prefix ++ "inlines.c",
|
||||||
|
cmark_src_prefix ++ "scanners.c",
|
||||||
|
cmark_src_prefix ++ "utf8.c",
|
||||||
|
cmark_src_prefix ++ "buffer.c",
|
||||||
|
cmark_src_prefix ++ "references.c",
|
||||||
|
cmark_src_prefix ++ "render.c",
|
||||||
|
cmark_src_prefix ++ "man.c",
|
||||||
|
cmark_src_prefix ++ "xml.c",
|
||||||
|
cmark_src_prefix ++ "html.c",
|
||||||
|
cmark_src_prefix ++ "commonmark.c",
|
||||||
|
cmark_src_prefix ++ "latex.c",
|
||||||
|
cmark_src_prefix ++ "houdini_href_e.c",
|
||||||
|
cmark_src_prefix ++ "houdini_html_e.c",
|
||||||
|
cmark_src_prefix ++ "houdini_html_u.c",
|
||||||
|
cmark_src_prefix ++ "cmark_ctype.c",
|
||||||
|
};
|
0
readme.adoc
Normal file
0
readme.adoc
Normal file
0
src/cmark.zig
Normal file
0
src/cmark.zig
Normal file
33
src/cmark_export.h
Normal file
33
src/cmark_export.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef CMARK_EXPORT_H
|
||||||
|
#define CMARK_EXPORT_H
|
||||||
|
|
||||||
|
#ifdef CMARK_STATIC_DEFINE
|
||||||
|
# define CMARK_EXPORT
|
||||||
|
# define CMARK_NO_EXPORT
|
||||||
|
#else
|
||||||
|
# ifndef CMARK_EXPORT
|
||||||
|
# ifdef cmark_EXPORTS
|
||||||
|
# define CMARK_EXPORT __attribute__((visibility("default")))
|
||||||
|
# else
|
||||||
|
# define CMARK_EXPORT __attribute__((visibility("default")))
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef CMARK_NO_EXPORT
|
||||||
|
# define CMARK_NO_EXPORT __attribute__((visibility("hidden")))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CMARK_DEPRECATED
|
||||||
|
# define CMARK_DEPRECATED __attribute__ ((__deprecated__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CMARK_DEPRECATED_EXPORT
|
||||||
|
# define CMARK_DEPRECATED_EXPORT CMARK_EXPORT CMARK_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CMARK_DEPRECATED_NO_EXPORT
|
||||||
|
# define CMARK_DEPRECATED_NO_EXPORT CMARK_NO_EXPORT CMARK_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CMARK_EXPORT_H */
|
Loading…
x
Reference in New Issue
Block a user