]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseWxWidgets.cmake
#3386 merge vtk8itk5wx3-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     message("EED CREAMacro_FindAndUseWxWidgets APPLE.  forsing wxWidgets_CONFIG_EXECUTABLE.   wxWidgets_wxrc_EXECUTABLE ")
63   SET(wxWidgets_CONFIG_EXECUTABLE  /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wx-config CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE)
64         SET(wxWidgets_wxrc_EXECUTABLE   /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wxrc-3.0 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE)
65  elseif(APPLE)
66             message("EED CREAMacro_FindAndUseWxWidgets UNIX")
67                 #MESSAGE ( "===============Manual wx-config 2 EED =======================")
68                 #SET(wxWidgets_CONFIG_EXECUTABLE /usr/bin/wx-config-2.0 CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE)
69                 #SET(wxWidgets_wxrc_EXECUTABLE /usr/bin/wxrc-2.8 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE)
70       SET(wxWidgets_CONFIG_EXECUTABLE /usr/bin/wx-config-3.0 CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE)
71           SET(wxWidgets_wxrc_EXECUTABLE /usr/bin/wxrc-3.0 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE)
72         # CMake 2.6:
73         # technically those packages are not required 
74         # since one can still use the Motif/X11 version and not the gtk one:
75       FIND_PACKAGE(PkgConfig REQUIRED)
76         ##    pkg_check_modules (GTK2 gtk+-2.0)
77         ##    pkg_check_modules (GTK322 gtk+-3.0)
78       pkg_check_modules (GTK3 REQUIRED gtk+-3.0)
79 endif(APPLE)
80
81       # Can I require all my user to have the gl lib on linux, even if they do not really need it...
82       SET(WXGLCANVASLIBS "gl")    
83
84       SET(WXAUILIBS "aui")
85       # LG : These options should be set by the user at top level of crea
86       FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS base core adv html
87       ${WXAUILIBS}
88       ${WXGLCANVASLIBS}
89     )
90     IF(wxWidgets_FOUND)
91       MESSAGE ( STATUS "=======================================")
92       MESSAGE ( STATUS "Looking for wxWidgets... found ${wxWidgets_CONFIG_EXECUTABLE}")
93     ENDIF(wxWidgets_FOUND)
94     
95   ENDIF(WIN32)
96   
97 ENDMACRO(CREA_FIND_WXWIDGETS)
98 #=======================================================================
99
100 #=======================================================================
101 MACRO(CREA_USE_WXWIDGETS)
102   # Preprocessor settings
103   CREA_DEFINE( USE_WXWIDGETS )
104   CREA_DEFINE( _USE_WXWIDGETS_ )
105  
106  #
107   IF(WIN32)
108 #    # Clean ?
109 #    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WXWIDGETS_CXX_FLAGS}")
110 #    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}${WXWIDGETS_EXE_LINKER_FLAGS}")
111 #    #
112 #    ADD_DEFINITIONS( ${WXWIDGETS_DEFINITIONS}  )
113 #    #
114 #    INCLUDE_DIRECTORIES(${WXWIDGETS_INCLUDE_DIR})
115 #    LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} )
116 #    SET(WXWIDGETS_LIBRARIES
117 #      ${WXWIDGETS_LIBRARIES}  
118 ##DO NOT FORCE DEBUG LIBS !!
119 #      debug wxmsw28d_aui
120 #      optimized wxmsw28_aui
121 #      debug msvcrtd
122 #      debug msvcprtd
123 #      optimized msvcrt
124 #      optimized msvcprt
125 #      )
126           
127         include(${wxWidgets_USE_FILE})
128         
129         SET(WXWIDGETS_LIBRARIES ${wxWidgets_LIBRARIES}   
130                     "${wxWidgets_LIB_DIR}/libwxmsw30u_aui.a"   
131                                 "${wxWidgets_LIB_DIR}/libwxmsw30u_webview.a"    
132                                 "${wxWidgets_LIB_DIR}/libwxmsw30u_html.a"   
133                                 "${wxWidgets_LIB_DIR}/libwxmsw30u_adv.a" )        
134   ELSE(WIN32)
135   
136
137     IF(APPLE)
138     ELSEIF(APPLE)
139                 ##    # GTK2
140                 ##    INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
141                 ##    LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
142                 ##    LINK_LIBRARIES(${GTK2_LIBRARIES})
143         # GTK3
144         INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
145         LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
146         LINK_LIBRARIES(${GTK3_LIBRARIES} )
147         message("EED GTK3_VERSION "${GTK3_VERSION})
148         # WX
149                 #    INCLUDE( ${GTK_USE_FILE} )
150         INCLUDE( ${wxWidgets_USE_FILE} )
151         MARK_AS_ADVANCED(wxWidgets_CONFIG_EXECUTABLE)
152         SET(WXWIDGETS_LIBRARIES
153                         ##    GTK2
154                         ##      ${GTK2_LIBRARIES}
155                 ${GTK3_LIBRARIES}
156                 #${GTK_LIBRARIES}
157             ${wxWidgets_LIBRARIES}      
158                 )
159     ENDIF(APPLE)
160
161   ENDIF(WIN32)
162 ENDMACRO(CREA_USE_WXWIDGETS)
163 #=======================================================================
164
165 #=======================================================================
166 MACRO(CREA_FIND_AND_USE_WXWIDGETS)
167   CREA_FIND_WXWIDGETS()
168   CREA_USE_WXWIDGETS()
169 ENDMACRO(CREA_FIND_AND_USE_WXWIDGETS)
170 #=======================================================================