mirror of https://github.com/OpenMW/openmw.git
commit
a44ba0e461
@ -1,158 +1,53 @@
|
|||||||
# - Find MyGUI includes and library
|
# - Find MyGUI includes and library
|
||||||
#
|
#
|
||||||
|
# This module accepts the following env variables
|
||||||
|
# MYGUI_HOME - Can be set to MyGUI install path or Windows build path
|
||||||
|
#
|
||||||
# This module defines
|
# This module defines
|
||||||
# MYGUI_INCLUDE_DIRS
|
# MyGUI_INCLUDE_DIRS
|
||||||
# MYGUI_LIBRARIES, the libraries to link against to use MYGUI.
|
# MyGUI_LIBRARIES, the libraries to link against to use MyGUI.
|
||||||
# MYGUI_LIB_DIR, the location of the libraries
|
# MyGUI_FOUND, If false, do not try to use MyGUI
|
||||||
# MYGUI_FOUND, If false, do not try to use MYGUI
|
|
||||||
#
|
#
|
||||||
# Copyright © 2007, Matt Williams
|
# Copyright © 2007, Matt Williams
|
||||||
#
|
#
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
CMAKE_POLICY(PUSH)
|
|
||||||
include(FindPkgMacros)
|
|
||||||
include(PreprocessorUtils)
|
|
||||||
|
|
||||||
# IF (MYGUI_LIBRARIES AND MYGUI_INCLUDE_DIRS)
|
|
||||||
# SET(MYGUI_FIND_QUIETLY TRUE)
|
|
||||||
# ENDIF (MYGUI_LIBRARIES AND MYGUI_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
IF (WIN32) #Windows
|
|
||||||
|
|
||||||
MESSAGE(STATUS "Looking for MyGUI")
|
|
||||||
|
|
||||||
IF(MINGW)
|
|
||||||
|
|
||||||
FIND_PATH ( MYGUI_INCLUDE_DIRS MyGUI.h PATH_SUFFIXES MYGUI)
|
|
||||||
FIND_LIBRARY ( MYGUI_LIBRARIES_REL NAMES
|
|
||||||
libMyGUIEngine${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
HINTS
|
|
||||||
${MYGUI_LIB_DIR}
|
|
||||||
PATH_SUFFIXES "" release relwithdebinfo minsizerel )
|
|
||||||
|
|
||||||
FIND_LIBRARY ( MYGUI_LIBRARIES_DBG NAMES
|
|
||||||
libMyGUIEngine_d${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
HINTS
|
|
||||||
${MYGUI_LIB_DIR}
|
|
||||||
PATH_SUFFIXES "" debug )
|
|
||||||
|
|
||||||
make_library_set ( MYGUI_LIBRARIES )
|
include(LibFindMacros)
|
||||||
|
|
||||||
MESSAGE ("${MYGUI_LIBRARIES}")
|
|
||||||
ENDIF(MINGW)
|
|
||||||
|
|
||||||
SET(MYGUISDK $ENV{MYGUI_HOME})
|
|
||||||
IF (MYGUISDK)
|
|
||||||
findpkg_begin ( "MYGUI" )
|
|
||||||
MESSAGE(STATUS "Using MyGUI in MyGUI SDK")
|
|
||||||
STRING(REGEX REPLACE "[\\]" "/" MYGUISDK "${MYGUISDK}" )
|
|
||||||
|
|
||||||
find_path ( MYGUI_INCLUDE_DIRS MyGUI.h "${MYGUISDK}/MyGUIEngine/include" NO_DEFAULT_PATH )
|
|
||||||
|
|
||||||
SET ( MYGUI_LIB_DIR ${MYGUISDK}/lib ${MYGUISDK}/*/lib )
|
|
||||||
|
|
||||||
if (MYGUI_STATIC)
|
if (MYGUI_STATIC)
|
||||||
set(LIB_SUFFIX "Static")
|
set(MYGUI_STATIC_SUFFIX "Static")
|
||||||
find_package(Freetype)
|
else()
|
||||||
endif ( MYGUI_STATIC )
|
set(MYGUI_STATIC_SUFFIX "")
|
||||||
|
endif()
|
||||||
find_library ( MYGUI_LIBRARIES_REL NAMES MyGUIEngine${LIB_SUFFIX}.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" release relwithdebinfo minsizerel )
|
|
||||||
find_library ( MYGUI_LIBRARIES_DBG NAMES MyGUIEngine${LIB_SUFFIX}_d.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" debug )
|
libfind_pkg_detect(MyGUI_Debug MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX}
|
||||||
|
FIND_LIBRARY MyGUIEngine_d${MYGUI_STATIC_SUFFIX}
|
||||||
make_library_set ( MYGUI_LIBRARIES )
|
HINTS $ENV{MYGUI_HOME}/lib
|
||||||
|
PATH_SUFFIXES "" debug
|
||||||
MESSAGE ("${MYGUI_LIBRARIES}")
|
)
|
||||||
|
set(MyGUI_Debug_FIND_QUIETLY TRUE)
|
||||||
#findpkg_finish ( "MYGUI" )
|
libfind_process(MyGUI_Debug)
|
||||||
ENDIF (MYGUISDK)
|
|
||||||
ELSE (WIN32) #Unix
|
libfind_pkg_detect(MyGUI MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX}
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
|
FIND_PATH MyGUI.h
|
||||||
FIND_PACKAGE(PkgConfig)
|
HINTS $ENV{MYGUI_HOME}/include
|
||||||
IF(MYGUI_STATIC)
|
PATH_SUFFIXES MYGUI MyGUI
|
||||||
# don't use pkgconfig on OS X, find freetype & append it's libs to resulting MYGUI_LIBRARIES
|
FIND_LIBRARY MyGUIEngine${MYGUI_STATIC_SUFFIX}
|
||||||
IF (NOT APPLE AND NOT ANDROID)
|
HINTS $ENV{MYGUI_HOME}/lib
|
||||||
PKG_SEARCH_MODULE(MYGUI MYGUIStatic MyGUIStatic)
|
PATH_SUFFIXES "" release relwithdebinfo minsizerel
|
||||||
IF (MYGUI_INCLUDE_DIRS)
|
)
|
||||||
SET(MYGUI_INCLUDE_DIRS ${MYGUI_INCLUDE_DIRS})
|
if (MYGUI_STATIC AND (APPLE OR ANDROID))
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBDIR})
|
# we need explicit Freetype libs only on OS X and ANDROID for static build
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} CACHE STRING "")
|
libfind_package(MyGUI Freetype)
|
||||||
ELSE (MYGUI_INCLUDE_DIRS)
|
endif()
|
||||||
FIND_PATH(MYGUI_INCLUDE_DIRS MyGUI.h PATHS /usr/local/include /usr/include PATH_SUFFIXES MyGUI MYGUI)
|
|
||||||
FIND_LIBRARY(MYGUI_LIBRARIES myguistatic PATHS /usr/lib /usr/local/lib)
|
libfind_version_n_header(MyGUI
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBRARIES})
|
NAMES MyGUI_Prerequest.h
|
||||||
STRING(REGEX REPLACE "(.*)/.*" "\\1" MYGUI_LIB_DIR "${MYGUI_LIB_DIR}")
|
DEFINES MYGUI_VERSION_MAJOR MYGUI_VERSION_MINOR MYGUI_VERSION_PATCH
|
||||||
STRING(REGEX REPLACE ".*/" "" MYGUI_LIBRARIES "${MYGUI_LIBRARIES}")
|
)
|
||||||
ENDIF (MYGUI_INCLUDE_DIRS)
|
libfind_process(MyGUI)
|
||||||
ELSE (NOT APPLE AND NOT ANDROID)
|
|
||||||
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${MYGUI_DEPENDENCIES_DIR})
|
if (MyGUI_Debug_FOUND)
|
||||||
FIND_PACKAGE(Freetype REQUIRED)
|
set(MyGUI_LIBRARIES optimized ${MyGUI_LIBRARIES} debug ${MyGUI_Debug_LIBRARIES})
|
||||||
FIND_PATH(MYGUI_INCLUDE_DIRS MyGUI.h PATHS /usr/local/include /usr/include PATH_SUFFIXES MyGUI MYGUI)
|
endif()
|
||||||
FIND_LIBRARY(MYGUI_LIBRARIES MyGUIEngineStatic PATHS /usr/lib /usr/local/lib ${OPENMW_DEPENDENCIES_DIR})
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBRARIES})
|
|
||||||
STRING(REGEX REPLACE "(.*)/.*" "\\1" MYGUI_LIB_DIR "${MYGUI_LIB_DIR}")
|
|
||||||
STRING(REGEX REPLACE ".*/" "" MYGUI_LIBRARIES "${MYGUI_LIBRARIES}")
|
|
||||||
ENDIF (NOT APPLE AND NOT ANDROID)
|
|
||||||
ELSE(MYGUI_STATIC)
|
|
||||||
PKG_SEARCH_MODULE(MYGUI MYGUI MyGUI)
|
|
||||||
IF (MYGUI_INCLUDE_DIRS)
|
|
||||||
SET(MYGUI_INCLUDE_DIRS ${MYGUI_INCLUDE_DIRS})
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBDIR})
|
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} CACHE STRING "")
|
|
||||||
ELSE (MYGUI_INCLUDE_DIRS)
|
|
||||||
FIND_PATH(MYGUI_INCLUDE_DIRS MyGUI.h PATHS /usr/local/include /usr/include PATH_SUFFIXES MyGUI MYGUI)
|
|
||||||
FIND_LIBRARY(MYGUI_LIBRARIES MyGUIEngine PATHS /usr/local/lib /usr/lib)
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIBRARIES})
|
|
||||||
STRING(REGEX REPLACE "(.*)/.*" "\\1" MYGUI_LIB_DIR "${MYGUI_LIB_DIR}")
|
|
||||||
STRING(REGEX REPLACE ".*/" "" MYGUI_LIBRARIES "${MYGUI_LIBRARIES}")
|
|
||||||
ENDIF (MYGUI_INCLUDE_DIRS)
|
|
||||||
ENDIF(MYGUI_STATIC)
|
|
||||||
ENDIF (WIN32)
|
|
||||||
|
|
||||||
|
|
||||||
#Do some preparation
|
|
||||||
IF (NOT WIN32) # This does not work on Windows for paths with spaces in them
|
|
||||||
SEPARATE_ARGUMENTS(MYGUI_INCLUDE_DIRS)
|
|
||||||
SEPARATE_ARGUMENTS(MYGUI_LIBRARIES)
|
|
||||||
ENDIF (NOT WIN32)
|
|
||||||
|
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} ${Freetype_LIBRARIES})
|
|
||||||
|
|
||||||
SET(MYGUI_INCLUDE_DIRS ${MYGUI_INCLUDE_DIRS} CACHE PATH "")
|
|
||||||
SET(MYGUI_LIBRARIES ${MYGUI_LIBRARIES} CACHE STRING "")
|
|
||||||
SET(MYGUI_LIB_DIR ${MYGUI_LIB_DIR} CACHE PATH "")
|
|
||||||
|
|
||||||
IF (NOT APPLE OR NOT MYGUI_STATIC) # we need explicit freetype libs only on OS X for static build, for other cases just make it TRUE
|
|
||||||
SET(Freetype_LIBRARIES TRUE)
|
|
||||||
ENDIF (NOT APPLE OR NOT MYGUI_STATIC)
|
|
||||||
|
|
||||||
IF (MYGUI_INCLUDE_DIRS AND MYGUI_LIBRARIES AND Freetype_LIBRARIES)
|
|
||||||
SET(MYGUI_FOUND TRUE)
|
|
||||||
ENDIF (MYGUI_INCLUDE_DIRS AND MYGUI_LIBRARIES AND Freetype_LIBRARIES)
|
|
||||||
|
|
||||||
IF (MYGUI_FOUND)
|
|
||||||
MARK_AS_ADVANCED(MYGUI_LIB_DIR)
|
|
||||||
IF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
MESSAGE(STATUS " libraries : ${MYGUI_LIBRARIES} from ${MYGUI_LIB_DIR}")
|
|
||||||
MESSAGE(STATUS " includes : ${MYGUI_INCLUDE_DIRS}")
|
|
||||||
ENDIF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
|
|
||||||
find_file(MYGUI_PREQUEST_FILE NAMES MyGUI_Prerequest.h PATHS ${MYGUI_INCLUDE_DIRS})
|
|
||||||
file(READ ${MYGUI_PREQUEST_FILE} MYGUI_TEMP_VERSION_CONTENT)
|
|
||||||
get_preprocessor_entry(MYGUI_TEMP_VERSION_CONTENT MYGUI_VERSION_MAJOR MYGUI_VERSION_MAJOR)
|
|
||||||
get_preprocessor_entry(MYGUI_TEMP_VERSION_CONTENT MYGUI_VERSION_MINOR MYGUI_VERSION_MINOR)
|
|
||||||
get_preprocessor_entry(MYGUI_TEMP_VERSION_CONTENT MYGUI_VERSION_PATCH MYGUI_VERSION_PATCH)
|
|
||||||
set(MYGUI_VERSION "${MYGUI_VERSION_MAJOR}.${MYGUI_VERSION_MINOR}.${MYGUI_VERSION_PATCH}")
|
|
||||||
|
|
||||||
IF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
MESSAGE(STATUS "MyGUI version: ${MYGUI_VERSION}")
|
|
||||||
ENDIF (NOT MYGUI_FIND_QUIETLY)
|
|
||||||
ENDIF (MYGUI_FOUND)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MyGUI DEFAULT_MSG
|
|
||||||
MYGUI_INCLUDE_DIRS
|
|
||||||
Freetype_LIBRARIES
|
|
||||||
MYGUI_LIBRARIES)
|
|
||||||
|
|
||||||
CMAKE_POLICY(POP)
|
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
#-------------------------------------------------------------------
|
|
||||||
# This file is part of the CMake build system for OGRE
|
|
||||||
# (Object-oriented Graphics Rendering Engine)
|
|
||||||
# For the latest info, see http://www.ogre3d.org/
|
|
||||||
#
|
|
||||||
# The contents of this file are placed in the public domain. Feel
|
|
||||||
# free to make use of it in any way you like.
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE)
|
|
||||||
string(REGEX MATCH
|
|
||||||
"# *define +${KEYWORD} +((\"([^\n]*)\")|([^ \n]*))"
|
|
||||||
PREPROC_TEMP_VAR
|
|
||||||
${${CONTENTS}}
|
|
||||||
)
|
|
||||||
if (CMAKE_MATCH_3)
|
|
||||||
set(${VARIABLE} ${CMAKE_MATCH_3})
|
|
||||||
else ()
|
|
||||||
set(${VARIABLE} ${CMAKE_MATCH_4})
|
|
||||||
endif ()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(has_preprocessor_entry CONTENTS KEYWORD VARIABLE)
|
|
||||||
string(REGEX MATCH
|
|
||||||
"\n *# *define +(${KEYWORD})"
|
|
||||||
PREPROC_TEMP_VAR
|
|
||||||
${${CONTENTS}}
|
|
||||||
)
|
|
||||||
if (CMAKE_MATCH_1)
|
|
||||||
set(${VARIABLE} TRUE)
|
|
||||||
else ()
|
|
||||||
set(${VARIABLE} FALSE)
|
|
||||||
endif ()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(replace_preprocessor_entry VARIABLE KEYWORD NEW_VALUE)
|
|
||||||
string(REGEX REPLACE
|
|
||||||
"(// *)?# *define +${KEYWORD} +[^ \n]*"
|
|
||||||
"#define ${KEYWORD} ${NEW_VALUE}"
|
|
||||||
${VARIABLE}_TEMP
|
|
||||||
${${VARIABLE}}
|
|
||||||
)
|
|
||||||
set(${VARIABLE} ${${VARIABLE}_TEMP})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(set_preprocessor_entry VARIABLE KEYWORD ENABLE)
|
|
||||||
if (${ENABLE})
|
|
||||||
set(TMP_REPLACE_STR "#define ${KEYWORD}")
|
|
||||||
else ()
|
|
||||||
set(TMP_REPLACE_STR "// #define ${KEYWORD}")
|
|
||||||
endif ()
|
|
||||||
string(REGEX REPLACE
|
|
||||||
"(// *)?# *define +${KEYWORD} *\n"
|
|
||||||
${TMP_REPLACE_STR}
|
|
||||||
${VARIABLE}_TEMP
|
|
||||||
${${VARIABLE}}
|
|
||||||
)
|
|
||||||
set(${VARIABLE} ${${VARIABLE}_TEMP})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
|
|
||||||
# get_version_from_n_defines(result_version_name header_path [list of defines...])
|
|
||||||
#
|
|
||||||
# get_version_from_n_defines(MyPackage_VERSION /Header/Path/HeaderName.h
|
|
||||||
# MYPACKAGE_VERSION_MAJOR
|
|
||||||
# MYPACKAGE_VERSION_MINOR
|
|
||||||
# )
|
|
||||||
# Function call will get the values of defines MYPACKAGE_VERSION_MAJOR & MYPACKAGE_VERSION_MINOR
|
|
||||||
# from header and set "${MYPACKAGE_VERSION_MAJOR}.${MYPACKAGE_VERSION_MINOR}" into MyPackage_VERSION
|
|
||||||
#
|
|
||||||
|
|
||||||
function(get_version_from_n_defines OUT_VAR HEADER_PATH)
|
|
||||||
if (NOT EXISTS ${HEADER_PATH})
|
|
||||||
message(FATAL_ERROR "Unable to find '${HEADER_PATH}'")
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
file(READ ${HEADER_PATH} _CONTENT)
|
|
||||||
unset(_DEFINES_LIST)
|
|
||||||
foreach (_DEFINE_NAME ${ARGN})
|
|
||||||
get_preprocessor_entry(_CONTENT ${_DEFINE_NAME} _DEFINE_VALUE)
|
|
||||||
list(APPEND _DEFINES_LIST ${_DEFINE_VALUE})
|
|
||||||
endforeach()
|
|
||||||
string(REPLACE ";" "." _VERSION "${_DEFINES_LIST}")
|
|
||||||
set(${OUT_VAR} "${_VERSION}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
Loading…
Reference in New Issue