Changes
7 changed files (+166/-3)
-
-
@@ -1,11 +1,11 @@# Copyright 2025 Shota FUJI # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # # http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-
@@ -25,3 +25,8 @@[*.md] # Two trailing spaces represents a line break. trim_trailing_whitespace = false [*.{zig,zon}] # Zig insists on 4 spaces, ignoring accessibility problems. indent_style = space indent_size = 4
-
-
.gitignore (new)
-
@@ -0,0 +1,32 @@# Copyright 2025 Shota FUJI # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 # # === # # This file contains rules for project-wide ignores. # Do not put rules for a file specific to your environment. (e.g. OS garbage) # Also, if ignore rules only specific to a package subdirectory should be in the # subdirectory's ".gitignore" file. # # Each rule or a group of closely related rules should have a comment describe "What is this" # and preferably "Why this is ignored" if the reason is not so obvious. # What: Zig's build cache directory. .zig-cache # What: Build artifacts. (executables, copied headers, etc.) zig-out
-
-
-
@@ -21,3 +21,4 @@ # Softwares such as [asdf](https://asdf-vm.com/) and [mise-en-place](https://mise.jdx.dev/) let# you install and manage those toolings easily. dprint 0.49.1 zig 0.14.0
-
-
core/build.zig (new)
-
@@ -0,0 +1,51 @@// Copyright 2025 Shota FUJI // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 //! This file defines how `zig build` command behaves. //! Run `zig build --help` for available subcommands and options. //! //! Learn more at //! https://ziglang.org/learn/build-system/ const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); // Static library (C API) { const linkage = b.option( std.builtin.LinkMode, "linkage", "Link mode of the generated library file", ) orelse .static; const lib = b.addLibrary(.{ .name = "plac_core", .linkage = linkage, .root_module = b.createModule(.{ .root_source_file = b.path("src/lib.zig"), .target = target, .optimize = optimize, }), }); lib.installHeader(b.path("src/lib.h"), "plac_core.h"); b.installArtifact(lib); } }
-
-
core/src/lib.h (new)
-
@@ -0,0 +1,38 @@/* * Copyright 2025 Shota FUJI * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 * * === * * C89 header file for Plac core's C API. * This file is not checked against a generated library file: carefully write and review * definitions and implementations. */ #ifndef PLAC_CORE_H #define PLAC_CORE_H #ifdef __cplusplus extern "C" { #endif int adder(int a, int b); #ifdef __cplusplus } #endif #endif
-
-
core/src/lib.zig (new)
-
@@ -0,0 +1,22 @@// Copyright 2025 Shota FUJI // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 //! This is an entrypoint of the static library. // TODO: Remove after implementing actual exports. export fn adder(a: c_int, b: c_int) c_int { return a + b; }
-
-
-
@@ -26,8 +26,22 @@ "newLineKind": "lf","useTabs": true, "json": {}, "markdown": {}, "exec": { "cwd": "${configDir}", "commands": [ { "exts": ["zig"], "command": "zig fmt --stdin", }, { "exts": ["zon"], "command": "zig fmt --zon --stdin", }, ], }, "plugins": [ "https://plugins.dprint.dev/json-0.20.0.wasm", "https://plugins.dprint.dev/markdown-0.18.0.wasm", "https://plugins.dprint.dev/exec-0.5.1.json@492414e39dea4dccc07b4af796d2f4efdb89e84bae2bd4e1e924c0cc050855bf", ], }
-