blob: cf80f6331d0f7b0510800c1dd562c5a1a090bba2 [file] [log] [blame] [edit]
--- a/CMakeModules/FindwxWidgets.cmake
+++ b/CMakeModules/FindwxWidgets.cmake
@@ -220,7 +220,7 @@ endif()
#=====================================================================
# Determine whether unix or win32 paths should be used
#=====================================================================
-if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_HOST_UNIX )
+if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_HOST_UNIX AND NOT MINGW)
set(wxWidgets_FIND_STYLE "win32")
else()
set(wxWidgets_FIND_STYLE "unix")
@@ -231,7 +231,11 @@ endif()
#=====================================================================
if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Useful common wx libs needed by almost all components.
- set(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
+ if(VCPKG_TOOLCHAIN)
+ set(wxWidgets_COMMON_LIBRARIES libpng16 tiff jpeg zlib libexpat)
+ else()
+ set(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
+ endif()
# DEPRECATED: Use find_package(wxWidgets COMPONENTS mono) instead.
if(NOT wxWidgets_FIND_COMPONENTS)
@@ -282,6 +286,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
NAMES
wx${LIB}${_UCD}${_DBG} # for regex
wx${LIB}${_DBG}
+ ${LIB}${_DBG} # vcpkg libraries aren't specific to wx
PATHS ${WX_LIB_DIR}
NO_DEFAULT_PATH
)
@@ -509,41 +514,111 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
else()
set(WX_LIB_DIR_PREFIX vc)
endif()
+
+ if(VCPKG_TOOLCHAIN)
+ set(wxWidgets_FOUND TRUE)
+ find_path(wxWidgets_ROOT_DIR
+ NAMES include/wx/wx.h
+ PATHS
+ ENV wxWidgets_ROOT_DIR
+ DOC "wxWidgets base/installation directory"
+ )
+ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(wxWidgets_LIB_DIR ${wxWidgets_ROOT_DIR}/debug/lib)
+ set(wxWidgets_CONFIGURATION mswud)
+ else()
+ set(wxWidgets_LIB_DIR ${wxWidgets_ROOT_DIR}/lib)
+ set(wxWidgets_CONFIGURATION mswu)
+ endif()
+
+ set(wxWidgets_BIN_DIR ${wxWidgets_ROOT_DIR}/bin)
+ set(wxWidgets_INCLUDE_DIR ${wxWidgets_ROOT_DIR}/include)
+ file(GLOB DLL ${wxWidgets_BIN_DIR}/wxmsw*.dll)
+ if (DLL)
+ set(wxWidgets_DEFINITIONS WXUSINGDLL)
+ DBG_MSG_V("detected SHARED/DLL tree wxWidgets_LIB_DIR=${wxWidgets_LIB_DIR}")
+ endif ()
+ set(WX_ROOT_DIR ${wxWidgets_ROOT_DIR})
+ set(WX_LIB_DIR ${wxWidgets_LIB_DIR}) # needed by macro
+ set(WX_CONFIGURATION_LIST ${wxWidgets_CONFIGURATION})
+
+ # Set wxWidgets lib setup include directory.
+ if (EXISTS ${wxWidgets_INCLUDE_DIR}/wx/setup.h)
+ set(wxWidgets_INCLUDE_DIRS ${wxWidgets_INCLUDE_DIR})
+ else ()
+ DBG_MSG("wxWidgets_FOUND FALSE because ${wxWidgets_INCLUDE_DIR}/wx/setup.h does not exists.")
+ set(wxWidgets_FOUND FALSE)
+ endif ()
+
+ # Set wxWidgets main include directory.
+ if (EXISTS ${wxWidgets_ROOT_DIR}/include/wx/wx.h)
+ list(APPEND wxWidgets_INCLUDE_DIRS ${wxWidgets_ROOT_DIR}/include)
+ else ()
+ DBG_MSG("wxWidgets_FOUND FALSE because wxWidgets_ROOT_DIR=${wxWidgets_ROOT_DIR} has no ${wxWidgets_ROOT_DIR}/include/wx/wx.h")
+ set(wxWidgets_FOUND FALSE)
+ endif ()
+
+ DBG_MSG_V("WX_CONFIGURATION_LIST=${WX_CONFIGURATION_LIST}")
+
+
+ # Get configuration parameters from the name.
+ WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG)
+
+
+ # Find wxWidgets libraries.
+ WX_FIND_LIBS("${UNV}" "${UCD}" "${DBG}")
+ if (WX_USE_REL_AND_DBG)
+ WX_FIND_LIBS("${UNV}" "${UCD}" "d")
+ endif ()
+
+ # Settings for requested libs (i.e., include dir, libraries, etc.).
+ WX_SET_LIBRARIES(wxWidgets_FIND_COMPONENTS "${DBG}")
+
+ # Add necessary definitions for unicode builds
+ if ("${UCD}" STREQUAL "u")
+ list(APPEND wxWidgets_DEFINITIONS UNICODE _UNICODE)
+ endif ()
+
+ # Add necessary definitions for debug builds
+ set(wxWidgets_DEFINITIONS_DEBUG _DEBUG __WXDEBUG__)
+
+ else()
if(BUILD_SHARED_LIBS)
find_path(wxWidgets_LIB_DIR
- NAMES
- msw/wx/setup.h
- mswd/wx/setup.h
- mswu/wx/setup.h
- mswud/wx/setup.h
- mswuniv/wx/setup.h
- mswunivd/wx/setup.h
- mswunivu/wx/setup.h
- mswunivud/wx/setup.h
- PATHS
- ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll # prefer shared
- ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib
- DOC "Path to wxWidgets libraries"
- NO_DEFAULT_PATH
- )
+ NAMES
+ msw/wx/setup.h
+ mswd/wx/setup.h
+ mswu/wx/setup.h
+ mswud/wx/setup.h
+ mswuniv/wx/setup.h
+ mswunivd/wx/setup.h
+ mswunivu/wx/setup.h
+ mswunivud/wx/setup.h
+ PATHS
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll # prefer shared
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib
+ DOC "Path to wxWidgets libraries"
+ NO_DEFAULT_PATH
+ )
else()
find_path(wxWidgets_LIB_DIR
- NAMES
- msw/wx/setup.h
- mswd/wx/setup.h
- mswu/wx/setup.h
- mswud/wx/setup.h
- mswuniv/wx/setup.h
- mswunivd/wx/setup.h
- mswunivu/wx/setup.h
- mswunivud/wx/setup.h
- PATHS
- ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib # prefer static
- ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll
- DOC "Path to wxWidgets libraries"
- NO_DEFAULT_PATH
- )
+ NAMES
+ msw/wx/setup.h
+ mswd/wx/setup.h
+ mswu/wx/setup.h
+ mswud/wx/setup.h
+ mswuniv/wx/setup.h
+ mswunivd/wx/setup.h
+ mswunivu/wx/setup.h
+ mswunivud/wx/setup.h
+ PATHS
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib # prefer static
+ ${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll
+ DOC "Path to wxWidgets libraries"
+ NO_DEFAULT_PATH
+ )
endif()
+ endif()
# If wxWidgets_LIB_DIR changed, clear all libraries.
if(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR)
@@ -842,7 +917,7 @@ else()
# When using wx-config in MSYS, the include paths are UNIX style paths which may or may
# not work correctly depending on you MSYS/MinGW configuration. CMake expects native
# paths internally.
- if(wxWidgets_FOUND AND MSYS)
+ if(wxWidgets_FOUND AND (MSYS OR MINGW))
find_program(_cygpath_exe cygpath ONLY_CMAKE_FIND_ROOT_PATH)
DBG_MSG_V("_cygpath_exe: ${_cygpath_exe}")
if(_cygpath_exe)
--