From 70ae3bca8b87c45d33b75bb82b6523f2e46c9bc8 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 6 Jul 2018 10:13:04 +0200 Subject: [PATCH] 3204 --- cmake/CREAMacro_FindAndUseLibraries.cmake | 4 ++ cmake/CREAMacro_FindAndUseWxWidgets.cmake | 86 ++++++++++++----------- src/creaSystem.cxx | 46 ++++++++++-- 3 files changed, 88 insertions(+), 48 deletions(-) diff --git a/cmake/CREAMacro_FindAndUseLibraries.cmake b/cmake/CREAMacro_FindAndUseLibraries.cmake index 5625e8b..1f5cf0b 100644 --- a/cmake/CREAMacro_FindAndUseLibraries.cmake +++ b/cmake/CREAMacro_FindAndUseLibraries.cmake @@ -265,9 +265,13 @@ ENDIF(USE_WT) #----------------------------------------------------------------------------- IF(USE_WXWIDGETS) IF(NOT wxWidgets_FOUND) + INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake) CREA_FIND_WXWIDGETS(${USE_DEBUG_LIB}) CREA_USE_WXWIDGETS() + + + ENDIF(NOT wxWidgets_FOUND) ENDIF(USE_WXWIDGETS) #----------------------------------------------------------------------------- diff --git a/cmake/CREAMacro_FindAndUseWxWidgets.cmake b/cmake/CREAMacro_FindAndUseWxWidgets.cmake index 68d0cb5..ec0bdd1 100644 --- a/cmake/CREAMacro_FindAndUseWxWidgets.cmake +++ b/cmake/CREAMacro_FindAndUseWxWidgets.cmake @@ -29,29 +29,28 @@ #======================================================================= MACRO(CREA_FIND_WXWIDGETS) IF(WIN32) - # Search WXWIDGETS - - # WXWINDOWS_LIBRARY = full path to the wxWindows library and linker flags on unix - # CMAKE_WX_CXX_FLAGS = compiler flags for building wxWindows - # WXWINDOWS_INCLUDE_PATH = include path of wxWindows - SET(WXWINDOWS_USE_GL 1) - - #wxWidgets build related stuff - # DO NOT FORCE DEBUG LIBS !! - SET(WXW_USE_DEBUG OFF) - SET(WXW_USE_UNICODE OFF) - SET(WXW_USE_SHARED ON) - SET(WXW_USE_UNIV OFF) - SET(WXW_USE_MONO OFF) - SET(WXW_FILE_VERSION "28") - SET(WXW_VERSION "2.8") - - #CMake Options - # Why forcing verbosity ? - # SET(CMAKE_VERBOSE_MAKEFILE TRUE) - - INCLUDE (${CREA_CMAKE_DIR}/FindWxWidgetsWin32.cmake) - # +# # Search WXWIDGETS +# # WXWINDOWS_LIBRARY = full path to the wxWindows library and linker flags on unix +# # CMAKE_WX_CXX_FLAGS = compiler flags for building wxWindows +# # WXWINDOWS_INCLUDE_PATH = include path of wxWindows +# SET(WXWINDOWS_USE_GL 1) +# #wxWidgets build related stuff +# # DO NOT FORCE DEBUG LIBS !! +# SET(WXW_USE_DEBUG OFF) +# SET(WXW_USE_UNICODE OFF) +# SET(WXW_USE_SHARED ON) +# SET(WXW_USE_UNIV OFF) +# SET(WXW_USE_MONO OFF) +# SET(WXW_FILE_VERSION "28") +# SET(WXW_VERSION "2.8") +# #CMake Options +# # Why forcing verbosity ? +# # SET(CMAKE_VERBOSE_MAKEFILE TRUE) +# INCLUDE (${CREA_CMAKE_DIR}/FindWxWidgetsWin32.cmake) +# # + + find_package(wxwidgets REQUIRED COMPONENTS core base) + ELSE(WIN32) @@ -99,24 +98,29 @@ MACRO(CREA_USE_WXWIDGETS) # IF(WIN32) - # Clean ? - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WXWIDGETS_CXX_FLAGS}") - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}${WXWIDGETS_EXE_LINKER_FLAGS}") - # - ADD_DEFINITIONS( ${WXWIDGETS_DEFINITIONS} ) - # - INCLUDE_DIRECTORIES(${WXWIDGETS_INCLUDE_DIR}) - LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} ) - SET(WXWIDGETS_LIBRARIES - ${WXWIDGETS_LIBRARIES} -#DO NOT FORCE DEBUG LIBS !! - debug wxmsw28d_aui - optimized wxmsw28_aui - debug msvcrtd - debug msvcprtd - optimized msvcrt - optimized msvcprt - ) +# # Clean ? +# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WXWIDGETS_CXX_FLAGS}") +# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}${WXWIDGETS_EXE_LINKER_FLAGS}") +# # +# ADD_DEFINITIONS( ${WXWIDGETS_DEFINITIONS} ) +# # +# INCLUDE_DIRECTORIES(${WXWIDGETS_INCLUDE_DIR}) +# LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} ) +# SET(WXWIDGETS_LIBRARIES +# ${WXWIDGETS_LIBRARIES} +##DO NOT FORCE DEBUG LIBS !! +# debug wxmsw28d_aui +# optimized wxmsw28_aui +# debug msvcrtd +# debug msvcprtd +# optimized msvcrt +# optimized msvcprt +# ) + + include(${wxWidgets_USE_FILE}) + + + ELSE(WIN32) ## # GTK2 ## INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS}) diff --git a/src/creaSystem.cxx b/src/creaSystem.cxx index 26a071e..5640b07 100644 --- a/src/creaSystem.cxx +++ b/src/creaSystem.cxx @@ -97,7 +97,13 @@ int System::GetAppPath(char *pname, size_t pathsize) #endif /* LINUX */ #ifdef WIN32 - long result = GetModuleFileName(NULL, pname, pathsize); + +//2018-07-06 mingw64 + wchar_t pname2[512]; + mbstowcs(pname2,pname,strlen(pname)+1); + long result = GetModuleFileName(NULL, pname2, pathsize); +// long result = GetModuleFileName(NULL, pname, pathsize); + if (result > 0) { /* fix up the dir slashes... */ @@ -204,8 +210,18 @@ std::string System::GetDllAppPath(std::string &nomdll){ std::string path = "."; #ifdef WIN32 char currentPath[_MAX_PATH]; - HMODULE hand = GetModuleHandle(nomdll.c_str()); - GetModuleFileName(hand, currentPath, _MAX_PATH); + +//2018-07-06 mingw64 + wchar_t nomdll2[512]; + mbstowcs(nomdll2,nomdll.c_str(),strlen(nomdll.c_str())+1); + HMODULE hand = GetModuleHandle(nomdll2); +// HMODULE hand = GetModuleHandle(nomdll.c_str()); + +//2018-07-06 mingw64 + wchar_t currentPath2[512]; + mbstowcs(currentPath2,currentPath,strlen(currentPath)+1); + GetModuleFileName(hand, currentPath2, _MAX_PATH); +// GetModuleFileName(hand, currentPath, _MAX_PATH); path = currentPath; @@ -219,8 +235,18 @@ std::string System::GetDllAppPath(const char *nomdll){ std::string path = "."; #ifdef WIN32 char currentPath[_MAX_PATH]; - HMODULE hand = GetModuleHandle(nomdll); - GetModuleFileName(hand, currentPath, _MAX_PATH); + +//2018-07-06 mingw64 + wchar_t nomdll2[512]; + mbstowcs(nomdll2,nomdll,strlen(nomdll)+1); + HMODULE hand = GetModuleHandle(nomdll2); +// HMODULE hand = GetModuleHandle(nomdll); + +//2018-07-06 mingw64 + wchar_t currentPath2[512]; + mbstowcs(currentPath2,currentPath,strlen(currentPath)+1); + GetModuleFileName(hand, currentPath2, _MAX_PATH); +// GetModuleFileName(hand, currentPath, _MAX_PATH); path = currentPath; @@ -257,10 +283,16 @@ std::string System::GetExecutablePath(){ void System::createDirectory(const char* directorypath){ #ifdef WIN32 - if (CreateDirectory(directorypath, NULL) == ERROR_ALREADY_EXISTS) + +//2018-07-06 mingw64 + wchar_t directorypath2[512]; + mbstowcs(directorypath2,directorypath,strlen(directorypath)+1); + if (CreateDirectory(directorypath2, NULL) == ERROR_ALREADY_EXISTS) +// if (CreateDirectory(directorypath, NULL) == ERROR_ALREADY_EXISTS) { std::cout<<"directory already exists "<