Git Product home page Git Product logo

findidl's Introduction

FindIDL Build status

CMake module for building IDL files with MIDL and generating CLR DLL using Tlbimp.

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 or higher
  • MIDL compiler
  • Tlbimp.exe (optional)

Usage

find_package()

Add FindIDL to the module search path and call find_package:

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
find_package(IDL REQUIRED)

FindIDL will search for midl.exe and tlbimp.exe

add_idl()

Takes two arguments: the name of the target project and idl file.

add_idl(<name> source)

Where:

  • <name> - name of the target project
  • source - full path to idl file

Example:

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.tlb

To use the generated files the idl project should be linked as following

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.

add_idl(<name> source TLBIMP <tlbimp name>)

Where:

  • <name> - name of the target project
  • source - full path to idl file
  • TLBIMP - flag to indicate to run tlbimp
  • <tlbimp name> - name of the tlbimp target

Example:

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.dll

To use the generated files the idl project should be linked as following

target_link_libraries(MainCpp GreeterIDL)

Or if you want to use the file generated by tlbimp:

target_link_libraries(MainCsharp GreeterInterop)

MIDL flags

To specify additional command-line options for midl set MIDL_FLAGS variabe.

set(MIDL_FLAGS /target NT60) # avoid MIDL2455 error

TLBIMP flags

To specify additional command-line options for tlbimp set TLBIMP_FLAGS variabe.

set(TLBIMP_FLAGS /silence:3002) # importing a type library into a platform agnostic assembly

Samples

Take a look at the samples folder to see how to use FindIDL.

License

Apriorit released 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

findidl's People

Contributors

sergiusthebest avatar talshadow avatar kolanich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.