-
Given the following #pragma once
#define MULTILINE(...) #__VA_ARGS__
#define UI_XML MULTILINE("${UI_XML}") I added it to my xmake.lua using target("ui.simple")
set_kind("binary")
set_default(true)
...
set_configdir("$(buildir)/$(plat)/$(arch)/$(mode)")
add_configfiles("c/config.in.h", {filename = "config.h"})
add_files("c/ui.simple.c")
on_load(function (target)
local xml = io.readfile("c/ui.simple.xml")
target:set("configvar", "UI_XML", xml)
end) It generates the following file ( #pragma once
#define MULTILINE(...) #__VA_ARGS__
#define UI_XML MULTILINE("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<!-- Generated with glade 3.40.0 -->\
<interface>\
<requires lib=\"gtk+\" version=\"3.24\"/>\
<!-- interface-css-provider-path marblemeterui.css -->\
<object class=\"GtkWindow\">\
<property name=\"name\">mainwindow</property>\
<property name=\"can-focus\">False</property>\
<property name=\"hexpand\">True</property>\
<property name=\"vexpand\">True</property>\
<property name=\"modal\">True</property>\
<property name=\"window-position\">center</property>\
...
</interface>\
") The code which uses the config is very simple (ui.simple.c): #include "config.h"
#include <stdio.h>
int main()
{
puts(UI_XML);
return 0;
} However, it won't compile. It complains about |
Beta Was this translation helpful? Give feedback.
Answered by
smac89
Nov 29, 2024
Replies: 1 comment
-
Looks like I was missing one important aspect which wasn't clear from the docs: Include the config directory target("ui.simple")
...
add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)") |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
smac89
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like I was missing one important aspect which wasn't clear from the docs: Include the config directory