]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseWxWidgets.cmake
#3214 creaFeature New Normal - vtk8itk4wx3-mingw64
[crea.git] / cmake / CREAMacro_FindAndUseWxWidgets.cmake
1 # ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
4 #                        pour la Santé)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and 
10 #  abiding by the rules of distribution of free software. You can  use, 
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
12 #  license as circulated by CEA, CNRS and INRIA at the following URL 
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability. 
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */ 
25
26
27 #=======================================================================
28 # Looks for WxWidgets
29 #=======================================================================
30 MACRO(CREA_FIND_WXWIDGETS)
31   IF(WIN32)
32 #    # Search WXWIDGETS   
33 #    #  WXWINDOWS_LIBRARY         = full path to the wxWindows library and linker flags on unix
34 #    #  CMAKE_WX_CXX_FLAGS        = compiler flags for building wxWindows 
35 #    #  WXWINDOWS_INCLUDE_PATH    = include path of wxWindows
36 #    SET(WXWINDOWS_USE_GL 1)
37 #    #wxWidgets build related stuff
38 #    # DO NOT FORCE DEBUG LIBS !!
39 #    SET(WXW_USE_DEBUG OFF)
40 #    SET(WXW_USE_UNICODE OFF)
41 #    SET(WXW_USE_SHARED ON)
42 #    SET(WXW_USE_UNIV OFF)
43 #    SET(WXW_USE_MONO OFF)
44 #    SET(WXW_FILE_VERSION "28")
45 #    SET(WXW_VERSION "2.8")
46 #    #CMake Options
47 #    # Why forcing verbosity ?
48 #    # SET(CMAKE_VERBOSE_MAKEFILE TRUE)
49 #    INCLUDE (${CREA_CMAKE_DIR}/FindWxWidgetsWin32.cmake)
50 #    #
51   
52 #       find_package(wxwidgets REQUIRED COMPONENTS base core advanced adv html xml aui)
53         find_package(wxwidgets REQUIRED  )
54
55   
56   ELSE(WIN32)
57
58           MESSAGE ( "===============Manual wx-config 3 EED =======================")
59
60 ##2018-08-28      
61 if(APPLE)
62       SET(wxWidgets_CONFIG_EXECUTABLE /usr/bin/wx-config-3.0 CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE)
63           SET(wxWidgets_wxrc_EXECUTABLE /usr/bin/wxrc-3.0 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE)
64 elseif(UNIX)
65       SET(wxWidgets_CONFIG_EXECUTABLE /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/3.0/bin/wx-config CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE)
66           SET(wxWidgets_wxrc_EXECUTABLE /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/3.0/bin/wxrc-3.0 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE)
67 endif()
68
69
70 #      MESSAGE ( "===============Manual wx-config 2 EED =======================")
71 #      SET(wxWidgets_CONFIG_EXECUTABLE /usr/bin/wx-config-2.0 CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE)
72 #         SET(wxWidgets_wxrc_EXECUTABLE /usr/bin/wxrc-2.8 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE)
73
74     IF(NOT wxWidgets_FOUND)
75     # CMake 2.6:
76     # technically those packages are not required 
77     # since one can still use the Motif/X11 version and not the gtk one:
78     FIND_PACKAGE(PkgConfig REQUIRED)
79
80 ##    pkg_check_modules (GTK2 gtk+-2.0)
81 ##    pkg_check_modules (GTK322 gtk+-3.0)
82     pkg_check_modules (GTK3 REQUIRED gtk+-3.0)
83     #MESSAGE("${GTK3_INCLUDE_DIRS}")
84
85     # Can I require all my user to have the gl lib on linux, even if they do not really need it...
86     SET(WXGLCANVASLIBS "gl")
87   
88     SET(WXAUILIBS "aui")
89     # LG : These options should be set by the user at top level of crea
90     FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS base core adv html
91       ${WXAUILIBS}
92       ${WXGLCANVASLIBS})
93     #
94     IF(wxWidgets_FOUND)
95       MESSAGE ( STATUS "=======================================")
96       MESSAGE ( STATUS "Looking for wxWidgets... found ${wxWidgets_CONFIG_EXECUTABLE}")
97
98     ENDIF(wxWidgets_FOUND)
99     ENDIF(NOT wxWidgets_FOUND)
100   ENDIF(WIN32)
101   
102 MESSAGE ( "EEEE")
103
104
105 ENDMACRO(CREA_FIND_WXWIDGETS)
106 #=======================================================================
107
108 #=======================================================================
109 MACRO(CREA_USE_WXWIDGETS)
110   # Preprocessor settings
111   CREA_DEFINE( USE_WXWIDGETS )
112   CREA_DEFINE( _USE_WXWIDGETS_ )
113  
114  #
115   IF(WIN32)
116 #    # Clean ?
117 #    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WXWIDGETS_CXX_FLAGS}")
118 #    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}${WXWIDGETS_EXE_LINKER_FLAGS}")
119 #    #
120 #    ADD_DEFINITIONS( ${WXWIDGETS_DEFINITIONS}  )
121 #    #
122 #    INCLUDE_DIRECTORIES(${WXWIDGETS_INCLUDE_DIR})
123 #    LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} )
124 #    SET(WXWIDGETS_LIBRARIES
125 #      ${WXWIDGETS_LIBRARIES}  
126 ##DO NOT FORCE DEBUG LIBS !!
127 #      debug wxmsw28d_aui
128 #      optimized wxmsw28_aui
129 #      debug msvcrtd
130 #      debug msvcprtd
131 #      optimized msvcrt
132 #      optimized msvcprt
133 #      )
134           
135         include(${wxWidgets_USE_FILE})
136         
137         SET(WXWIDGETS_LIBRARIES ${wxWidgets_LIBRARIES}   
138                     "${wxWidgets_LIB_DIR}/libwxmsw30u_aui.a"   
139                                 "${wxWidgets_LIB_DIR}/libwxmsw30u_webview.a"    
140                                 "${wxWidgets_LIB_DIR}/libwxmsw30u_html.a"   
141                                 "${wxWidgets_LIB_DIR}/libwxmsw30u_adv.a" )        
142   ELSE(WIN32)
143   
144   
145 ##    # GTK2
146 ##    INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
147 ##    LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
148 ##    LINK_LIBRARIES(${GTK2_LIBRARIES})
149     # GTK3
150     INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
151     LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
152     LINK_LIBRARIES(${GTK3_LIBRARIES} )
153     # WX
154
155 #    INCLUDE( ${GTK_USE_FILE} )
156     INCLUDE( ${wxWidgets_USE_FILE} )
157     MARK_AS_ADVANCED(wxWidgets_CONFIG_EXECUTABLE)
158
159     SET(WXWIDGETS_LIBRARIES
160 ##    GTK2
161 ##      ${GTK2_LIBRARIES}
162       ${GTK3_LIBRARIES}
163       #${GTK_LIBRARIES}
164       ${wxWidgets_LIBRARIES}      
165       )
166
167   ENDIF(WIN32)
168 ENDMACRO(CREA_USE_WXWIDGETS)
169 #=======================================================================
170
171 #=======================================================================
172 MACRO(CREA_FIND_AND_USE_WXWIDGETS)
173   CREA_FIND_WXWIDGETS()
174   CREA_USE_WXWIDGETS()
175 ENDMACRO(CREA_FIND_AND_USE_WXWIDGETS)
176 #=======================================================================