From e65781aa65d4beb0b90f5aa71d0c924a0c51447a Mon Sep 17 00:00:00 2001 From: lsv Date: Tue, 23 Sep 2025 16:17:07 +0500 Subject: [PATCH] Support compile mingw32 --- CMakeLists.txt | 131 +++++++++++++++++--------- INSTALL_EN.txt | 6 ++ agent/dlgJob.cpp | 20 ++-- ctl/ctlComboBox.cpp | 4 +- ctl/ctlSQLBox.cpp | 2 +- dlg/dlgTable.cpp | 8 +- include/ctl/wxTopActivity.h | 16 +++- include/frm/frmLog.h | 3 +- include/frm/frmMain.h | 2 +- include/pgAdmin3.h | 8 +- include/precomp.h | 2 +- include/pro_scheduler/pgproJob.h | 2 +- include/utils/misc.h | 2 + mingw-windows-x64.cmake | 26 +++++ ogl/mfutils.cpp | 8 +- pgAdmin3.cpp | 8 +- pgscript/lex.pgs.cc | 40 ++++---- pgscript/utilities/m_apm/mapmutl2.cpp | 2 +- slony/dlgRepCluster.cpp | 6 +- slony/dlgRepListen.cpp | 8 +- slony/dlgRepPath.cpp | 4 +- slony/dlgRepSequence.cpp | 2 +- slony/dlgRepSet.cpp | 4 +- slony/dlgRepSubscription.cpp | 6 +- slony/dlgRepTable.cpp | 4 +- utils/FormatterSQL.cpp | 2 +- utils/WaitSample.cpp | 1 + utils/json/jsonreader.cpp | 6 +- utils/json/jsonwriter.cpp | 1 + utils/log/MyDataViewCtrl.cpp | 2 +- utils/misc.cpp | 12 +++ utils/sshTunnel.cpp | 5 +- 32 files changed, 225 insertions(+), 128 deletions(-) create mode 100644 mingw-windows-x64.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f84fd13..ad0a3f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,24 +1,71 @@ -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.23.0) #set(CMAKE_CXX_SYSROOT_FLAG_CODE "list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc)") project(pgAdmin3 VERSION 1.26.0) -include_directories(. include include/libssh2 -) -if(UNIX) - add_compile_definitions(NO_WXJSON_GIT) +include_directories(. include) +set(PRECOMP_FILE precomp.h) +if(NOT CROSS_COMPILE) + include_directories(include/libssh2) + find_package(CURL) + if(NOT CURL_FOUND) + add_compile_definitions(NO_WXJSON_GIT) + else() + include_directories(${CURL_INCLUDE_DIR}) + link_libraries(${CURL_LIBRARIES}) + endif() + find_package(LibXslt REQUIRED) + if(NOT LIBXSLT_FOUND) + message(SEND_ERROR "Failed to find LibXslt") + return() + else() + include_directories(${LIBXSLT_INCLUDE_DIR}) + link_libraries(${LIBXSLT_LIBRARIES}) + message(STATUS "path libxslt = ${LIBXSLT_LIBRARIES}") + endif() + find_package(LibXml2 REQUIRED) + if(NOT LIBXML2_FOUND) + message(SEND_ERROR "Failed to find LibXml2") + return() + else() + include_directories(${LIBXML2_INCLUDE_DIR}) + link_libraries(${LIBXML2_LIBRARIES}) + message(STATUS "path libxml = ${LIBXML2_LIBRARIES}") + endif() + find_package(wxWidgets 3.2 REQUIRED stc aui base net core xrc html xml) + if(NOT wxWidgets_FOUND) + message(SEND_ERROR "Failed to find wxWidgets ") + return() + else() + include(${wxWidgets_USE_FILE}) + include_directories(${wxWidgets_INCLUDE_DIRS}) + link_libraries(${wxWidgets_LIBRARIES}) + message(STATUS "path wxwidgets = ${wxWidgets_LIBRARIES} inclure = ${wxWidgets_INCLUDE_DIRS}") + endif() + + find_package(PostgreSQL REQUIRED) + if(NOT PostgreSQL_FOUND) + message(SEND_ERROR "Failed to find PostgreSql") + return() + else() + include_directories(${PostgreSQL_INCLUDE_DIRS}) + include_directories(${PostgreSQL_INCLUDE_DIRS}/server) + link_libraries(${PostgreSQL_LIBRARIES}) + message(STATUS "path postgresql= ${PostgreSQL_LIBRARIES}") + endif() + add_compile_definitions(WX_PRECOMP) +else() +#windows + endif() -add_compile_definitions(WX_PRECOMP) + + add_compile_definitions(wxUSE_UNICODE) add_compile_definitions(EMBED_XRC) -add_compile_options(-Wno-narrowing -) - -#set(CMAKE_CXX_EXTENSIONS OFF) +add_compile_options(-Wno-narrowing) list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS c) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) - file(GLOB_RECURSE SOURCES agent/*.c* ctl/*.c* @@ -30,46 +77,38 @@ file(GLOB_RECURSE SOURCES ) ########################################################## -find_package(LibXslt REQUIRED) -if(NOT LIBXSLT_FOUND) - message(SEND_ERROR "Failed to find LibXslt") - return() -else() - include_directories(${LIBXSLT_INCLUDE_DIR}) - link_libraries(${LIBXSLT_LIBRARIES}) -endif() -find_package(LibXml2 REQUIRED) -if(NOT LIBXML2_FOUND) - message(SEND_ERROR "Failed to find LibXml2") - return() -else() - include_directories(${LIBXML2_INCLUDE_DIR}) - link_libraries(${LIBXML2_LIBRARIES}) -endif() -find_package(wxWidgets 3.2 REQUIRED stc aui base net core xrc html xml) -if(NOT wxWidgets_FOUND) - message(SEND_ERROR "Failed to find wxWidgets ") - return() -else() - include(${wxWidgets_USE_FILE}) - include_directories(${wxWidgets_INCLUDE_DIRS}) - link_libraries(${wxWidgets_LIBRARIES}) + +add_executable(${PROJECT_NAME} ) +target_sources(${PROJECT_NAME} PUBLIC pgAdmin3.cpp ${SOURCES}) +if(CROSS_COMPILE STREQUAL "Windows") + ENABLE_LANGUAGE(RC) + set(CMAKE_RC_COMPILER_INIT windres) + set(RC_FILE pgAdmin3.rc) + SET(CMAKE_RC_COMPILE_OBJECT + " -v -O coff -I ${WXWIN}/include -i -o ") + target_sources(${PROJECT_NAME} PRIVATE ${RC_FILE}) + message(STATUS "Use RC file ${RC_FILE}") endif() -find_package(PostgreSQL REQUIRED) -if(NOT PostgreSQL_FOUND) - message(SEND_ERROR "Failed to find PostgreSql") - return() -else() - include_directories(${PostgreSQL_INCLUDE_DIRS}) - include_directories(${PostgreSQL_INCLUDE_DIRS}/server) - link_libraries(${PostgreSQL_LIBRARIES}) +if (PRECOMP_FILE) + target_precompile_headers(${PROJECT_NAME} PUBLIC include/${PRECOMP_FILE}) + message(STATUS "Precompile header include/${PRECOMP_FILE}") +endif() +if(CROSS_COMPILE STREQUAL "Windows") + #add_compile_definitions(_CRT_SECURE_NO_DEPRECATE=1 NDEBUG WIN32 _WINDOWS __WINDOWS__ __WIN95__ __WIN32__ WINVER=0x0500 STRICT __WXMSW__ WXUSINGDLL wxUSE_UNICODE=1 PG_SSL) + add_compile_definitions(NDEBUG WIN32 WXPRECOMP WINVER=0x0600 STRICT wxUSE_UNICODE=1 PG_SSL) + set(WXWIN /home/sergey/k/wxMSW-3.2.2 ) + set(PGDIR /home/sergey/k/pg10 ) + set(PGBUILD /home/sergey/k ) + #set(/home/sergey/k/openssl ) + #set(PROJECTDIR /home/sergey/k/openssl ) + include_directories(${WXWIN}/include ${PGDIR}/include ${PGDIR}/include/server ) + include_directories(${PGBUILD}/libxml2/include ${PGBUILD}/libxslt/include ${PGBUILD}/iconv/include ) +# include_directories(${PGBUILD}/openssl/include +# include_directories( ./include/libssh2 ./include/libssh2/Win32 ) endif() -add_executable(pgAdmin3 pgAdmin3.cpp ${SOURCES}) -target_precompile_headers(pgAdmin3 PUBLIC include/precomp.h) - set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) diff --git a/INSTALL_EN.txt b/INSTALL_EN.txt index e2aca96..51a8cf6 100644 --- a/INSTALL_EN.txt +++ b/INSTALL_EN.txt @@ -29,6 +29,12 @@ It can be taken from the Postgresql 15 sources and put in include/parser/ There may be problems compiling the JSON parser. It can be eliminated (as well as the experimental part with Git) by defining NO_WXJSON_GIT as done above through CXXFLAGS. +Compile minGW +------- +rm -fR CMakeFiles CMakeCache.txt Makefile cmake_install.cmake +cmake -DCMAKE_TOOLCHAIN_FILE=../mingw-windows-x64.cmake .. +cmake --build . --config Release --target all -j 3 -- + OS for assembly used "Alt Workstation" 10 https://www.basealt.ru/alt-workstation/download#c1211 diff --git a/agent/dlgJob.cpp b/agent/dlgJob.cpp index bf2a697..7b58f62 100644 --- a/agent/dlgJob.cpp +++ b/agent/dlgJob.cpp @@ -178,8 +178,8 @@ int dlgJob::Go(bool modal) { pgaStep *step = (pgaStep *)data; int pos = lstSteps->AppendItem(stepFactory.GetIconId(), step->GetName(), step->GetComment()); - lstSteps->SetItem(pos, 3, NumToStr((long)step)); - previousSteps.Add(NumToStr((long)step)); + lstSteps->SetItem(pos, 3, NumToStr((long long)step)); + previousSteps.Add(NumToStr((long long)step)); } item = mainForm->GetBrowser()->GetNextChild(stepsItem, cookie); } @@ -201,8 +201,8 @@ int dlgJob::Go(bool modal) { pgaSchedule *schedule = (pgaSchedule *)data; int pos = lstSchedules->AppendItem(scheduleFactory.GetIconId(), schedule->GetName(), schedule->GetComment()); - lstSchedules->SetItem(pos, 3, NumToStr((long)schedule)); - previousSchedules.Add(NumToStr((long)schedule)); + lstSchedules->SetItem(pos, 3, NumToStr((long long)schedule)); + previousSchedules.Add(NumToStr((long long)schedule)); } item = mainForm->GetBrowser()->GetNextChild(schedulesItem, cookie); } @@ -278,12 +278,12 @@ void dlgJob::OnChangeStep(wxCommandEvent &ev) if (lstSteps->GetText(pos, 3).IsEmpty()) { wxString *stepSql = new wxString(step.GetInsertSql()); - lstSteps->SetItemData(pos, (long)stepSql); + lstSteps->SetItemData(pos, (long long)stepSql); } else { wxString *stepSql = new wxString(step.GetUpdateSql()); - lstSteps->SetItemData(pos, (long)stepSql); + lstSteps->SetItemData(pos, (long long)stepSql); } CheckChange(); @@ -307,7 +307,7 @@ void dlgJob::OnAddStep(wxCommandEvent &ev) { int pos = lstSteps->AppendItem(stepFactory.GetIconId(), step.GetName(), step.GetComment()); wxString *stepSql = new wxString(step.GetInsertSql()); - lstSteps->SetItemData(pos, (long)stepSql); + lstSteps->SetItemData(pos, (long long)stepSql); CheckChange(); } } @@ -349,12 +349,12 @@ void dlgJob::OnChangeSchedule(wxCommandEvent &ev) if (lstSchedules->GetText(pos, 3).IsEmpty()) { wxString *scheduleSql = new wxString(schedule.GetInsertSql()); - lstSchedules->SetItemData(pos, (long)scheduleSql); + lstSchedules->SetItemData(pos, (long long)scheduleSql); } else { wxString *scheduleSql = new wxString(schedule.GetUpdateSql()); - lstSchedules->SetItemData(pos, (long)scheduleSql); + lstSchedules->SetItemData(pos, (long long)scheduleSql); } CheckChange(); @@ -371,7 +371,7 @@ void dlgJob::OnAddSchedule(wxCommandEvent &ev) { int pos = lstSchedules->AppendItem(scheduleFactory.GetIconId(), schedule.GetName(), schedule.GetComment()); wxString *scheduleSql = new wxString(schedule.GetInsertSql()); - lstSchedules->SetItemData(pos, (long)scheduleSql); + lstSchedules->SetItemData(pos, (long long)scheduleSql); CheckChange(); } } diff --git a/ctl/ctlComboBox.cpp b/ctl/ctlComboBox.cpp index 67fefbc..71415ce 100644 --- a/ctl/ctlComboBox.cpp +++ b/ctl/ctlComboBox.cpp @@ -98,14 +98,14 @@ long ctlComboBoxFix::GetLongKey(int sel) { if (sel < 0) sel = GetSelection(); - return (long)wxItemContainer::GetClientData(sel); + return (long)wxPtrToUInt(wxItemContainer::GetClientData(sel)); } OID ctlComboBoxFix::GetOIDKey(int sel) { if (sel < 0) sel = GetSelection(); - return (OID)wxItemContainer::GetClientData(sel); + return (OID)wxPtrToUInt(wxItemContainer::GetClientData(sel)); } wxString ctlComboBoxFix::GetStringKey(int sel) diff --git a/ctl/ctlSQLBox.cpp b/ctl/ctlSQLBox.cpp index 63b5f21..ec04d98 100644 --- a/ctl/ctlSQLBox.cpp +++ b/ctl/ctlSQLBox.cpp @@ -1573,7 +1573,7 @@ void ctlSQLBox::SetCaretWidthForKeyboardLayout() { int newwidth = currentwidth; #ifdef __WXMSW__ HKL la = GetKeyboardLayout(0); - if (((int)la & 0xFFFF) == 0x409) { + if (((long long)la & 0xFFFF) == 0x409) { //en newwidth = 1; } diff --git a/dlg/dlgTable.cpp b/dlg/dlgTable.cpp index df6adab..857af44 100644 --- a/dlg/dlgTable.cpp +++ b/dlg/dlgTable.cpp @@ -355,7 +355,7 @@ int dlgTable::Go(bool modal) column->GetName(), column->GetDefinition()); previousColumns.Add(column->GetQuotedIdentifier() + wxT(" ") + column->GetDefinition()); - lstColumns->SetItem(pos, COL_PGCOLUMN, NumToStr((long)column)); + lstColumns->SetItem(pos, COL_PGCOLUMN, NumToStr((long long)column)); if (inherited) lstColumns->SetItem(pos, COL_INHERIT, column->GetInheritedTableName()); } @@ -1859,8 +1859,8 @@ void dlgTable::OnChangeOfType(wxCommandEvent &ev) void dlgTable::OnChangeCol(wxCommandEvent &ev) { long pos = lstColumns->GetSelection(); - pgColumn *column = (pgColumn *) StrToLong(lstColumns->GetText(pos, COL_PGCOLUMN)); - pgColumn *column2 = (pgColumn *) StrToLong(lstColumns->GetText(pos, COL_CHANGEDCOL)); + pgColumn *column = (pgColumn *) StrTolonglong(lstColumns->GetText(pos, COL_PGCOLUMN)); + pgColumn *column2 = (pgColumn *) StrTolonglong(lstColumns->GetText(pos, COL_CHANGEDCOL)); dlgColumn col(&columnFactory, mainForm, column, table); col.CenterOnParent(); @@ -1877,7 +1877,7 @@ void dlgTable::OnChangeCol(wxCommandEvent &ev) lstColumns->SetItem(pos, COL_SQLCHANGE, col.GetSql()); lstColumns->SetItem(pos, COL_STATISTICS, col.GetStatistics()); lstColumns->SetItem(pos, COL_COMMENTS, col.GetComment()); - lstColumns->SetItem(pos, COL_CHANGEDCOL, NumToStr((long)column2)); + lstColumns->SetItem(pos, COL_CHANGEDCOL, NumToStr((long long)column2)); } CheckChange(); } diff --git a/include/ctl/wxTopActivity.h b/include/ctl/wxTopActivity.h index e9755cc..2e8a2ca 100644 --- a/include/ctl/wxTopActivity.h +++ b/include/ctl/wxTopActivity.h @@ -232,7 +232,7 @@ public: } if (k.size() > 0) { key3 kk = k.at(r); - if ((col == 0)) { + if (col == 0) { long ttmp = kk.pid; if (kk.sum > 0) val = wxString::Format("*%ld", ttmp); // backend else @@ -283,7 +283,13 @@ public: { return false; } - unsigned GetRow(const wxDataViewItem& item) const wxOVERRIDE { return (unsigned long)item.GetID() - 1; } // 0 row = header + unsigned int GetRow(const wxDataViewItem& item) const wxOVERRIDE { + unsigned int i; +// wxUIntToPtr() + i=wxPtrToUInt(item.GetID()); + i=i-1; + return i; + } // 0 row = header unsigned int GetColumnCount() const wxOVERRIDE { return 0; } wxString GetColumnType(unsigned int) const wxOVERRIDE { return ""; } @@ -449,7 +455,7 @@ public: Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, [&](wxDataViewEvent& event) { int col = event.GetColumn(); wxDataViewItem item(event.GetItem()); - long row = (long)item.GetID(); + long row = wxPtrToUInt(item.GetID()); row--; if (col == 1) //qid { @@ -544,7 +550,7 @@ public: MyIndexListModel* m = static_cast(GetModel()); wxDataViewItem item(GetCurrentItem()); - long row = (long)item.GetID(); + long row = wxPtrToUInt(item.GetID()); if (!(row < m->GetCount())) row = 0; while (row != -1 && row < m->GetCount()) { @@ -599,7 +605,7 @@ public: HitTest(mc, item, column); if (item != NULL && column != NULL) { - int row = (long)item.GetID() - 1; + int row = wxPtrToUInt(item.GetID()) - 1; int ncol = column->GetModelColumn(); if (row >= 0) { if (column && column->GetModelColumn() == 2) { diff --git a/include/frm/frmLog.h b/include/frm/frmLog.h index cb8ef73..c8f20dd 100644 --- a/include/frm/frmLog.h +++ b/include/frm/frmLog.h @@ -22,6 +22,7 @@ // wxAUI #include +#include "schema/pgServer.h" #include "dlg/dlgClasses.h" #include "utils/factory.h" #include "ctl/ctlAuiNotebook.h" @@ -90,7 +91,7 @@ class MywxAuiDefaultTabArt : public wxAuiDefaultTabArt { public: MywxAuiDefaultTabArt() :wxAuiDefaultTabArt(){}; - MywxAuiDefaultTabArt* Clone() { + MywxAuiDefaultTabArt* Clone() wxOVERRIDE { return new MywxAuiDefaultTabArt(*this); } virtual void DrawTab(wxDC& dc, diff --git a/include/frm/frmMain.h b/include/frm/frmMain.h index 685e375..023e8b3 100644 --- a/include/frm/frmMain.h +++ b/include/frm/frmMain.h @@ -27,7 +27,7 @@ #include "frm/frmLog.h" #include "ctl/ctlGitPanel.h" #include "ctl/ctlShortCut.h" -#include "utils/FunctionPGHelper.h"; +#include "utils/FunctionPGHelper.h" // // This number MUST be incremented if changing any of the default perspectives // diff --git a/include/pgAdmin3.h b/include/pgAdmin3.h index e8a9a87..305ad10 100644 --- a/include/pgAdmin3.h +++ b/include/pgAdmin3.h @@ -11,8 +11,6 @@ #ifndef PGADMIN3_H #define PGADMIN3_H -#include "../utils/diff_match_patch.h" -#include "utils/FormatterSQL.h" // wxWindows headers #include @@ -20,6 +18,8 @@ #include #include #include +#include "../utils/diff_match_patch.h" +#include "utils/FormatterSQL.h" #ifdef WIN32 #include @@ -167,8 +167,8 @@ WX_DECLARE_STRING_HASH_MAP(wxString, cacheMap); class pgAdmin3 : public wxApp { public: - virtual bool OnInit(); - virtual int OnExit(); + virtual bool OnInit() wxOVERRIDE; + virtual int OnExit() wxOVERRIDE; virtual void OnFatalException() wxOVERRIDE; #ifdef __WXMAC__ void MacOpenFile(const wxString &fileName); diff --git a/include/precomp.h b/include/precomp.h index b6415cb..3d791c1 100644 --- a/include/precomp.h +++ b/include/precomp.h @@ -11,7 +11,7 @@ #ifdef WX_PRECOMP #ifdef __cplusplus - +#include #include "copyright.h" #include "pgAdmin3.h" #include "version.h" diff --git a/include/pro_scheduler/pgproJob.h b/include/pro_scheduler/pgproJob.h index 05e0316..203a817 100644 --- a/include/pro_scheduler/pgproJob.h +++ b/include/pro_scheduler/pgproJob.h @@ -13,7 +13,7 @@ #define PGPROJOB_H #include "schema/pgServer.h" - +#include "schema/pgDatabase.h" class pgproJobFactory : public pgDatabaseObjFactory { diff --git a/include/utils/misc.h b/include/utils/misc.h index de2e0d3..6efcb59 100644 --- a/include/utils/misc.h +++ b/include/utils/misc.h @@ -107,6 +107,7 @@ bool StrToBool(const wxString &value); // english long StrToLong(const wxString &value); double StrToDouble(const wxString &value); wxLongLong StrToLongLong(const wxString &value); +long long StrTolonglong(const wxString &value); wxDateTime StrToDateTime(const wxString &value); OID StrToOid(const wxString &value); @@ -115,6 +116,7 @@ wxString generate_spaces(int length); // nls aware wxString BoolToYesNo(bool value); wxString NumToStr(long value); +wxString NumToStr(long long value); wxString NumToStr(double value); wxString NumToStrHuman(wxLongLong value); wxString NumToStr(OID value); diff --git a/mingw-windows-x64.cmake b/mingw-windows-x64.cmake new file mode 100644 index 0000000..a085b22 --- /dev/null +++ b/mingw-windows-x64.cmake @@ -0,0 +1,26 @@ +# 1. Set the target system +set(CMAKE_SYSTEM_NAME Windows) +set(CROSS_COMPILE Windows) +#set(CMAKE_SYSTEM_PROCESSOR x86_64) +SET(CMAKE_FIND_ROOT_PATH /home/sergey/mingw/llvm-mingw-20231128-msvcrt-ubuntu-20.04-x86_64 ) +# 2. Specify the cross-compilers +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +set(CMAKE_RANLIB x86_64-w64-mingw32-ranlib) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-ignored-attributes ") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ") +# 3. Configure search for external dependencies +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + set(WXWIN_LIB /home/sergey/wxWidgets-3.2.2.1/msw-build/lib ) + set(WXWIN /home/sergey/k/wxMSW-3.2.2 ) + set(PGDIR /home/sergey/k/pg10 ) + set(PGBUILD /home/sergey/k ) + set(wxWidgets_LIBRARIES "-L${WXWIN_LIB} -lwx_mswu_xrc-3.2-x86_64-w64-mingw32.dll -lwx_mswu_qa-3.2-x86_64-w64-mingw32.dll -lwx_baseu_net-3.2-x86_64-w64-mingw32.dll -lwx_mswu_html-3.2-x86_64-w64-mingw32.dll -lwx_mswu_core-3.2-x86_64-w64-mingw32.dll -lwx_baseu_xml-3.2-x86_64-w64-mingw32.dll -lwx_baseu-3.2-x86_64-w64-mingw32.dll -lwx_mswu_aui-3.2-x86_64-w64-mingw32.dll -lwx_baseu_xml-3.2-x86_64-w64-mingw32.dll -lwx_mswu_stc-3.2-x86_64-w64-mingw32.dll") + set(PGLIB "-L${PGDIR}/lib -lpq -lxml2") + set(XSLTLIB "-L${PGBUILD}/libxslt/lib -lxslt") + set(OTHERLIB " -lws2_32") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-static-libgcc -static-libstdc++ -Wl,--subsystem,windows -mwindows ${wxWidgets_LIBRARIES} ${PGLIB} ${XSLTLIB} ${OTHERLIB}") diff --git a/ogl/mfutils.cpp b/ogl/mfutils.cpp index 6f25709..9c7955d 100644 --- a/ogl/mfutils.cpp +++ b/ogl/mfutils.cpp @@ -537,7 +537,7 @@ bool wxXMetaFile::ReadFile(const wxChar *file) else style = wxPENSTYLE_SOLID; wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref)); - rec->param1 = (long)wxThePenList->FindOrCreatePen(colour, x, style); + rec->param1 = (long long)wxThePenList->FindOrCreatePen(colour, x, style); metaRecords.Append(rec); gdiObjects.Append(rec); @@ -618,11 +618,11 @@ bool wxXMetaFile::ReadFile(const wxChar *file) wxFont *theFont = wxTheFontList->FindOrCreateFont(pointSize, family, style, weight, (lfUnderline != 0)); - rec->param1 = (long) theFont; + rec->param1 = (long long) theFont; metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.GetCount() - 1); + rec->param2 = (long long)(gdiObjects.GetCount() - 1); break; } case META_CREATEBRUSHINDIRECT: @@ -675,7 +675,7 @@ bool wxXMetaFile::ReadFile(const wxChar *file) else style = wxPENSTYLE_SOLID; wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref)); - rec->param1 = (long)wxTheBrushList->FindOrCreateBrush(colour, style); + rec->param1 = (long long)wxTheBrushList->FindOrCreateBrush(colour, style); metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); diff --git a/pgAdmin3.cpp b/pgAdmin3.cpp index 7b16ae1..86d436e 100644 --- a/pgAdmin3.cpp +++ b/pgAdmin3.cpp @@ -26,7 +26,7 @@ #include #include #include -#include "wx/stackwalk.h" +#include // wxOGL #include @@ -202,7 +202,7 @@ void frmDlgTest::OnSelect(wxCommandEvent &ev) dlg->Show(); } } - +#if wxUSE_STACKWALKER class MyStackWalker : public wxStackWalker { public: @@ -262,15 +262,19 @@ void MyStackWalker::OnStackFrame(const wxStackFrame& frame) Rez->Append(wxString::Format("----------------\n")); } +#endif // The Application! void pgAdmin3::OnFatalException() { +#if wxUSE_STACKWALKER + wxString err = "fatal error"; MyStackWalker sw(err); sw.WalkFromException(); wxLogError(err); wxMessageBox(err, "wxExcept", wxOK | wxICON_ERROR); +#endif } bool pgAdmin3::OnInit() { diff --git a/pgscript/lex.pgs.cc b/pgscript/lex.pgs.cc index 0b69f03..2f4c806 100644 --- a/pgscript/lex.pgs.cc +++ b/pgscript/lex.pgs.cc @@ -831,9 +831,9 @@ static int yy_flex_strlen (yyconst char * ); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; #line 74 "pgscript/pgsScanner.ll" @@ -888,7 +888,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1989,9 +1989,9 @@ void yyFlexLexer::LexerOutput( const char* buf, int size ) */ int yyFlexLexer::yy_get_next_buffer() { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2115,14 +2115,14 @@ int yyFlexLexer::yy_get_next_buffer() yy_state_type yyFlexLexer::yy_get_previous_state() { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2147,10 +2147,10 @@ int yyFlexLexer::yy_get_next_buffer() */ yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2168,9 +2168,9 @@ int yyFlexLexer::yy_get_next_buffer() return yy_is_jam ? 0 : yy_current_state; } - void yyFlexLexer::yyunput( int c, register char* yy_bp) + void yyFlexLexer::yyunput( int c, char* yy_bp) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); @@ -2180,10 +2180,10 @@ int yyFlexLexer::yy_get_next_buffer() if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -2604,7 +2604,7 @@ void yyFlexLexer::LexerError( yyconst char msg[] ) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2613,7 +2613,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; diff --git a/pgscript/utilities/m_apm/mapmutl2.cpp b/pgscript/utilities/m_apm/mapmutl2.cpp index 93e6c94..9d525c9 100644 --- a/pgscript/utilities/m_apm/mapmutl2.cpp +++ b/pgscript/utilities/m_apm/mapmutl2.cpp @@ -289,7 +289,7 @@ char *M_lowercase(char *s) */ int M_strposition(char *s1, char *s2) { - register char ch1, ch2; + char ch1, ch2; char *p0, *p1, *p2; int ct; diff --git a/slony/dlgRepCluster.cpp b/slony/dlgRepCluster.cpp index 547d572..46f6186 100644 --- a/slony/dlgRepCluster.cpp +++ b/slony/dlgRepCluster.cpp @@ -891,7 +891,7 @@ void dlgRepCluster::OnOK(wxCommandEvent &ev) done = remoteConn->ExecuteVoid( wxT("SELECT ") + schemaPrefix + wxT("storepath(") + txtNodeID->GetValue() + wxT(", ") + - NumToStr((long)cbAdminNode->wxItemContainer::GetClientData(cbAdminNode->GetCurrentSelection())) + wxT(", ") + + NumToStr((long long)cbAdminNode->wxItemContainer::GetClientData(cbAdminNode->GetCurrentSelection())) + wxT(", ") + qtDbString(wxT("host=") + database->GetServer()->GetName() + wxT(" port=") + NumToStr((long)database->GetServer()->GetPort()) + wxT(" dbname=") + database->GetName()) + wxT(", ") @@ -930,7 +930,7 @@ void dlgRepCluster::CheckChange() if (cluster) { int sel = cbAdminNode->GetCurrentSelection(); - bool changed = (sel >= 0 && (long)cbAdminNode->wxEvtHandler::GetClientData() != cluster->GetAdminNodeID()); + bool changed = (sel >= 0 && (long long)cbAdminNode->wxEvtHandler::GetClientData() != cluster->GetAdminNodeID()); EnableOK(changed || txtComment->GetValue() != cluster->GetComment()); } @@ -1039,7 +1039,7 @@ wxString dlgRepCluster::GetSql() int sel = cbAdminNode->GetCurrentSelection(); if (sel >= 0) { - long id = (long)cbAdminNode->wxItemContainer::GetClientData(sel); + long id = (long long)cbAdminNode->wxItemContainer::GetClientData(sel); if (id != cluster->GetAdminNodeID()) settings->WriteLong(wxT("Replication/") + cluster->GetName() + wxT("/AdminNode"), id); } diff --git a/slony/dlgRepListen.cpp b/slony/dlgRepListen.cpp index 3cb5993..db80ecb 100644 --- a/slony/dlgRepListen.cpp +++ b/slony/dlgRepListen.cpp @@ -108,9 +108,9 @@ int dlgRepListen::Go(bool modal) pgObject *dlgRepListen::CreateObject(pgCollection *collection) { pgObject *obj = listenFactory.CreateObjects(collection, 0, - wxT(" WHERE li_origin = ") + NumToStr((OID)cbOrigin->wxItemContainer::GetClientData(cbOrigin->GetCurrentSelection())) + + wxT(" WHERE li_origin = ") + NumToStr((long long)cbOrigin->wxItemContainer::GetClientData(cbOrigin->GetCurrentSelection())) + wxT(" AND li_receiver = ") + NumToStr(node->GetSlId()) + - wxT(" AND li_provider = ") + NumToStr((OID)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())) + wxT(" AND li_provider = ") + NumToStr((long long)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())) ); return obj; @@ -150,8 +150,8 @@ wxString dlgRepListen::GetSql() // create mode sql = wxT("SELECT ") + cluster->GetSchemaPrefix() + wxT("storelisten(") - + NumToStr((OID)cbOrigin->wxItemContainer::GetClientData(cbOrigin->GetCurrentSelection())) + wxT(", ") - + NumToStr((OID)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())) + wxT(", ") + + NumToStr((long long)cbOrigin->wxItemContainer::GetClientData(cbOrigin->GetCurrentSelection())) + wxT(", ") + + NumToStr((long long)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())) + wxT(", ") + NumToStr(node->GetSlId()) + wxT(");"); } diff --git a/slony/dlgRepPath.cpp b/slony/dlgRepPath.cpp index dc10acd..a367aa8 100644 --- a/slony/dlgRepPath.cpp +++ b/slony/dlgRepPath.cpp @@ -103,7 +103,7 @@ int dlgRepPath::Go(bool modal) pgObject *dlgRepPath::CreateObject(pgCollection *collection) { pgObject *obj = pathFactory.CreateObjects(collection, 0, - wxT(" WHERE pa_server = ") + NumToStr((OID)cbServer->wxItemContainer::GetClientData(cbServer->GetCurrentSelection())) + + wxT(" WHERE pa_server = ") + NumToStr((long long)cbServer->wxItemContainer::GetClientData(cbServer->GetCurrentSelection())) + wxT(" AND pa_client = ") + NumToStr(node->GetSlId())); return obj; @@ -145,7 +145,7 @@ wxString dlgRepPath::GetSql() if (sel >= 0) { sql = wxT("SELECT ") + cluster->GetSchemaPrefix() + wxT("storepath(") - + NumToStr((OID)cbServer->wxItemContainer::GetClientData(sel)) + wxT(", ") + + NumToStr((long long)cbServer->wxItemContainer::GetClientData(sel)) + wxT(", ") + NumToStr(node->GetSlId()) + wxT(", ") + qtDbString(txtConnInfo->GetValue()) + wxT(", ") + NumToStr(StrToLong(txtConnRetry->GetValue())) + wxT(");"); diff --git a/slony/dlgRepSequence.cpp b/slony/dlgRepSequence.cpp index 33e2e91..ce569c9 100644 --- a/slony/dlgRepSequence.cpp +++ b/slony/dlgRepSequence.cpp @@ -107,7 +107,7 @@ int dlgRepSequence::Go(bool modal) pgObject *dlgRepSequence::CreateObject(pgCollection *collection) { pgObject *obj = slSequenceFactory.CreateObjects(collection, 0, - wxT(" WHERE seq_reloid = ") + NumToStr((OID)cbSequence->wxItemContainer::GetClientData(cbSequence->GetGuessedSelection()))); + wxT(" WHERE seq_reloid = ") + NumToStr((long long)cbSequence->wxItemContainer::GetClientData(cbSequence->GetGuessedSelection()))); return obj; } diff --git a/slony/dlgRepSet.cpp b/slony/dlgRepSet.cpp index db3491c..2aa4e66 100644 --- a/slony/dlgRepSet.cpp +++ b/slony/dlgRepSet.cpp @@ -188,7 +188,7 @@ wxString dlgRepSetMerge::GetSql() { wxString sql; wxString addId = NumToStr(set->GetSlId()); - wxString toId = NumToStr((long)cbTargetID->wxItemContainer::GetClientData(cbTargetID->GetCurrentSelection())); + wxString toId = NumToStr((long long)cbTargetID->wxItemContainer::GetClientData(cbTargetID->GetCurrentSelection())); wxString prefix = cluster->GetSchemaPrefix(); if (set->GetSubscriptionCount() > 0) @@ -323,7 +323,7 @@ void dlgRepSetMove::CheckChange() wxString dlgRepSetMove::GetSql() { - wxString toId = NumToStr((long)cbTargetNode->wxItemContainer::GetClientData(cbTargetNode->GetCurrentSelection())); + wxString toId = NumToStr((long long)cbTargetNode->wxItemContainer::GetClientData(cbTargetNode->GetCurrentSelection())); wxString sql = wxT("SELECT ") + cluster->GetSchemaPrefix() + wxT("moveset(") + diff --git a/slony/dlgRepSubscription.cpp b/slony/dlgRepSubscription.cpp index 8e0d565..965adfc 100644 --- a/slony/dlgRepSubscription.cpp +++ b/slony/dlgRepSubscription.cpp @@ -136,7 +136,7 @@ void dlgRepSubscription::CheckChange() int sel = cbProvider->GetCurrentSelection(); EnableOK(sel >= 0 && (chkForward->GetValue() != subscription->GetForward() - || (long)cbProvider->wxItemContainer::GetClientData(sel) != subscription->GetProviderId())); + || (long long)cbProvider->wxItemContainer::GetClientData(sel) != subscription->GetProviderId())); } else { @@ -159,11 +159,11 @@ wxString dlgRepSubscription::GetSql() { // Actually, provider and receiver are exchanged here. sql += NumToStr(cluster->GetLocalNodeID()) + wxT(", ") - + NumToStr((long)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())); + + NumToStr((long long)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())); } else { - sql += NumToStr((long)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())) + wxT(", ") + sql += NumToStr((long long)cbProvider->wxItemContainer::GetClientData(cbProvider->GetCurrentSelection())) + wxT(", ") + NumToStr(cluster->GetLocalNodeID()); } sql += wxT(", ") diff --git a/slony/dlgRepTable.cpp b/slony/dlgRepTable.cpp index e0b1a1d..93edb21 100644 --- a/slony/dlgRepTable.cpp +++ b/slony/dlgRepTable.cpp @@ -124,7 +124,7 @@ int dlgRepTable::Go(bool modal) pgObject *dlgRepTable::CreateObject(pgCollection *collection) { pgObject *obj = slTableFactory.CreateObjects(collection, 0, - wxT(" WHERE tab_reloid = ") + NumToStr((OID)cbTable->wxItemContainer::GetClientData(cbTable->GetGuessedSelection()))); + wxT(" WHERE tab_reloid = ") + NumToStr((long long)cbTable->wxItemContainer::GetClientData(cbTable->GetGuessedSelection()))); return obj; } @@ -147,7 +147,7 @@ void dlgRepTable::OnChangeTable(wxCommandEvent &ev) if (sel >= 0) { - OID relid = (OID)cbTable->wxItemContainer::GetClientData(sel); + OID relid = (long long)cbTable->wxItemContainer::GetClientData(sel); pgSet *idx = connection->ExecuteSet( wxT("SELECT relname\n") diff --git a/utils/FormatterSQL.cpp b/utils/FormatterSQL.cpp index 54524bc..dbcd00c 100644 --- a/utils/FormatterSQL.cpp +++ b/utils/FormatterSQL.cpp @@ -1150,7 +1150,7 @@ wxPoint FormatterSQL::align_level(int start_i, int level, int Xpos, int Ypos, in if ((vi->txt.Lower() == "dblink")) { // neededNewLine.y = -1; } - if ((s == 2511)) { + if (s == 2511) { p.x = p.x; } if (fl & newLineComma) { diff --git a/utils/WaitSample.cpp b/utils/WaitSample.cpp index b80d3bb..17076f7 100644 --- a/utils/WaitSample.cpp +++ b/utils/WaitSample.cpp @@ -3,6 +3,7 @@ #include "wx/stdpaths.h" #include "utils/utffile.h" #include "utils/json/jsonval.h" +#include "frm/frmStatus.h" void WaitSample::Init() { wxString clr = "h1 { \ diff --git a/utils/json/jsonreader.cpp b/utils/json/jsonreader.cpp index dfca7d8..4b061c1 100644 --- a/utils/json/jsonreader.cpp +++ b/utils/json/jsonreader.cpp @@ -13,7 +13,7 @@ #endif #include "pgAdmin3.h" - +#include "utils/json/jsonreader.h" #include #include @@ -1847,13 +1847,13 @@ wxJSONReader::ConvertCharByChar(wxString& s, const wxMemoryBuffer& utf8Buffer) @param val the JSON value that will hold the memory buffer value @return the last char read or -1 in case of EOF */ - +/* union byte { unsigned char c[2]; short int b; }; - +*/ int wxJSONReader::ReadMemoryBuff(wxInputStream& is, wxJSONValue& val) { diff --git a/utils/json/jsonwriter.cpp b/utils/json/jsonwriter.cpp index 737f084..3814e52 100644 --- a/utils/json/jsonwriter.cpp +++ b/utils/json/jsonwriter.cpp @@ -13,6 +13,7 @@ #include "pgAdmin3.h" +#include "utils/json/jsonwriter.h" #include #include diff --git a/utils/log/MyDataViewCtrl.cpp b/utils/log/MyDataViewCtrl.cpp index f5a24ff..988b992 100644 --- a/utils/log/MyDataViewCtrl.cpp +++ b/utils/log/MyDataViewCtrl.cpp @@ -328,7 +328,7 @@ void MyDataViewCtrl::OnEVT_DATAVIEW_CONTEXT_MENU(wxCommandEvent& event) { wxString label = mi->GetLabelText(id); StorageModel* m = dynamic_cast(GetModel()); #ifdef WIN32 - int col = (int)mi->GetClientData(); + int col = (long long)mi->GetClientData(); #else long nc=(long)mi->GetClientData(); int col= nc & 0xFFFF; diff --git a/utils/misc.cpp b/utils/misc.cpp index 1a6b53c..380ee03 100644 --- a/utils/misc.cpp +++ b/utils/misc.cpp @@ -128,6 +128,12 @@ wxString NumToStr(long value) result.Printf(wxT("%ld"), value); return result; } +wxString NumToStr(long long value) +{ + wxString result; + result.Printf(wxT("%lld"), value); + return result; +} wxString NumToStr(OID value) @@ -142,6 +148,10 @@ long StrToLong(const wxString &value) { return atol(value.ToAscii()); } +long long StrTolonglong(const wxString &value) +{ + return atoll(value.ToAscii()); +} OID StrToOid(const wxString &value) @@ -1206,11 +1216,13 @@ int ExecProcess(const wxString &command, wxArrayString &result) #ifdef WIN32 #if (_MSC_VER < 1300) /* _ftol2 is more than VC7. */ +/* extern "C" long _ftol( double ); extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); } +*/ #endif #endif diff --git a/utils/sshTunnel.cpp b/utils/sshTunnel.cpp index 2475eb8..5dd2477 100644 --- a/utils/sshTunnel.cpp +++ b/utils/sshTunnel.cpp @@ -12,16 +12,15 @@ // App headers #include "pgAdmin3.h" #include +#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT) +#pragma comment (lib, "Ws2_32.lib") #undef ssize_t #define ssize_t long #include "libssh2.h" #include "utils/sshTunnel.h" #include "frm/frmMain.h" -#pragma comment (lib, "Ws2_32.lib") -#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT) - typedef const char *(*inet_ntop_t) (int af, const void *src, char *dst, socklen_t size); #ifdef WIN32