Skip to content

Improve MIDL support#6301

Merged
waruqi merged 14 commits intoxmake-io:devfrom
lakor64:dev
Apr 22, 2025
Merged

Improve MIDL support#6301
waruqi merged 14 commits intoxmake-io:devfrom
lakor64:dev

Conversation

@lakor64
Copy link
Contributor

@lakor64 lakor64 commented Apr 8, 2025

Relative issue: #5926

Hello, this is my first time sending a PR so I hope I did everything correctly, the following PR extends the current existing MIDL support by adding the following functionalities:

  • Server and Client stub generation (/client and /server)
  • Proxy generation and compilation (_p)
  • Handling of warnings (/W0../W4)
  • Handling of target inclusions, definitions and undefinitions (/I, /D, /U)
  • Ability to define whenever to enable proxy, server or client generation as well as extra defs/undefs/incs

Some test projects are also added inside the folder tests/project/idl to verify the functionality.

Extra notes:

  • When I tried to build with "xmake" the file, it always runned the .idl compilation, which slows up a lot of compilation when you have multiple idl files, I tried to use the depend.on_changed there but I'm not sure if it's the correct way.
  • MIDL doesn't have a switch or message to 100% detect if an interface, proxy, client or server file will be generated, therefore I had to detect during build time if the C fiels were generated, and as there is no way that I know on xmake to detect if a file was generated on before_buildcmd_file because it invokes the binary multiple times (eg. a cleanup I wasn't able to do this corretly) so I moved the detect and compilation on the on_buildcmd_file, I hope this is ok
  • target:get("xxxxx") does not seem to get the public includes for some reason? or I misunderstood what the target: does?

@waruqi waruqi requested a review from star-hengxing April 8, 2025 14:37
@waruqi
Copy link
Member

waruqi commented Apr 9, 2025

please rebase to dev

@lakor64 lakor64 requested a review from waruqi April 15, 2025 09:43
@lakor64 lakor64 requested a review from waruqi April 22, 2025 08:59
@waruqi waruqi added this to the v3.0.0 milestone Apr 22, 2025
@waruqi waruqi merged commit aeaeda4 into xmake-io:dev Apr 22, 2025
22 checks passed
@star-hengxing
Copy link
Contributor

local enable_server = true
local enable_client = true

-- add_files("*.idl", {client = true, server = false, proxy = false})
-- server will always true, use `fileconfig.server ~= nil`?
if fileconfig.server then
    enable_server = fileconfig.server
end

local autogendir = path.join(target:autogendir(), "platform/windows/idl")

local enable_server = true
local enable_client = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here

local ccjob = target:fullname() .. "/obj/" .. sourcefile
jobgraph:add(ccjob, function (index, total, opt)
local fileconfig = target:fileconfig(sourcefile)
local enable_proxy = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@waruqi
Copy link
Member

waruqi commented Apr 24, 2025

local enable_server = true
local enable_client = true

-- add_files("*.idl", {client = true, server = false, proxy = false})
-- server will always true, use `fileconfig.server ~= nil`?
if fileconfig.server then
    enable_server = fileconfig.server
end

可以提个 pr 过来

@star-hengxing star-hengxing mentioned this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants