Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • CamiTK Community Edition CamiTK Community Edition
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • CamiTK
  • CamiTK Community EditionCamiTK Community Edition
  • Issues
  • #64
Closed
Open
Created Jun 18, 2018 by Emmanuel Promayon@promayoeOwner

Make management of decl export/import easier on Windows

As a CEP developer]
I would like to have a hassle free development time on windows
So that I can spend more time prototyping

About you

This is a merge between

  • a feature request submitted on the old bugzilla by Céline on 2016-01-18, and titled "The wizard should create a API.h file when an action depends on a local CEP component"
  • a story suggested on the old icescrum by myself on 2013-01-15, and titled "simplification of declspec export etc..."
  • a story suggested on the old icescrum by Céline on 2014-06-04, and titled "Inclure les decl_export dans le Wizard"

Product

cepgenerator and wizard

Overview

On windows you need to declare that you "export" the symbols when you are compiling a library and "import" the symbol when you are linking to the library. That means that you have to modify your code for these two phases. This is generally done by using a macro (defined as export and import when MSVC is used or as nothing for other compiler).

This feature requests ask for automatic management of this not obvious behaviour.

This can be done by:

  • use a specific macro that (with the combination of Q_DECL_EXPORT/Q_DECL_IMPORT or the basic __declspec(dllexport)/__declspec(dllimport)
  • automatically include all symbols thanks to CMake WINDOWS_EXPORT_ALL_SYMBOLS property
  • smoothly integrated this in the wizard/cepgenerator (see below)

cepgenerator/wizard integration

The wizard should create a API.h file when an action depends on a local CEP component

Create a new CEP with the wizard, containing a new Component (e.g. Albert's Component). Then create an action extension (e.g. Albert's Action) which depends on Albert's Component. The wizard adds a NEEDS_COMPONENT_EXTENSION albertscomponents in the action extension CMakeLists.txt, which is really great as the user do not have to look at the CMakeLists.txt anymore.

However, if the user is on Windows (which do not really know how to make real dynamic libraries), he/she will need a file name AlbertsComponentAPI.h in his/her Albert's Component extension, a DEFINES COMPILE_ALBERTSCOMPONENTS_API in Component's extension CMakeList and a class ALBERTSCOMPONENTAPI AlbertsComponent declaration in its .h file...

-- Céline

References

  • https://doc.qt.io/qt-5/qtglobal.html#Q_DECL_EXPORT
  • https://doc.qt.io/qt-5/sharedlibrary.html
  • https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/
  • old doc: https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/BuildingWinDLL
  • old doc: https://cmake.org/cmake/help/v2.8.10/cmake.html#module:GenerateExportHeader
Edited Jun 18, 2018 by Emmanuel Promayon
Assignee
Assign to
Time tracking