Hello.
I'm trying to compile a simple application wxwidgets but I do not.
Someone tell me how to do this properly?

I have installed msys2, mingw64 and WxWidgets
("Mingw64 / mingw-W64-x86_64-3.0.2-16 wxWidgets [installed]...").

The source directory contains a file CMakeLists.txt and main.cpp

Being in the source directory seems command in console
$ Cmake -G 'Unix makefiles'

Result command:
- The CXX compiler identification is GNU 6.2.0
CMake Warning at /usr/share/cmake-3.6.2/Modules/Platform/MSYS.cmake:15
(message):
  CMake no longer Defines WIN32 on MSYS!

  (1) If you are just trying to build this project, ignore this warning or
  quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32 = 0 in your environment
or in
  the CMake cache. If later configuration or build errors Occur then this
  small project have been written under the assumption That MSYS is
WIN32. in
  That case, set CMAKE_LEGACY_CYGWIN_WIN32 = 1 instead.

  (2) If you are developing this project, add the line

    set (CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake> = 2.8.4 is
required

  at the top of your top-level CMakeLists.txt file or set the minimum
  required version of CMake is 2.8.4 or higher. Then teach your project to
  build on Cygwin without WIN32.
Call Stack (most recent call first):
  /usr/share/cmake-3.6.2/Modules/CMakeSystemSpecificInformation.cmake:37
(includ e)
  CMakeLists.txt 2 (project)


- Check for working compiler CXX: /d/msys64/mingw64/bin/c++.exe
- Check for working compiler CXX: /d/msys64/mingw64/bin/c++.exe - works
- Detecting CXX compiler ABI info
- Detecting CXX compiler ABI info - done
- Detecting CXX compile features
- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.6.2/Modules/FindwxWidgets.cmake:888
(message):
  wxWidgets wx / version.h file not found in
  D; /msys64/mingw64/lib/wx/include/msw-unicode-3.0; D;
/msys64/mingw64/include/wx-3.0.
Call Stack (most recent call first):
  CMakeLists.txt 44 (find_package)


- Configuring incomplete, errors occurred!
See also
"/d/Devel/Wx_sample-msys2/wx-cmake-sample2/CMakeFiles/CMakeOutput.log."

CMakeLists.txt contents of the file looks like this:

########################## CMakeLists.txt #############################
cmake_minimum_required(VERSION 2.6)
project(wx-cmake-sample2 CXX)
set(CMAKE_CXX_STANDARD 11)


set(SRC main.cpp)

if (MSYS)
    enable_language(RC)
    set(SRC ${SRC} resource.rc)
        INCLUDE(InstallRequiredSystemLibraries)
        get_filename_component( Mingw_Path ${CMAKE_CXX_COMPILER} PATH )

    set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
#        ${Mingw_Path}/libarchive-13.dll
#        ${Mingw_Path}/libbz2-1.dll
#        ${Mingw_Path}/libexpat-1.dll
#        ${Mingw_Path}/libiconv-2.dll
#        ${Mingw_Path}/libjpeg-8.dll
#        ${Mingw_Path}/liblzma-5.dll
#        ${Mingw_Path}/liblzo2-2.dll
#        ${Mingw_Path}/libnettle-6-2.dll
#        ${Mingw_Path}/libpng16-16.dll
#        ${Mingw_Path}/libtiff-5.dll
#        ${Mingw_Path}/libwinpthread-1.dll
#        ${Mingw_Path}/libzip-4.dll
        ${Mingw_Path}/wxbase30u_gcc_custom.dll
        ${Mingw_Path}/wxmsw30u_core_gcc_custom.dll
        )
#        ${Mingw_Path}/zlib1.dll)

        if(CMAKE_SIZEOF_VOID_P EQUAL 8) #win64
                set ( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
                        ${Mingw_Path}/libgcc_s_seh-1.dll 
${Mingw_Path}/libstdc++-6.dll)
        else() #win32
                set ( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
                        ${Mingw_Path}/libgcc_s_dw2-1.dll 
${Mingw_Path}/libstdc++-6.dll)
        endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
endif (MSYS)

add_executable(${PROJECT_NAME} ${SRC} )

set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base REQUIRED)

include(${wxWidgets_USE_FILE})

target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})

if (WINDOWS OR MSYS)
        install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION . )
endif (WINDOWS OR MSYS)

install( TARGETS ${PROJECT_NAME} RUNTIME DESTINATION . )
################### E.O.F.  CMakeLists.txt #############################

Contents of main.cpp file looks like this:

################### main.cpp #############################
// From http://docs.wxwidgets.org/trunk/overview_helloworld.html
// wxWidgets "Hello world" Program
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
    #include <wx/wx.h>
#endif
class MyApp: public wxApp
{
public:
    virtual bool OnInit();
};
class MyFrame: public wxFrame
{
public:
    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
private:
    void OnHello(wxCommandEvent& event);
    void OnExit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);
    wxDECLARE_EVENT_TABLE();
};
enum
{
    ID_Hello = 1
};
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(ID_Hello,   MyFrame::OnHello)
    EVT_MENU(wxID_EXIT,  MyFrame::OnExit)
    EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
wxEND_EVENT_TABLE()
wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( "Hello World", wxPoint(50, 50),
wxSize(450, 340) );
    frame->Show( true );
    return true;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const
wxSize& size)
        : wxFrame(NULL, wxID_ANY, title, pos, size)
{
    wxMenu *menuFile = new wxMenu;
    menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
                     "Help string shown in status bar for this menu item");
    menuFile->AppendSeparator();
    menuFile->Append(wxID_EXIT);
    wxMenu *menuHelp = new wxMenu;
    menuHelp->Append(wxID_ABOUT);
    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, "&File" );
    menuBar->Append( menuHelp, "&Help" );
    SetMenuBar( menuBar );
    CreateStatusBar();
    SetStatusText( "Welcome to wxWidgets!" );
}
void MyFrame::OnExit(wxCommandEvent& event)
{
    Close( true );
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
    wxMessageBox( "This is a wxWidgets' Hello world sample",
                  "About Hello World", wxOK | wxICON_INFORMATION );
}
void MyFrame::OnHello(wxCommandEvent& event)
{
    wxLogMessage("Hello world from wxWidgets!");
}
################### E.O.F. main.cpp #############################

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to