]> Creatis software - crea.git/commitdiff
3204
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 6 Jul 2018 08:13:04 +0000 (10:13 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 6 Jul 2018 08:13:04 +0000 (10:13 +0200)
cmake/CREAMacro_FindAndUseLibraries.cmake
cmake/CREAMacro_FindAndUseWxWidgets.cmake
src/creaSystem.cxx

index 5625e8bf86ea66fdb0874d93632dddc1a03534e4..1f5cf0b2102eb18fcf29a8fd30a064627094dded 100644 (file)
@@ -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)
 #-----------------------------------------------------------------------------
index 68d0cb5c0aec309f2c2533066e70cad9ee11bae8..ec0bdd153af8ecaa16f298dfd45493e6a5db9257 100644 (file)
 #=======================================================================
 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})
index 26a071e8fa1179a765dadaf9374f244071bf9a5b..5640b070a0c981ca7cdfd17d8ce2f3acc68146dc 100644 (file)
@@ -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 "<<directorypath<<std::endl;
-                       }else if(CreateDirectory(directorypath, NULL) == ERROR_PATH_NOT_FOUND){
+                       }else if(CreateDirectory(directorypath2, NULL) == ERROR_PATH_NOT_FOUND){
+//                     }else if(CreateDirectory(directorypath, NULL) == ERROR_PATH_NOT_FOUND){
                                std::string error = "Directory could not be created ";
                                error.append(directorypath);
                                throw error.c_str();