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