Skip to content

Commit

Permalink
fixed: build.zig: define c macro
Browse files Browse the repository at this point in the history
  • Loading branch information
dinau committed Dec 27, 2024
1 parent 25d05f3 commit 747497d
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Devel Linux OS(Ubuntu) 0.14.0-dev compilation
name: Devel Linux OS(Ubuntu) 0.14.0-dev nightly compilation

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rel.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: zig-0.13.0 compilation
name: Windows OS zig-0.13.0 compilation

on:
push:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Devel 0.14.0-dev compilation
name: Windows OS Devel 0.14.0-dev nightly compilation

on:
push:
Expand All @@ -11,7 +11,6 @@ jobs:

runs-on: windows-latest


steps:
- uses: actions/checkout@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@

## ImGuinZ

![alt](https://github.com/dinau/imguinz/actions/workflows/devel.yml/badge.svg)
![alt](https://github.com/dinau/imguinz/actions/workflows/windows.yml/badge.svg)
![alt](https://github.com/dinau/imguinz/actions/workflows/linux.yml/badge.svg)
![alt](https://github.com/dinau/imguinz/actions/workflows/rel.yml/badge.svg)


Expand Down
20 changes: 10 additions & 10 deletions examples/glfw_opengl3/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -115,11 +115,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_GLFW", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_GLFW", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down
20 changes: 10 additions & 10 deletions examples/glfw_opengl3_image_load/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -112,11 +112,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_GLFW", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_GLFW", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down
20 changes: 10 additions & 10 deletions examples/glfw_opengl3_implot/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -122,11 +122,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_GLFW", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_GLFW", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down
20 changes: 10 additions & 10 deletions examples/glfw_opengl3_jp/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -112,11 +112,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_GLFW", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_GLFW", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down
20 changes: 10 additions & 10 deletions examples/iconFontViewer/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -112,11 +112,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_GLFW", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_GLFW", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down
20 changes: 10 additions & 10 deletions examples/imPlotDemo/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -122,11 +122,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_GLFW", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_GLFW", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down
1 change: 1 addition & 0 deletions examples/makefile.common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#OPT += --release=safe

all:
zig version
zig build $(OPT)
@-$(AFTER_BUILD_CMD)

Expand Down
20 changes: 10 additions & 10 deletions examples/sdl2_opengl3/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -119,11 +119,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_SDL2", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_SDL2", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down
20 changes: 10 additions & 10 deletions examples/sdl3_opengl3/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ pub fn build(b: *std.Build) void {
// Define macro for C/C++ sources
//--------------------------------
// ImGui
imlibs.defineCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.defineCMacro("ImDrawIdx", "unsigned int");
imlibs.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
imlibs.root_module.addCMacro("IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS", "");
imlibs.root_module.addCMacro("ImDrawIdx", "unsigned int");
imlibs.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
switch (builtin.target.os.tag){
.windows => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.defineCMacro("IMGUI_IMPL_API", "extern \"C\" "),
.windows => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" __declspec(dllexport)"),
.linux => imlibs.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\" "),
else => {},
}

Expand Down Expand Up @@ -107,11 +107,11 @@ pub fn build(b: *std.Build) void {
//--------------------------------
// Define macro for C/C++ sources
//--------------------------------
exe.defineCMacro("CIMGUI_USE_SDL3", "");
exe.defineCMacro("CIMGUI_USE_OPENGL3", "");
exe.defineCMacro("ImDrawIdx", "unsigned int");
exe.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.defineCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", null);
exe.root_module.addCMacro("CIMGUI_USE_SDL3", "");
exe.root_module.addCMacro("CIMGUI_USE_OPENGL3", "");
exe.root_module.addCMacro("ImDrawIdx", "unsigned int");
exe.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS","1");
exe.root_module.addCMacro("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
//---------------
// Sources C/C++
//---------------
Expand Down

0 comments on commit 747497d

Please sign in to comment.