Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用xmake编译com组件问题 #5675

Open
fengjinfuyl opened this issue Sep 29, 2024 · 10 comments
Open

使用xmake编译com组件问题 #5675

fengjinfuyl opened this issue Sep 29, 2024 · 10 comments
Labels

Comments

@fengjinfuyl
Copy link

Xmake 版本

2.9.5

操作系统版本和架构

版本 Windows 10 专业版 版本号 22H2 安装日期 ‎2024/‎3/‎28 操作系统内部版本 19045.4894 体验 Windows Feature Experience Pack 1000.19060.1000.0

描述问题

com组件中常常会有idl(interface define language接口定义语言)文件,
我尝试使用addfiles("xxx/xxx.idl")这样的形式将其加入到编译中,xmake出现类似提示error: unknown source file: Resource\ex.idl。
我在官网搜索idl未找到帮助,我想请问下,xmake是否支持将idl视为源文件,加入到编译中。
可供参考的是,
cmake中
file(GLOB IDL_FILE Resource/*.idl)
add_library(${ProjectName} SHARED ${SRC_FILES} ${DEF_FILE} ${IDL_FILE} ${HEADER_FILES} Resource/ex.rc )

可以直接这样就达成。

期待的结果

可以将idl文件识别为源文件并编译

工程配置

无需

附加信息和错误日志

无需

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: Use xmake to compile com component problems

Xmake version

2.9.5

Operating system version and architecture

Version Windows 10 Pro Build Number 22H2 Installation Date ‎2024/‎3/‎28 OS Build 19045.4894 Experience Windows Feature Experience Pack 1000.19060.1000.0

Describe the problem

There are often idl (interface define language interface definition language) files in com components.
I tried to add it to the compilation using the form addfiles("xxx/xxx.idl"), but xmake showed a similar prompt: error: unknown source file: Resource\ex.idl.
I searched for idl on the official website and found no help. I would like to ask if xmake supports treating idl as a source file and adding it to the compilation.
For reference,
cmake
file(GLOB IDL_FILE Resource/*.idl)
add_library(${ProjectName} SHARED ${SRC_FILES} ${DEF_FILE} ${IDL_FILE} ${HEADER_FILES} Resource/ex.rc )

It can be achieved directly like this.

Expected results

idl files can be recognized as source files and compiled

Project configuration

No need

Additional information and error logs

No need to

@star-hengxing
Copy link
Contributor

需要看一下 cmake 编译 idl 的命令(msbuild/ninja)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


You need to look at the cmake command to compile idl (msbuild/ninja)

@fengjinfuyl
Copy link
Author

需要看一下 cmake 编译 idl 的命令(msbuild/ninja)

具体的编译命令,是midl,在msvc环境下,midl xxx.idl这样。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


You need to look at the cmake command to compile idl (msbuild/ninja)

The specific compilation command is midl. In the msvc environment, midl xxx.idl is like this.

@fengjinfuyl
Copy link
Author

需要看一下 cmake 编译 idl 的命令(msbuild/ninja)

具体的编译命令,是midl,在msvc环境下,midl xxx.idl这样。

如:
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\midl.exe" /IE:\Repo\example_addin\SDK\Lib /W1 /nologo /char signed /env x64 /out"E:\Repo\example_addin\vsbuiild/example_addin.dir\Debug\" /h "ex.h" /iid "ex_i.c" /proxy "ex_p.c" /tlb "ex.tlb" /target "NT60" E:\Repo\example_addin\Resource\ex.idl
原始idl如下:
import "oaidl.idl";
import "ocidl.idl";
// {A3731153-61AE-45C0-B5F7-580A5D737793}
[
uuid(A3731153-61AE-45C0-B5F7-580A5D737793),
version(1.0),
helpstring("exampleaddin 1.0 Type Library")
]

library Example_AddIn_Lib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
// import Nex3D types
importlib("tgframewrk.tlb");

[uuid(70C74CBD-E067-4BA0-AAE8-15938745860E) ]
coclass CmdManager
{
	[default] interface IUnknown;
}

[uuid(014BD906-E8DB-4BC5-86F3-C2D7ADD4BFCB)]
coclass AddInEvents
{
	[default] interface ISEAddInEvents;
}

[hidden, uuid(97CF6B86-97E1-4946-92EF-C93D28BEED80)]
coclass CommandEvents
{
	[default] interface ISECommandEvents;
}

[hidden,uuid(AE0BDFFA-D79F-4B54-B4C3-FFF5D2D810CF)]
coclass LocateEvents
{
	[default] interface ISELocateFilterEvents;
};

// {DD17DAEA-B754-4565-AD2E-F2FB445B3A1C}
[hidden, uuid(DD17DAEA-B754-4565-AD2E-F2FB445B3A1C)]
coclass MouseEvent
{
	[default] interface ISEMouseEvents;
}

//{72474165-AD4E-4C21-B7CF-3B8B630EDA41}
[hidden, uuid(72474165-AD4E-4C21-B7CF-3B8B630EDA41)]
	coclass XGLDisplayEvents
{
	[default] interface ISEIGLDisplayEvents;
}

};
因为其中tgframewrk.tlb在E:\Repo\example_addin\SDK\Lib文件夹中,所以/IE:\Repo\example_addin\SDK\Lib是有效的

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


You need to look at the cmake command to compile idl (msbuild/ninja)

The specific compilation command is midl. In the msvc environment, midl xxx.idl is like this.

like:
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\midl.exe" /IE:\Repo\example_addin\SDK\Lib /W1 /nologo /char signed /env x64 /out "E:\Repo\example_addin\vsbuiild/example_addin.dir\Debug\" /h "ex.h" /iid "ex_i.c" /proxy "ex_p.c" /tlb "ex.tlb" /target " NT60" E:\Repo\example_addin\Resource\ex.idl
The original idl is as follows:
import "oaidl.idl";
import "ocidl.idl";
// {A3731153-61AE-45C0-B5F7-580A5D737793}
[
uuid(A3731153-61AE-45C0-B5F7-580A5D737793),
version(1.0),
helpstring("exampleaddin 1.0 Type Library")
]

library Example_AddIn_Lib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
// import Nex3D types
importlib("tgframewrk.tlb");

[uuid(70C74CBD-E067-4BA0-AAE8-15938745860E) ]
coclass CmdManager
{
[default] interface IUnknown;
}

[uuid(014BD906-E8DB-4BC5-86F3-C2D7ADD4BFCB)]
coclass AddInEvents
{
[default] interface ISEAddInEvents;
}

[hidden, uuid(97CF6B86-97E1-4946-92EF-C93D28BEED80)]
coclass CommandEvents
{
[default] interface ISECommandEvents;
}

[hidden,uuid(AE0BDFFA-D79F-4B54-B4C3-FFF5D2D810CF)]
coclassLocateEvents
{
[default] interface ISELocateFilterEvents;
};

// {DD17DAEA-B754-4565-AD2E-F2FB445B3A1C}
[hidden, uuid(DD17DAEA-B754-4565-AD2E-F2FB445B3A1C)]
coclassMouseEvent
{
[default] interface ISEMouseEvents;
}

//{72474165-AD4E-4C21-B7CF-3B8B630EDA41}
[hidden, uuid(72474165-AD4E-4C21-B7CF-3B8B630EDA41)]
coclass XGLDisplayEvents
{
[default] interface ISEIGLDisplayEvents;
}

};
Because tgframewrk.tlb is in the E:\Repo\example_addin\SDK\Lib folder, /IE:\Repo\example_addin\SDK\Lib is valid

@waruqi
Copy link
Member

waruqi commented Sep 30, 2024

目前还不支持,可以提个 pr 过来

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


It is not supported yet, you can submit a PR.

@fengjinfuyl
Copy link
Author

fengjinfuyl commented Sep 30, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants