mbasaglia / Qt-Color-Widgets

Color wheel widget and dialog for Qt
147 stars 54 forks source link

Windows support? #17

Open ghost opened 8 years ago

ghost commented 8 years ago

I was wondering if you could do something about Windows support.

I have installed Qt 5, Qt Static, MinGW and CMake on Windows 10. The following happens when I try to compile for Windows:

CMake had to be set to cmake .. -G "MinGW Makefiles" andset(CMAKE_PREFIX_PATH "C:\Qt\Qt5.5.1\5.5\mingw492_32"`. MinGW and CMake both have been added to PATH.

PS C:\Users\User\Qt-Color-Widgets\build> mingw32-make -j5 [ 1%] Generating ui_color_palette_widget.h [ 3%] Generating qrc_color_widgets.cpp [ 5%] Generating include/moc_color_palette_model.cpp [ 6%] Generating include/moc_color_palette_widget.cpp [ 8%] Generating include/moc_colorwidgets_global.cpp C:/Users/User/Qt-Color-Widgets/include/colorwidgets_global.hpp:0: Note: No relevant classes found. No output generated. [ 10%] Generating include/moc_color_wheel.cpp [ 11%] Generating include/moc_color_line_edit.cpp [ 13%] Generating include/moc_swatch.cpp [ 15%] Generating include/moc_color_delegate.cpp [ 16%] Generating include/moc_color_palette.cpp [ 18%] Generating include/moc_hue_slider.cpp [ 20%] Generating include/moc_abstract_widget_list.cpp [ 22%] Generating include/moc_bound_color_selector.cpp [ 23%] Generating include/moc_color_dialog.cpp [ 25%] Generating include/moc_color_2d_slider.cpp [ 27%] Generating include/moc_color_selector.cpp [ 28%] Generating include/moc_color_list_widget.cpp [ 30%] Generating include/moc_color_preview.cpp [ 32%] Generating include/moc_gradient_slider.cpp [ 33%] Generating include/moc_color_names.cpp C:/Users/User/Qt-Color-Widgets/include/color_names.hpp:0: Note: No relevant classes found. No output generated. [ 35%] Generating ui_color_dialog.h Scanning dependencies of target ColorWidgets-qt5 [ 37%] Building CXX object CMakeFiles/ColorWidgets-qt5.dir/src/color_list_widget.cpp.obj C:\Users\User\Qt-Color-Widgets\src\color_list_widget.cpp:35:1: warning: 'color_widgets::ColorListWidget::ColorListWidget(QWidget*)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] C:\Users\User\Qt-Color-Widgets\src\color_list_widget.cpp:43:1: warning: 'virtual color_widgets::ColorListWidget::~ColorListWidget()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] C:\Users\User\Qt-Color-Widgets\src\color_list_widget.cpp:48:15: warning: 'QList<QColor> color_widgets::ColorListWidget::colors() const' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] C:\Users\User\Qt-Color-Widgets\src\color_list_widget.cpp:53:6: warning: 'void color_widgets::ColorListWidget::setColors(const QList<QColor>&)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] C:\Users\User\Qt-Color-Widgets\src\color_list_widget.cpp:62:6: warning: 'virtual void color_widgets::ColorListWidget::swap(int, int)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] There is far more to this message, and it eventually builds, but then doesn't produce a .dll file. I would tell everyone to use Linux but not everyone will listen. :(

mbasaglia commented 8 years ago

To be honest I don't know what windows needs to expose symbols for dynamic linkage and I have no way of testing this, I'd guess CMake would need to generate the defines used in https://github.com/mbasaglia/Qt-Color-Widgets/blob/master/include/colorwidgets_global.hpp at the proper time.

maximeborges commented 7 years ago

Anyone got it to compile on WIndows ?

hyOzd commented 7 years ago

Yep, just today :D But... I have compiled it under MSYS2 using qt5 (5.6) static toolchain. I had to add this define to my build settings:

 QTCOLORWIDGETS_STATICALLY_LINKED

In the end it worked. I haven't tried building a dll.

maximeborges commented 7 years ago

Sorry for the comment I was really in a rush and I managed to compile my application under Windows. I just had to compile the lib, put the .dll in C:/Qt/5.8/mingw53_32/bin and the libColorWidgets-qt51.a in C:/Qt/5.8/mingw53_32/lib, and add LIBS += -llibColorWidgets-qt51 in the .pro of my app.

giladreich commented 7 years ago

@maximeborges , Could you please tell how did you compile the project ? The widgets doesn't show on my designer and i have the exact same version of mingw53 as yours. https://github.com/mbasaglia/Qt-Color-Widgets/issues/26

I tried with CMake and Qt Creator to compile and it fails to load the plugin.

maximeborges commented 7 years ago

I used CMake if I remember correctly, but I didn't remember more than that sorry

Innokentiy-Alaytsev commented 6 years ago

@maximeborges, hello! One year ago you asked if someone managed to compile this library under Windows. I answer you: yes, I did! Back in 2015 I have used qmake project that comes with the library, but now I have made some changes in https://github.com/mbasaglia/Qt-Color-Widgets/pull/37, so now it is possible to properly compile the library under Windows. However, there are a lot of changed in project structure.