diff options
author | Jorgen Bodde <jorgb@xs4all.nl> | 2005-06-30 19:54:59 (GMT) |
---|---|---|
committer | Jorgen Bodde <jorgb@xs4all.nl> | 2005-06-30 19:54:59 (GMT) |
commit | 6a1de7f5ad2f684fdf8bfdea2a3ad982387e9a27 (patch) | |
tree | 496a106d3faf5f09d364536d7d6e64c5449d47d3 /Source/WXDialog | |
parent | 8c28e4e9f0b82ec96b4b68c370a8fc50333b093c (diff) | |
download | CMake-6a1de7f5ad2f684fdf8bfdea2a3ad982387e9a27.zip CMake-6a1de7f5ad2f684fdf8bfdea2a3ad982387e9a27.tar.gz CMake-6a1de7f5ad2f684fdf8bfdea2a3ad982387e9a27.tar.bz2 |
initial checkin for bin dir
Diffstat (limited to 'Source/WXDialog')
-rw-r--r-- | Source/WXDialog/bin/FindUPX.cmake | 21 | ||||
-rw-r--r-- | Source/WXDialog/bin/FindwxW.cmake | 434 | ||||
-rw-r--r-- | Source/WXDialog/bin/FindwxWin.cmake | 440 | ||||
-rw-r--r-- | Source/WXDialog/bin/UsewxW.cmake | 76 |
4 files changed, 971 insertions, 0 deletions
diff --git a/Source/WXDialog/bin/FindUPX.cmake b/Source/WXDialog/bin/FindUPX.cmake new file mode 100644 index 0000000..7623841 --- /dev/null +++ b/Source/WXDialog/bin/FindUPX.cmake @@ -0,0 +1,21 @@ +# +# Find the UPX packer program +# +# UPX_PROGRAM_PATH The full path to the UPX command (or UPX_PROGRAM_PATH-NOTFOUND when not found) +# UPX_FOUND Is set to 1 when upx is found + +FIND_PATH(UPX_PROGRAM_PATH upx.exe + "c:\Program Files\upx" + "d:\Program Files\upx" + "e:\Program Files\upx" + "f:\Program Files\upx" + "g:\Program Files\upx" + "h:\Program Files\upx" + ) + +# when found, note this as target +IF(UPX_PROGRAM_PATH) + SET(UPX_FOUND 1) +ELSE(UPX_PROGRAM_PATH) + SET(UPX_FOUND 0) +ENDIF(UPX_PROGRAM_PATH) diff --git a/Source/WXDialog/bin/FindwxW.cmake b/Source/WXDialog/bin/FindwxW.cmake new file mode 100644 index 0000000..230bba8 --- /dev/null +++ b/Source/WXDialog/bin/FindwxW.cmake @@ -0,0 +1,434 @@ +# +# FindwxW.cmake +# v1.01 2005-05-27 +# Jerry Fath 2005 +# Based on work by Jorgen Bodde +# +# This module finds if wxWindows is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# WXWIDGETS_LINK_DIRECTORIES = link directories, useful for rpath on Unix +# WXWIDGETS_LIBRARIES = all the wxWindows libraries ( and linker flags on unix ) +# WXWIDGETS_CXX_FLAGS = compiler flags for building wxWindows +# WXWIDGETS_INCLUDE_DIR = all include path of wxWindows +# WXWIDGETS_DEFINITIONS = all flags of wxWindows + +# NOTE: This module REQUIRES that an environment variable named WXWIN +# be set to the base wxWidgets installation directory. +# Under Unix, you must also set and environment variable named WXWINCFG +# to the name of the active build subdirectory (eg buildgtk). +# + +# These variable should be set before including this module +# +# WXWIDGETS_FILE_VERSION (26) +# WXWIDGETS_VERSION (2.6) +# + +# +# Set WX_USE vars in CMakeLists if you don't want to default to all off +# +SET(WXWIDGETS_USE_DEBUG ${WXW_USE_DEBUG} CACHE BOOL "Use Debug versions of wxWindows libraries") +SET(WXWIDGETS_USE_UNICODE ${WXW_USE_UNICODE} CACHE BOOL "Use Unicode versions of wxWindows libraries") +SET(WXWIDGETS_USE_SHARED ${WXW_USE_SHARED} CACHE BOOL "Use shared versions of wxWindows libraries") +SET(WXWIDGETS_USE_UNIV ${WXW_USE_UNIV} CACHE BOOL "Use Universal versions of wxWindows libraries") +SET(WXWIDGETS_USE_MONO ${WXW_USE_MONO} CACHE BOOL "Use monolithic versions of wxWindows libraries") + +# +# Style can be non-Win32 even under Windows when using MinGW +# +IF(WIN32) + SET(WIN32_STYLE_FIND 1) +ENDIF(WIN32) +IF(MINGW) + SET(WIN32_STYLE_FIND 0) + SET(UNIX_STYLE_FIND 1) +ENDIF(MINGW) +IF(UNIX) + SET(UNIX_STYLE_FIND 1) +ENDIF(UNIX) + +# +# Versions should be set before this file is included. If not, +# default to 2.6 +# +IF(WXW_FILE_VERSION) + SET( WXVERSIONSUFFIX ${WXW_FILE_VERSION}) +ELSE(WXW_FILE_VERSION) + SET( WXVERSIONSUFFIX "26") +ENDIF(WXW_FILE_VERSION) + +IF(WXW_VERSION) + SET( WXVERSION ${WXW_VERSION}) +ELSE(WXW_VERSION) + SET( WXVERSION "2.6") +ENDIF(WXW_VERSION) + +# +# Find the base wxWidgets install path +# NOTE: WXWIN must be set +# +FIND_PATH( WXWIDGETS_INSTALL_PATH + wx-config.in + $ENV{WXWIN} +) +IF(WXWIDGETS_INSTALL_PATH STREQUAL "WXWIDGETS_INSTALL_PATH-NOTFOUND") + MESSAGE( FATAL_ERROR "FATAL_ERROR: wx-config.in NOT found. Set WXWIN") +ENDIF(WXWIDGETS_INSTALL_PATH STREQUAL "WXWIDGETS_INSTALL_PATH-NOTFOUND") +SET(WXWIDGETS_CONFIG_PATH ${WXWIDGETS_INSTALL_PATH}) + +# +# Find library path (platform specific) +# +IF( WIN32_STYLE_FIND ) + + IF( WXWIDGETS_USE_SHARED ) + SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_INSTALL_PATH}/lib/vc_dll" ) + ELSE( WXWIDGETS_USE_SHARED ) + SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_INSTALL_PATH}/lib/vc_lib" ) + ENDIF( WXWIDGETS_USE_SHARED ) + SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} ) + +ELSE( WIN32_STYLE_FIND ) + IF (UNIX_STYLE_FIND) + + # + # Unix uses a config specific directory under the install path + # specified in the WXWINCFG environment variable. + # + SET(WXWIDGETS_CONFIG_PATH "${WXWIDGETS_INSTALL_PATH}/$ENV{WXWINCFG}") + + # + # Check wether wx-config can be found + # + SET(WX_WXCONFIG_EXECUTABLE "${WXWIDGETS_CONFIG_PATH}/wx-config" ) + IF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE}) + # we really need wx-config... + MESSAGE(FATAL_ERROR "FATAL_ERROR: Cannot find wx-config. Set WXWIN and WXWINCFG environment variables.") + ENDIF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE}) + + SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_CONFIG_PATH}/lib" ) + SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} ) + + ELSE(UNIX_STYLE_FIND) + MESSAGE(FATAL_ERROR "FATAL_ERROR: FindwxWindows.cmake: Platform unsupported by FindwxW.cmake. It's neither WIN32 nor UNIX") + ENDIF(UNIX_STYLE_FIND) +ENDIF( WIN32_STYLE_FIND ) + +# +# Check options against installed libraries +# +SET(WX_CONFIG_ARGS "") +SET( LIBRARYWANT "${WXWIDGETS_LIB_PATH}/msw" ) + +IF( WXWIDGETS_USE_UNIV ) + SET( LIBRARYWANT "${LIBRARYWANT}univ") + SET( PFUNIV "univ" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=yes") +ELSE( WXWIDGETS_USE_UNIV ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=no") +ENDIF( WXWIDGETS_USE_UNIV ) + +IF( WXWIDGETS_USE_UNICODE ) + SET( LIBRARYWANT "${LIBRARYWANT}u" ) + SET( PFUNICODE "u" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=yes") +ELSE( WXWIDGETS_USE_UNICODE ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=no") +ENDIF( WXWIDGETS_USE_UNICODE ) + +IF( WXWIDGETS_USE_DEBUG ) + SET( LIBRARYWANT "${LIBRARYWANT}d" ) + SET( PFDEBUG "d" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=yes") +ELSE( WXWIDGETS_USE_DEBUG ) + SET( PFDEBUG "" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=no") +ENDIF( WXWIDGETS_USE_DEBUG ) + +IF( WXWIDGETS_USE_SHARED ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=no") +ELSE( WXWIDGETS_USE_SHARED ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=yes") +ENDIF( WXWIDGETS_USE_SHARED ) + +# Not sure how to check this yet!!!!! +IF( WXWIDGETS_USE_MONO ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}") +ELSE( WXWIDGETS_USE_MONO ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}") +ENDIF( WXWIDGETS_USE_MONO ) + +SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS} --libs") + +# +# Platform specific method for testing installed wx Builds +# +IF( WIN32_STYLE_FIND ) + + IF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" ) + MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}") + ENDIF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" ) + +ELSE( WIN32_STYLE_FIND ) + + EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE} + ARGS ${WX_CONFIG_ARGS_LIBS} + OUTPUT_VARIABLE WXWIDGETS_LIBRARIES + RETURN_VALUE BAD_WXCONFIG ) + IF(BAD_WXCONFIG) + MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}") + ENDIF(BAD_WXCONFIG) + +ENDIF( WIN32_STYLE_FIND ) + +# +# Get compiler flags +# +IF( WIN32_STYLE_FIND ) + # Not used for Windows + SET( WXWIDGETS_CXX_FLAGS "" ) +ELSE( WIN32_STYLE_FIND ) + # + # Get CXXFLAGS from wx-config + # + EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE} + ARGS "--cxxflags" + OUTPUT_VARIABLE WXWIDGETS_CXX_FLAGS + RETURN_VALUE BAD_WXCONFIG ) + IF (BAD_WXCONFIG) + MESSAGE( SEND_ERROR "ERROR: wx-config --cxxflags returned an error") + ENDIF (BAD_WXCONFIG) +ENDIF( WIN32_STYLE_FIND ) + +# +# Find include directories (platform specific) +# +IF( WIN32_STYLE_FIND ) + # + # Set non-build specific include directories + # + SET ( WX_INCLUDE_PATH ${WXWIDGETS_INSTALL_PATH}/include ) + SET ( WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_PATH} ) + SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${WXWIDGETS_INCLUDE_DIR}/../contrib/include ) + # + # Append the build specific include dir for wx/setup.h: + # + IF ( EXISTS ${LIBRARYWANT}/wx/setup.h ) + SET( WX_INCLUDE_LIB_PATH ${LIBRARYWANT}) + SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${LIBRARYWANT} ) + ELSE ( EXISTS ${LIBRARYWANT}/wx/setup.h ) + SET( WX_INCLUDE_LIB_PATH, "") + MESSAGE(SEND_ERROR "ERROR: Can't find ${LIBRARYWANT}/wx/setup.h") + ENDIF ( EXISTS ${LIBRARYWANT}/wx/setup.h ) +ELSE( WIN32_STYLE_FIND ) + + # Pull out -I options + # evaluate wx-config output to separate include dirs + SET(WX_INCLUDE_DIR ${WXWIDGETS_CXX_FLAGS}) + # extract include dirs (-I) + # use regular expression to match wildcard equivalent "-I*<endchar>" + # with <endchar> is a space or a semicolon + STRING(REGEX MATCHALL "[-][I]([^ ;])+" WX_INCLUDE_DIRS_WITH_PREFIX "${WX_INCLUDE_DIR}" ) + # remove prefix -I because we need the pure directory + IF(WX_INCLUDE_DIRS_WITH_PREFIX) + STRING(REGEX REPLACE "[-][I]" ";" WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_DIRS_WITH_PREFIX} ) + ENDIF(WX_INCLUDE_DIRS_WITH_PREFIX) + # replace space separated string by semicolon separated vector + SEPARATE_ARGUMENTS(WXWIDGETS_INCLUDE_DIR) + # Remove the -I options from the CXX_FLAGS no need to duplicate + STRING(REGEX REPLACE "[-][I]([^ ;])+" "" WXWIDGETS_CXX_FLAGS ${WXWIDGETS_CXX_FLAGS} ) + + # + # Find XWindows + # + IF( NOT CYGWIN OR MINGW ) + INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake ) + SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${X11_INCLUDE_DIR} ) + ENDIF( NOT CYGWIN OR MINGW ) +ENDIF( WIN32_STYLE_FIND ) + +# +# Find library list (platform specific) +# +IF( WIN32_STYLE_FIND ) + # + #Misc vars used to build lib names + # + SET( PFLIBEXT ${CMAKE_STATIC_LIBRARY_SUFFIX} ) + SET( WXPF "${WXPF}${WXVERSIONSUFFIX}" ) + SET( PFVERSION ${WXVERSIONSUFFIX} ) + SET( PFCOMPILER "" ) + + # + # Build the libraries list + # + SET( WXWIDGETS_LIBRARIES "" ) + SET( WXWIDGETS_MULTI_LIBRARIES "" ) + SET( WXWIDGETS_MONO_LIBRARIES "" ) + + SET(WX_LIBRARIES ${WX_LIBRARIES} comctl32${PFLIBEXT} wsock32${PFLIBEXT} rpcrt4${PFLIBEXT}) + #MESSAGE( "WX_LIBRARIES: ${WX_LIBRARIES}") + + #start filling library string with needed libraries for the choosen configuration. + SET( WXWIDGETS_LIBRARIES ${WXWIDGETS_LIBRARIES} ${WX_LIBRARIES} ) + + SET( WXPF "${PFVERSION}${PFUNICODE}${PFDEBUG}" ) + SET(WXWIDGETS_MULTI_LIBRARIES ${WXWIDGETS_MULTI_LIBRARIES} + wxbase${WXPF}${PFCOMPILER}${PFLIBEXT} + wxbase${WXPF}_net${PFCOMPILER}${PFLIBEXT} wxbase${WXPF}_xml${PFCOMPILER}${PFLIBEXT} + ) + + SET( WXPF "${PFVERSION}${PFUNICODE}${PFDEBUG}" ) + SET(WXWIDGETS_MULTI_LIBRARIES ${WXWIDGETS_MULTI_LIBRARIES} + wxmsw${WXPF}_adv${PFCOMPILER}${PFLIBEXT} + wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT} + wxmsw${WXPF}_html${PFCOMPILER}${PFLIBEXT} + wxmsw${WXPF}_xrc${PFCOMPILER}${PFLIBEXT} +# wxmsw${WXPF}_media${PFCOMPILER}${PFLIBEXT} + ) + + IF( NOT WXWIDGETS_USE_SHARED ) + SET( WXPF "${PFVERSION}${PFUNICODE}${PFDEBUG}" ) + # ODBC is not needed + #SET(WXWIDGETS_MULTI_LIBRARIES ${WXWIDGETS_MULTI_LIBRARIES} wxbase${WXPF}_odbc${PFCOMPILER}${PFLIBEXT} ) + + SET( WXPF "${PFVERSION}${PFUNICODE}${PFDEBUG}" ) + #SET(WXWIDGETS_MULTI_LIBRARIES ${WXWIDGETS_MULTI_LIBRARIES} + # wxmsw${WXPF}_dbgrid${PFLIBEXT} + # wxmsw${WXPF}_gl${PFCOMPILER}${PFLIBEXT} + #) + ENDIF( NOT WXWIDGETS_USE_SHARED ) + + IF ( WXWIDGETS_USE_UNIV ) + SET( WXPF "${PFUNIV}${PFVERSION}${PFUNICODE}${PFDEBUG}" ) + SET(WXWIDGETS_MULTI_LIBRARIES ${WXWIDGETS_MULTI_LIBRARIES} + wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT} + ) + ENDIF ( WXWIDGETS_USE_UNIV ) + + SET(WXWIDGETS_MONO_LIBRARIES ${WXWIDGETS_MONO_LIBRARIES} + wxmsw${WXPF}${PFCOMPILER}${PFLIBEXT} + ) + + IF ( WXWIDGETS_USE_MONO ) + SET(WXWIDGETS_LIBRARIES ${WXWIDGETS_LIBRARIES} ${WXWIDGETS_MONO_LIBRARIES}) + ELSE ( WXWIDGETS_USE_MONO ) + SET(WXWIDGETS_LIBRARIES ${WXWIDGETS_LIBRARIES} ${WXWIDGETS_MULTI_LIBRARIES}) + ENDIF ( WXWIDGETS_USE_MONO ) + + SET( WXPF "${PFUNICODE}${PFDEBUG}" ) + SET(WXWIDGETS_LIBRARIES ${WXWIDGETS_LIBRARIES} + wxregex${WXPF}.lib + ) + + SET( WXPF "${PFDEBUG}" ) + SET(WXWIDGETS_LIBRARIES ${WXWIDGETS_LIBRARIES} + wxexpat${WXPF}.lib + wxpng${WXPF}.lib + wxtiff${WXPF}.lib + wxjpeg${WXPF}.lib + wxzlib${WXPF}.lib + ) + +ELSE( WIN32_STYLE_FIND ) + # + # Get Library list from wx-config + # + # do we need additionial wx GL stuff like GLCanvas ? + IF(WXWIDGETS_USE_GL) + SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" ) + ENDIF(WXWIDGETS_USE_GL) + + EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE} + ARGS ${WX_CONFIG_ARGS_LIBS} + OUTPUT_VARIABLE WXWIDGETS_LIBRARIES + RETURN_VALUE BAD_WXCONFIG ) + IF (BAD_WXCONFIG) + MESSAGE( SEND_ERROR "ERROR: Specified WXWidgets config NOT found") + ENDIF (BAD_WXCONFIG) + + # Pull out the -L options + # evaluate wx-config output to separate linker flags and linkdirs for + # rpath: + SET(WX_CONFIG_LIBS ${WXWIDGETS_LIBRARIES}) + # extract linkdirs (-L) for rpath + # use regular expression to match wildcard equivalent "-L*<endchar>" + # with <endchar> is a space or a semicolon + STRING(REGEX MATCHALL "[-][L]([^ ;])+" WX_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" ) + #MESSAGE("DBG WX_LINK_DIRECTORIES_WITH_PREFIX=${WX_LINK_DIRECTORIES_WITH_PREFIX}") + # remove prefix -L because we need the pure directory for LINK_DIRECTORIES + # replace -L by ; because the separator seems to be lost otherwise (bug or + # feature?) + IF(WX_LINK_DIRECTORIES_WITH_PREFIX) + STRING(REGEX REPLACE "[-][L]" ";" WXWIDGETS_LINK_DIRECTORIES ${WX_LINK_DIRECTORIES_WITH_PREFIX} ) + #MESSAGE("DBG WXWIDGETS_LINK_DIRECTORIES=${WXWIDGETS_LINK_DIRECTORIES}") + ENDIF(WX_LINK_DIRECTORIES_WITH_PREFIX) + # replace space separated string by semicolon separated vector to make it + # work with LINK_DIRECTORIES + SEPARATE_ARGUMENTS(WXWIDGETS_LINK_DIRECTORIES) + # Remove -L options from lib list, no need to duplicate + STRING(REGEX REPLACE "[-][L]([^ ;])+" "" WXWIDGETS_LIBRARIES ${WXWIDGETS_LIBRARIES} ) + + +ENDIF( WIN32_STYLE_FIND ) + + +# +# Find wx.rc +# +SET( WXWIDGETS_RC ${WXWIDGETS_INSTALL_PATH}/include/wx/msw/wx.rc ) +IF( NOT WIN32_STYLE_FIND ) + IF( NOT CYGWIN OR MINGW ) + SET( WXWIDGETS_RC "" ) + ENDIF( NOT CYGWIN OR MINGW ) +ENDIF( NOT WIN32_STYLE_FIND ) + +# +# Set preprocessor defs +# +STRING(TOUPPER ${CMAKE_SYSTEM_NAME} WX_SYSNAME) +SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} "-D${WX_SYSNAME}" ) + +IF(WIN32_STYLE_FIND) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWIN32 -D__WXMSW__ ) +ELSE(WIN32_STYLE_FIND) + IF( CYGWIN ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D__GNUWIN32__ -O2 -D_WIN32_IE=0x400 -MMD -Wall ) + ENDIF( CYGWIN ) +ENDIF(WIN32_STYLE_FIND) + +IF( WXWIDGETS_USE_SHARED ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWXUSINGDLL ) +ENDIF( WXWIDGETS_USE_SHARED ) + +IF( WXWIDGETS_USE_DEBUG ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D_DEBUG_ -D__WXDEBUG__ -DWXDEBUG=1 ) +ENDIF( WXWIDGETS_USE_DEBUG ) + +IF ( WXWIDGETS_USE_UNICODE ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DwxUSE_UNICODE ) +ENDIF ( WXWIDGETS_USE_UNICODE ) + +# +# Set the WXWIDGETS_FOUND var +# +IF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR) + SET(WXWIDGETS_FOUND 1) +ENDIF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR) + +# +# Mark advanced vars +# +MARK_AS_ADVANCED(WXWIDGETS_INSTALL_PATH) + +# +# Log results +# +FILE( WRITE "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_FOUND: ${WXWIDGETS_FOUND}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LINK_DIRECTORIES: ${WXWIDGETS_LINK_DIRECTORIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LIBRARIES: ${WXWIDGETS_LIBRARIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_CXX_FLAGS: ${WXWIDGETS_CXX_FLAGS}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_INCLUDE_DIR: ${WXWIDGETS_INCLUDE_DIR}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_DEFINITIONS: ${WXWIDGETS_DEFINITIONS}\n" ) diff --git a/Source/WXDialog/bin/FindwxWin.cmake b/Source/WXDialog/bin/FindwxWin.cmake new file mode 100644 index 0000000..67ef392 --- /dev/null +++ b/Source/WXDialog/bin/FindwxWin.cmake @@ -0,0 +1,440 @@ +##--------------------------------------------------------------------------- +## $RCSfile$ +## $Source$ +## $Revision$ +## $Date$ +##--------------------------------------------------------------------------- +## Author: Jorgen Bodde +## Copyright: (c) Jorgen Bodde +## License: wxWidgets License +##--------------------------------------------------------------------------- +## +## This module finds if wxWindows 2.5.x / 2.6.x is installed and determines +## where the include files and seperate libraries are. It also determines what +## the name of the library is. +## +## WARNING: Monolithic build support is not present here (it is not desired +## by wxWidgets anyway). Also the shared DLL option is not yet present. +## +## Current working combinations are; +## - Static debug and release libs +## - Static unicode debug and release libs +## - Static universal unicode debug and release libs +## - Static unicode universal unicode debug and release libs +## +## +## The linux part of this CMake file is unaltered and will always use because of +## 'wx-config'. The linux part will not use the WX_LIB_IGNORE vars because of +## the way wxWidgets is built and configured. +## +## This code sets the following variables: +## +## ------------------------------------------------------------------ +## +## WXWINDOWS_FOUND = system has WxWindows (in desired config. build) +## +## WXWINDOWS_LIBRARIES = full path to the wxWindows libraries +## on Unix/Linux with additional linker flags from +## "wx-config --libs" +## +## CMAKE_WXWINDOWS_CXX_FLAGS = Unix compiler flags for wxWindows, essentially +## "`wx-config --cxxflags`" +## +## WXWINDOWS_INCLUDE_DIR = where to find headers "wx/wx.h" "wx/setup.h" +## +## WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on Unix +## +## WXWINDOWS_DEFINITIONS = extra defines +## + +IF( WIN32 ) + + ## + ## Find root path of wxWidgets, either in the registry or as environment var + ## + + SET (WXWINDOWS_POSSIBLE_ROOT_PATHS + $ENV{WXWIN} + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ) + + FIND_PATH(WXWIDGETS_PATH_ROOT include/wx/wx.h + ${WXWINDOWS_POSSIBLE_ROOT_PATHS} ) + + SET(WXWINDOWS_FOUND 0) + IF(NOT WXWIDGETS_PATH_ROOT) + MESSAGE(SEND_ERROR "wxWidgets root is not found. Please point out the wxWidgets root using the WXWIN environment var") + ENDIF(NOT WXWIDGETS_PATH_ROOT) + + OPTION(WX_USE_DEBUG_ONLY "Only attempt to setup the debug libraries, ignore the release libraries." ON) + + ## Find a multi library path, this is the path where the seperate libs are located + SET(WXMSW_SETUPH "wx/setup.h") + + SET(WXDEBUG_POSTFIX "") + IF(WX_USE_DEBUG_ONLY) + SET(WXDEBUG_POSTFIX "d") + ENDIF(WX_USE_DEBUG_ONLY) + + ## Try the VS compilation path + SET(WXWINDOWS_POSSIBLE_SETUPH + "${WXWIDGETS_PATH_ROOT}/lib/vc_lib/msw${WXDEBUG_POSTFIX}/${WXMSW_SETUPH}") + + ## Try borland and VS7 path + IF(EXISTS ${WXWINDOWS_POSSIBLE_SETUPH}) + SET(WXWINDOWS_POSSIBLE_MULTILIB_PATHS + "${WXWIDGETS_PATH_ROOT}/lib/vc_lib") + ELSE(EXISTS ${WXWINDOWS_POSSIBLE_SETUPH}) + ## Try the borland path + SET(WXWINDOWS_POSSIBLE_SETUPH + "${WXWIDGETS_PATH_ROOT}/lib/bcc_lib/msw${WXDEBUG_POSTFIX}/${WXMSW_SETUPH}") + IF(EXISTS ${WXWINDOWS_POSSIBLE_SETUPH}) + SET(WXWINDOWS_POSSIBLE_MULTILIB_PATHS + "${WXWIDGETS_PATH_ROOT}/lib/bcc_lib") + ELSE(EXISTS ${WXWINDOWS_POSSIBLE_SETUPH}) + MESSAGE(SEND_ERROR "wxWidgets libraries are not found.") + ENDIF(EXISTS ${WXWINDOWS_POSSIBLE_SETUPH}) + ENDIF(EXISTS ${WXWINDOWS_POSSIBLE_SETUPH}) + + ## Ask user what config should be used, after asking, verify if it will work + OPTION(WX_LINK_AGAINST_UNIVERSAL "Use wxWidgets universal builds" OFF) + OPTION(WX_LINK_AGAINST_UNICODE "Use wxWidgets unicode builds" OFF) + + SET(WXMSW_SETUPH "wx/setup.h") + + SET(WX_RELEASE 0) + SET(WX_DEBUG 0) + + SET(WX_RELEASE_UNI 0) + SET(WX_DEBUG_UNI 0) + + SET(WX_RELEASE_UNIV 0) + SET(WX_DEBUG_UNIV 0) + + SET(WX_RELEASE_UNIV_UNI 0) + SET(WX_DEBUG_UNIV_UNI 0) + + SET(WX_FOUND_VALID_CONF 0) + + ## Scan for wxWidgets static multilib release + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/msw/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_RELEASE 1) + SET(WX_RELEASE_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/msw/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/msw/${WXMSW_SETUPH}") + + ## Scan for wxWidgets static multilib debug + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswd/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_DEBUG 1) + SET(WX_DEBUG_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswd/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswd/${WXMSW_SETUPH}") + + ## Scan for wxWidgets multilib unicode + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswu/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_RELEASE_UNI 1) + SET(WX_RELEASE_UNI_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswu/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswu/${WXMSW_SETUPH}") + + ## Scan for wxWidgets multilib unicode debug + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswud/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_DEBUG_UNI 1) + SET(WX_DEBUG_UNI_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswu/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswud/${WXMSW_SETUPH}") + + ## Scan for wxWidgets multilib universal + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswuniv/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_RELEASE_UNIV 1) + SET(WX_RELEASE_UNIV_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswuniv/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswuniv/${WXMSW_SETUPH}") + + ## Scan for wxWidgets multilib universal debug + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivd/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_DEBUG_UNIV 1) + SET(WX_DEBUG_UNIV_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivd/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivd/${WXMSW_SETUPH}") + + ## Scan for wxWidgets multilib universal unicode + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivu/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_RELEASE_UNIV_UNI 1) + SET(WX_RELEASE_UNIV_UNI_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivu/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivu/${WXMSW_SETUPH}") + + ## Scan for wxWidgets multilib universal unicode debug + IF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivud/${WXMSW_SETUPH}") + SET(WX_FOUND_VALID_CONF 1) + SET(WX_DEBUG_UNIV_UNI 1) + SET(WX_DEBUG_UNIV_UNI_SETUPH ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivud/${WXMSW_SETUPH} ) + ENDIF(EXISTS "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/mswunivud/${WXMSW_SETUPH}") + + ## If no valid config is found, mention this + IF(NOT WX_FOUND_VALID_CONF) + MESSAGE(SEND_ERROR "Did not found a valid setup.h for any library. Please compile your wxWidgets libraries first") + ENDIF(NOT WX_FOUND_VALID_CONF) + + ## Search for wx version automatically + SET (WXVERSION "") + + SET(WXLIBS + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase25.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase25d.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase25u.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase25ud.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv25_core.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv25d_core.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv25u_core.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv25ud_core.lib" ) + + FOREACH(WXLIB ${WXLIBS}) + IF(EXISTS "${WXLIB}") + SET(WXVERSION "25") + ENDIF(EXISTS "${WXLIB}") + ENDFOREACH(WXLIB ${WXLIBS}) + + IF(NOT WXLIB) + SET(WXLIBS + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase26.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase26d.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase26u.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxbase26ud.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv26_core.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv26d_core.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv26u_core.lib" + "${WXWINDOWS_POSSIBLE_MULTILIB_PATHS}/wxmswuniv26ud_core.lib") + + FOREACH(WXLIB ${WXLIBS}) + IF(EXISTS "${WXLIB}") + SET(WXVERSION "26") + ENDIF(EXISTS "${WXLIB}") + ENDFOREACH(WXLIB ${WXLIBS}) + ENDIF(NOT WXLIB) + + IF(NOT WXVERSION) + MESSAGE(SEND_ERROR "There are no suitable wxWidgets libraries found (monolithic builds are no longer supported") + ENDIF(NOT WXVERSION) + + ## + ## Verify unicode universal builds + ## + IF(WX_LINK_AGAINST_UNIVERSAL AND WX_LINK_AGAINST_UNICODE) + IF(NOT WX_RELEASE_UNIV AND NOT WX_DEBUG_UNIV AND NOT WX_RELEASE_UNIV_UNI AND NOT WX_DEBUG_UNIV_UNI) + MESSAGE(SEND_ERROR "Not all wx${WXVERSION} universal unicode libraries are found (check debug and release builds)") + ENDIF(NOT WX_RELEASE_UNIV AND NOT WX_DEBUG_UNIV AND NOT WX_RELEASE_UNIV_UNI AND NOT WX_DEBUG_UNIV_UNI) + ELSE(WX_LINK_AGAINST_UNIVERSAL AND WX_LINK_AGAINST_UNICODE) + ## + ## Verify unicode builds + ## + IF(NOT WX_LINK_AGAINST_UNIVERSAL AND WX_LINK_AGAINST_UNICODE) + IF(NOT WX_RELEASE_UNI AND NOT WX_DEBUG_UNI) + MESSAGE(SEND_ERROR "Not all wx${WXVERSION} unicode libraries are found (check debug and release builds)") + ENDIF(NOT WX_RELEASE_UNI AND NOT WX_DEBUG_UNI) + ELSE(NOT WX_LINK_AGAINST_UNIVERSAL AND WX_LINK_AGAINST_UNICODE) + ## + ## Verify universal builds + ## + IF(WX_LINK_AGAINST_UNIVERSAL AND NOT WX_LINK_AGAINST_UNICODE) + IF(NOT WX_RELEASE_UNIV AND NOT WX_DEBUG_UNIV) + MESSAGE(SEND_ERROR "Not all wx${WXVERSION} universal libraries are found (check debug and release builds)") + ENDIF(NOT WX_RELEASE_UNIV AND NOT WX_DEBUG_UNIV) + ELSE(WX_LINK_AGAINST_UNIVERSAL AND NOT WX_LINK_AGAINST_UNICODE) + ## + ## Must be normal build now + ## + IF(NOT WX_RELEASE AND NOT WX_DEBUG) + MESSAGE(SEND_ERROR "Not all wx${WXVERSION} libraries are found (check debug and release builds)") + ENDIF(NOT WX_RELEASE AND NOT WX_DEBUG) + ENDIF(WX_LINK_AGAINST_UNIVERSAL AND NOT WX_LINK_AGAINST_UNICODE) + ENDIF(NOT WX_LINK_AGAINST_UNIVERSAL AND WX_LINK_AGAINST_UNICODE) + ENDIF(WX_LINK_AGAINST_UNIVERSAL AND WX_LINK_AGAINST_UNICODE) + + ## Prepare the representation for the library + IF(WX_LINK_AGAINST_UNICODE) + SET(WXLIB_POST "u") + ELSE(WX_LINK_AGAINST_UNICODE) + SET(WXLIB_POST "") + ENDIF(WX_LINK_AGAINST_UNICODE) + + ## Prepare for universal presentation + IF(WX_LINK_AGAINST_UNIVERSAL) + SET(WXLIB_UNIV "univ") + ELSE(WX_LINK_AGAINST_UNIVERSAL) + SET(WXLIB_UNIV "") + ENDIF(WX_LINK_AGAINST_UNIVERSAL) + + FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h + ${WXWIDGETS_PATH_ROOT}/lib/vc_lib/msw${WXLIB_UNIV}${WXLIB_POST} + ${WXWIDGETS_PATH_ROOT}/lib/vc_lib/msw${WXLIB_UNIV}${WXLIB_POST}d ) + + ## Find setup.h belonging to multi libs + SET(WXWINDOWS_LINK_DIRECTORIES + ${WXWINDOWS_POSSIBLE_MULTILIB_PATHS} ) + + ## Append all multi libs + SET (WXWINDOWS_STATIC_RELEASE_LIBS + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_gl.lib + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_xrc.lib + optimized wxbase${WXVERSION}${WXLIB_POST}_xml.lib + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_qa.lib + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_html.lib + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_dbgrid.lib + optimized wxbase${WXVERSION}${WXLIB_POST}_odbc.lib + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_media.lib + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_adv.lib + optimized wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}_core.lib + optimized wxbase${WXVERSION}${WXLIB_POST}_net.lib + optimized wxbase${WXVERSION}${WXLIB_POST}.lib + optimized wxexpat.lib + optimized wxtiff.lib + optimized wxjpeg.lib + optimized wxpng.lib + optimized wxzlib.lib + optimized wxregex${WXLIB_POST}.lib ) + + SET (WXWINDOWS_STATIC_DEBUG_LIBS + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_gl.lib + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_xrc.lib + debug wxbase${WXVERSION}${WXLIB_POST}d_xml.lib + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_qa.lib + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_html.lib + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_dbgrid.lib + debug wxbase${WXVERSION}${WXLIB_POST}d_odbc.lib + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_media.lib + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_adv.lib + debug wxmsw${WXLIB_UNIV}${WXVERSION}${WXLIB_POST}d_core.lib + debug wxbase${WXVERSION}${WXLIB_POST}d_net.lib + debug wxbase${WXVERSION}${WXLIB_POST}d.lib + debug wxexpatd.lib + debug wxtiffd.lib + debug wxjpegd.lib + debug wxpngd.lib + debug wxzlibd.lib + debug wxregex${WXLIB_POST}d.lib ) + + ## Add the common libraries to the big list + SET(CMAKE_WXWINDOWS_COMMON_LIBRARIES + winmm + comctl32 + rpcrt4 + wsock32 ) + + ## Set wxWidgets library in WXWINDOWS_LIBRARIES + SET(WXWINDOWS_LIBRARIES + ${CMAKE_WXWINDOWS_COMMON_LIBRARIES} + ${WXWINDOWS_STATIC_DEBUG_LIBS} + ${WXWINDOWS_STATIC_RELEASE_LIBS} ) + + ## Find include directory + SET (WXWINDOWS_POSSIBLE_INCLUDE_PATHS + "${WXWIDGETS_PATH_ROOT}/include" ) + + FIND_PATH(WXWIDGETS_INCLUDE_DIR wx/wx.h + ${WXWINDOWS_POSSIBLE_INCLUDE_PATHS} ) + + ## Blank the setup.h dir when this is not found + IF (NOT WXWINDOWS_INCLUDE_DIR_SETUPH) + SET(WXWINDOWS_INCLUDE_DIR_SETUPH "") + ENDIF (NOT WXWINDOWS_INCLUDE_DIR_SETUPH) + + ## Set include paths + SET(WXWINDOWS_INCLUDE_DIR + ${WXWIDGETS_INCLUDE_DIR} + ${WXWINDOWS_INCLUDE_DIR_SETUPH} ) + + IF(WX_LINK_AGAINST_UNICODE) + SET(WX_UNICODE_FLAGS " -DUNICODE=1" ) + ELSE(WX_LINK_AGAINST_UNICODE) + SET(WX_UNICODE_FLAGS "" ) + ENDIF(WX_LINK_AGAINST_UNICODE) + + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}${WX_UNICODE_FLAGS} -D__WXDEBUG__ -D__WXMSW__ -DWINVER=0x0400 -DwxUSE_BASE=1") + + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}${WX_UNICODE_FLAGS} -D__WXMSW__ -DWINVER=0x0400 -DwxUSE_BASE=1" ) + + ## TODO: Once these tags work, this is more efficient + ##ADD_DEFINITIONS(debug ) + ##ADD_DEFINITIONS(-D__WXMSW__ -DWINVER=0x0400 -DwxUSE_BASE=1 ) + + MARK_AS_ADVANCED( + WXWIDGETS_INCLUDE_DIR + WXWIDGETS_PATH_MONOLIB_DEBUG + WXWIDGETS_PATH_MONOLIB_RELEASE + WXWIDGETS_PATH_ROOT + WXWINDOWS_INCLUDE_DIR_SETUPH ) + + IF(WXWINDOWS_LINK_DIRECTORIES AND WXWINDOWS_LIBRARIES AND WXWINDOWS_INCLUDE_DIR) + SET(WXWINDOWS_FOUND 1) + ENDIF(WXWINDOWS_LINK_DIRECTORIES AND WXWINDOWS_LIBRARIES AND WXWINDOWS_INCLUDE_DIR) + +ELSE( WIN32 ) + + FIND_PROGRAM( CMAKE_WX_CONFIG wx-config ../wx/bin ../../wx/bin ) + SET( CMAKE_WX_CXX_FLAGS "`${CMAKE_WX_CONFIG} --cxxflags`" ) + SET( WXWINDOWS_LIBRARIES "`${CMAKE_WX_CONFIG} --libs`" ) + + IF(CMAKE_WX_CONFIG) + SET(WXWINDOWS_FOUND 1) + ENDIF(CMAKE_WX_CONFIG) + + ## extract linkdirs (-L) for rpath + ## use regular expression to match wildcard equivalent "-L*<endchar>" + ## with <endchar> is a space or a semicolon + STRING(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" ) + #MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}") + + ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES + ## replace -L by ; because the separator seems to be lost otherwise (bug or + ## feature?) + IF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) + STRING(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} ) + #MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}") + ENDIF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) + + ## replace space separated string by semicolon separated vector to make it + ## work with LINK_DIRECTORIES + SEPARATE_ARGUMENTS(WXWINDOWS_LINK_DIRECTORIES) + + IF( CYGWIN OR MINGW ) + GET_FILENAME_COMPONENT(WXWINDOWS_INSTALL_PATH ${CMAKE_WX_CONFIG} PATH) + SET( WXWINDOWS_INSTALL_PATH ${WXWINDOWS_INSTALL_PATH}/.. ) + SET( WXWINDOWS_RC ${WXWINDOWS_INSTALL_PATH}/include/wx/msw/wx.rc ) + ELSE( CYGWIN OR MINGW ) + SET( WXWINDOWS_RC "" ) + ENDIF( CYGWIN OR MINGW ) + SET( WIN32GUI "" ) + + #keep debug settings as indicated by wx-config + #SET( WXWINDOWS_DEFINITIONS ${WXWINDOWS_DEFINITIONS} "${CMAKE_WX_CXX_FLAGS}" ) + #IF( WXWINDOWS_USE_DEBUG ) + # SET( WXWINDOWS_DEFINITIONS ${WXWINDOWS_DEFINITIONS} -ggdb ) + #ENDIF( WXWINDOWS_USE_DEBUG ) + + IF( CYGWIN OR MINGW ) + IF( CYGWIN ) + SET( WXWINDOWS_DEFINITIONS ${WXWINDOWS_DEFINITIONS} -D__GNUWIN32__ -O2 -D_WIN32_IE=0x400 -MMD -Wall ) + ENDIF( CYGWIN ) + ELSE( CYGWIN OR MINGW ) + # just in case `gtk-config --cflags`does not work + # SET( WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} /usr/include/gtk-2.0 /usr/include/gtk-2.0/include /usr/lib/gtk-2.0/include /usr/include/glib-2.0 /usr/lib/glib-2.0/include /usr/include/pango-1.0 /usr/include/atk-1.0 ) + # What about FindGTK.cmake? and what if somebody uses wxMotif? + SET( CMAKE_WX_CXX_FLAGS "${CMAKE_WX_CXX_FLAGS} `gtk-config --cflags`" ) + #find Xwindows + INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake ) + SET( WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${X11_INCLUDE_DIR} ) + ENDIF( CYGWIN OR MINGW ) + +ENDIF( WIN32 ) + +MARK_AS_ADVANCED( + CMAKE_WX_CXX_FLAGS +) + +#MESSAGE( "${WXWINDOWS_LINK_DIRECTORIES}" ) +#MESSAGE( "${WXWINDOWS_LIBRARIES}" ) +#MESSAGE( "CMAKE_WX_CXX_FLAGS}" ) +#MESSAGE( "WXWINDOWS_INCLUDE_PATH}" ) +#MESSAGE( "WXWINDOWS_INCLUDE_DIR}" ) +#MESSAGE( "WXWINDOWS_DEFINITIONS}" ) diff --git a/Source/WXDialog/bin/UsewxW.cmake b/Source/WXDialog/bin/UsewxW.cmake new file mode 100644 index 0000000..e550e89 --- /dev/null +++ b/Source/WXDialog/bin/UsewxW.cmake @@ -0,0 +1,76 @@ +# +# UsewxW.cmake +# v1.0 2005-05-27 +# Jerry Fath 2005 +# Based on work by Jorgen Bodde +# + +# +# wxWidgets CMake helper +# + +# These project specific variables should be set before including this file +#PROJECT_NAME +#PROJECT_SOURCE_FILES +#PROJECT_SOURCE_DIR +#PROJECT_BINARY_DIR +# These variables can be set to add addition directories, libraries, and definitions +#PROJECT_DEFINITIONS +#PROJECT_INCLUDE_PATH +#PROJECT_LINK_DIRECTORIES +#PROJECT_LIBRARIES + +#These WX specific variable should be set by FindwxW.cmake before including this file +# WXWIDGETS_LINK_DIRECTORIES = link directories, useful for rpath on Unix +# WXWIDGETS_LIBRARIES = all the wxWindows libraries ( and linker flags on unix ) +# WXWIDGETS_CXX_FLAGS = compiler flags for building wxWindows +# WXWIDGETS_INCLUDE_DIR = all include path of wxWindows +# WXWIDGETS_DEFINITIONS = all flags of wxWindows + + +# +# The flags for the compiler are stored in WXWIDGETS_CXX_FLAGS, we will set those so that +# we know we will always compile wxWidgets programs properly. In case of debugging, we +# will add the __WXDEBUG__ and WXDEBUG flags as well. For linux, you might want LINUX +# to be defined. +# +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WXWIDGETS_CXX_FLAGS}") + +ADD_DEFINITIONS( ${WXWIDGETS_DEFINITIONS} ${PROJECT_DEFINITIONS} ) + +# +# The include dirs +# +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR} + ${PROJECT_INCLUDE_PATH} + ${WXWIDGETS_INCLUDE_DIR}) + +# +# This is needed to tell CMake what directories contain the libraries we need. This will +# allow us to just specify the lib files without prepending them with a full path to that +# library +# +LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} ${PROJECT_LINK_DIRECTORIES}) + +# +# This is our target. As you can see, we specify WIN32 for windows makefiles. In Linux and +# other OS'es this flag is ignored. Under windows it will make sure we generate a Win32 file with GUI. +# +ADD_EXECUTABLE(${PROJECT_NAME} WIN32 ${PROJECT_SOURCE_FILES} ${PROJECT_RC_FILE}) + +# +# Here we specify what libraries are linked to our project +# +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${WXWIDGETS_LIBRARIES} ${PROJECT_LIBRARIES}) + +# +# Log results +# +FILE( WRITE "${PROJECT_BINARY_DIR}/usewxw.log" "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/usewxw.log" "Definitions: ${WXWIDGETS_DEFINITIONS} ${PROJECT_DEFINITIONS}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/usewxw.log" "INCLUDE_DIRECTORIES: ${PROJECT_SOURCE_DIR} ${PROJECT_INCLUDE_PATH} ${WXWIDGETS_INCLUDE_DIR}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/usewxw.log" "LINK_DIRECTORIES: ${WXWIDGETS_LINK_DIRECTORIES} ${PROJECT_LINK_DIRECTORIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/usewxw.log" "TARGET_LINK_LIBRARIES: ${PROJECT_NAME} ${WXWIDGETS_LIBRARIES} ${PROJECT_LIBRARIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/usewxw.log" "Sources: ${PROJECT_SOURCE_FILES}\n" ) + + |