Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apriorit/findidl
CMake module for building IDL files with MIDL and generating CLR DLL using Tlbimp
https://github.com/apriorit/findidl
cmake cmake-module com-interop com-object idl tlb tlbimp
Last synced: about 5 hours ago
JSON representation
CMake module for building IDL files with MIDL and generating CLR DLL using Tlbimp
- Host: GitHub
- URL: https://github.com/apriorit/findidl
- Owner: apriorit
- License: bsd-3-clause
- Created: 2018-08-15T14:20:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-22T08:11:45.000Z (almost 3 years ago)
- Last Synced: 2024-05-03T05:13:57.512Z (7 months ago)
- Topics: cmake, cmake-module, com-interop, com-object, idl, tlb, tlbimp
- Language: CMake
- Homepage:
- Size: 29.3 KB
- Stars: 26
- Watchers: 7
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FindIDL [![Build status](https://ci.appveyor.com/api/projects/status/github/apriorit/FindIDL?svg=true)](https://ci.appveyor.com/project/apriorit/findidl)
CMake module for building IDL files with MIDL and generating CLR DLL using Tlbimp.* [Introduction](#introduction)
* [Requirements](#requirements)
* [Usage](#usage)
* [find_package()](#find_package)
* [add_idl()](#add_idl)
* [add_idl() with tlbimp](#add_idl-with-tlbimp)
* [MIDL flags](#midl-flags)
* [TLBIMP flags](#tlbimp-flags)
* [Samples](#samples)
* [License](#license)
* [Version History](#version-history)# Introduction
IDL is used for creating COM servers. Unfortunately CMake has a limited support for IDL, so this module comes to rescue. The Type Library Importer (Tlbimp) converts the type definitions found within a COM type library (TLB) into equivalent definitions in a common language runtime assembly. The output of Tlbimp.exe is a binary file (an assembly) that contains runtime metadata for the types defined within the original type library.## Requirements
- [CMake 3.0](https://cmake.org/download/) or higher
- MIDL compiler
- Tlbimp.exe (optional)# Usage
## find_package()
Add [FindIDL](https://github.com/apriorit/FindIDL) to the module search path and call `find_package`:
```cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
find_package(IDL REQUIRED)
```
[FindIDL](https://github.com/apriorit/FindIDL) will search for midl.exe and tlbimp.exe## add_idl()
Takes two arguments: the name of the target project and idl file.
```cmake
add_idl( source)
```
Where:
- `` - name of the target project
- `source` - full path to idl fileExample:
```cmake
add_idl(GreeterIDL Greeter.idl)
```The function does the same work as MIDL, specifically generates files:
- Greeter_i.h
- Greeter_i.c
- Greeter_p.c
- Greeter.tlbTo use the generated files the idl project should be linked as following
```cmake
target_link_libraries(Main GreeterIDL)
```## add_idl() with tlbimp
Takes four arguments: the name of the target project, idl file, TLBIMP flag and the name of the tlbimp target.
```cmake
add_idl( source TLBIMP )
```
Where:
- `` - name of the target project
- `source` - full path to idl file
- `TLBIMP` - flag to indicate to run tlbimp
- `` - name of the tlbimp targetExample:
```cmake
add_idl(GreeterIDLWithTLBIMP Greeter.idl TLBIMP GreeterInterop)
```The function does the same work as MIDL and tlbimp.exe, specifically generates files:
- Greeter_i.h
- Greeter_i.c
- Greeter_p.c
- Greeter.tlb
- GreeterInterop.dllTo use the generated files the idl project should be linked as following
```cmake
target_link_libraries(MainCpp GreeterIDL)
```
Or if you want to use the file generated by tlbimp:
```cmake
target_link_libraries(MainCsharp GreeterInterop)
```## MIDL flags
To specify additional command-line options for midl set `MIDL_FLAGS` variabe.
```cmake
set(MIDL_FLAGS /target NT60) # avoid MIDL2455 error
```## TLBIMP flags
To specify additional command-line options for tlbimp set `TLBIMP_FLAGS` variabe.
```cmake
set(TLBIMP_FLAGS /silence:3002) # importing a type library into a platform agnostic assembly
```# Samples
Take a look at the [samples](samples/) folder to see how to use [FindIDL](https://github.com/apriorit/FindIDL).# License
[Apriorit](http://www.apriorit.com/) released [FindIDL](https://github.com/apriorit/FindIDL) under the OSI-approved 3-clause BSD license. You can freely use it in your commercial or opensource software.# Version History
## Version 1.0.2 (15 Aug 2019)
- New: Add `TLBIMP_FLAGS`## Version 1.0.1 (08 Aug 2019)
- New: Add tlbimp## Version 1.0.0 (26 Oct 2018)
- Initial public release