Re: [CMake] Create Mac OS Bundle with VTK and Qt

2017-09-08 Thread Oleksii Vilchanskyi via CMake
Hello,

> 1) I try to add an icon without success
> When I launch my app, the default icon is used and not my icon.

Can you elaborate on this? You say that the .icns file is under
Resources and the final Info.plist contains the proper key with the
proper value and that a non-default icon is used when the application is
launched. If you do actually see the icon on the application [for
example] in Launchpad, then the bundle is correctly built and macOS can
recognize the icon. If instead you see something like this[0], then the
bundle is built incorrectly.

However, you also say "when I launch my app", which, if you mean
application's runtime in particular, is unrelated to CMake or bundling.
If the tray icon is broken etc. it's something your application is not
doing (for example, we use RCC and /image for the icon).

So, if this is the former, then the bundling part is incorrect, if it's
the latter, the program's behaviour is incorrect.

As a side note, I don't rely on MACOSX_PACKAGE_LOCATION property and
install() the icon where it belongs.

> 2) For the libraries of VTK I tried to use macdeployqt (found using
find_program) but it doesn’t found the libraries (installed in a custom
directories)
> Is there a simple way to copy all found libraries/framework?

I would recommend using DeployQt5.cmake module[1] instead of
macdeployqt. Initially found on this list and later edited by Marcus D.
Hanwell, the module (I believe) is distributed under BSD 3-clause.

Usage example[2], also under BSD 3-clause (I believe).

[0]: 
[1]:

[2]:


Regards,
Oleksii Vilchanskyi

On 8.9.2017 18:11, Romain LEGUAY wrote:
> Hello everyone,
> 
> Since this morning, I try to create a Bundle Application using CMake (3.9.1).
> 
> My application use VTK (8.x) and Qt (5.x). The find_package of those two 
> libraries works greats (no problem to build and run the application).
> 
> I have many problems:
> 
> 1) I try to add an icon without success.
> 2) I don’t know how (and where) to copy VTK dynamic libraries.
> ( Optional / not really related ) 3) When I try to use only some components 
> of VTK, my application is linking to all VTK modules
> 
> I’m going to details each points:
> 
> 1) For the icon issue, I proceed this way:
> 
>  
> set(ICON_NAME "appIcon.icns") # I try without the icns extension without 
> success.
> set(ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/resources/icons/${ICON_NAME}")
> set_source_files_properties("${ICON_PATH}" PROPERTIES MACOSX_PACKAGE_LOCATION 
> Resources)
> 
> add_executable(MYAPP MACOSX_BUNDLE ${ICON_PATH} ${other_sources})
> 
> set_target_properties(CRAFPACK_GUI PROPERTIES
>   MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
> 
> 
> The icon is copied inside the Resources folder of my bundle and the 
> Info.plist is well updated (the CFBundleIconFile key is set to 
> "appIcon.icns").
> 
> When I launch my app, the default icon is used and not my icon.
> 
> 
> 2) For the libraries of VTK I tried to use macdeployqt (found using 
> find_program) but it doesn’t found the libraries (installed in a custom 
> directories)
> 
> I tried to use BundleUtilities without any success (except to tell me that 
> cmake doesn’t found the libraries).
> 
> I attach you my CMakeLists.
> 
> Is there a simple way to copy all found libraries/framework?
> 
> Thank you!
> 
> 
> 
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] POSITION_INDEPENDENT_CODE's [un]expected behaviour

2017-07-21 Thread Oleksii Vilchanskyi via CMake
Hello,

I would like to ask about POSITION_INDEPENDENT_CODE target property. As
of CMake 3.8.2 POSITION_INDEPENDENT_CODE appends -fPIE or -fPIC to
CMAKE__FLAGS and CMAKE_EXE_LINKER_FLAGS when building an
executable or a library respectively. However, to build a PIE -pie
linker flag is additionally required. Thus POSITION_INDEPENDENT_CODE is
not behaving as expected being a really easy to fix for someone aware
with CMake codebase.

Is there any reason why it wasn't added when the property was
introduced? Somebody proposed introducing
POSITION_INDEPENDENT_EXECUTABLE later on in addition to
POSITION_INDEPENDENT_CODE to maintain backwards compatibility (I suppose
policies are also a solution?).

This email is the result of the thread
 and the message

by Juan Navarro (big thanks to him), which fully summarizes CMake's
POSITION_INDEPENDENT_CODE treatment and links to multiple bugs: this one
, so far without attention, and
this one , resolved
for Android.

Thank you.

Regards,
Oleksii Vilchanskyi

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake