Skip to content

Commit

Permalink
Merge pull request OpenMW#966 from kpp/find_mygui
Browse files Browse the repository at this point in the history
Find mygui
  • Loading branch information
scrawl authored Aug 15, 2016
2 parents 71f786f + 4cffdb6 commit a44ba0e
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 264 deletions.
6 changes: 1 addition & 5 deletions CI/before_script.msvc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,7 @@ printf "MyGUI 3.2.2... "
mv MyGUI-3.2.2-win$BITS MyGUI
fi

MYGUI_SDK="`real_pwd`/MyGUI"

add_cmake_opts -DMYGUISDK="$MYGUI_SDK" \
-DMYGUI_INCLUDE_DIRS="$MYGUI_SDK/include/MYGUI" \
-DMYGUI_PREQUEST_FILE="$MYGUI_SDK/include/MYGUI/MyGUI_Prerequest.h"
export MYGUI_HOME="`real_pwd`/MyGUI"

if [ $CONFIGURATION == "Debug" ]; then
SUFFIX="_d"
Expand Down
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,7 @@ if(QT_STATIC)
endif()
endif()

find_package(MyGUI REQUIRED)
if (${MYGUI_VERSION} VERSION_LESS "3.2.1")
message(FATAL_ERROR "OpenMW requires MyGUI 3.2.1 or later, please install the latest version from http://mygui.info")
endif()

find_package(MyGUI 3.2.1 REQUIRED)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(SDL2 REQUIRED)
find_package(OpenAL REQUIRED)
Expand All @@ -296,12 +292,12 @@ include_directories("."
SYSTEM
${SDL2_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${MYGUI_INCLUDE_DIRS}
${MyGUI_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIR}
${Bullet_INCLUDE_DIRS}
)

link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${MYGUI_LIB_DIR})
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})

if(MYGUI_STATIC)
add_definitions(-DMYGUI_STATIC)
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ target_link_libraries(openmw
${Boost_PROGRAM_OPTIONS_LIBRARY}
${OPENAL_LIBRARY}
${FFmpeg_LIBRARIES}
${MYGUI_LIBRARIES}
${MyGUI_LIBRARIES}
${SDL2_LIBRARY}
"osg-ffmpeg-videoplayer"
"oics"
Expand Down
19 changes: 5 additions & 14 deletions cmake/FindFreetype.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
# ======================================

include(LibFindMacros)
include(PreprocessorUtils)

set(_REGULAR_INSTALL_PATHS
/usr/X11R6
Expand Down Expand Up @@ -78,21 +77,13 @@ find_path(Freetype_OLD_INCLUDE_DIR
PATH_SUFFIXES freetype2
NO_DEFAULT_PATH
)

# get version from freetype.h
find_file(Freetype_HEADER
NAMES freetype.h
PATH_SUFFIXES freetype
PATHS ${Freetype_OLD_INCLUDE_DIR}
libfind_version_n_header(Freetype
NAMES freetype/freetype.h freetype.h
PATHS Freetype_OLD_INCLUDE_DIR
DEFINES FREETYPE_MAJOR FREETYPE_MINOR FREETYPE_PATCH
)
if (Freetype_HEADER)
get_version_from_n_defines(Freetype_VERSION
${Freetype_HEADER}
FREETYPE_MAJOR FREETYPE_MINOR FREETYPE_PATCH
)
endif()

set(Freetype_PROCESS_INCLUDES Freetype_INCLUDE_DIR Freetype_OLD_INCLUDE_DIR)
set(Freetype_PROCESS_INCLUDES Freetype_OLD_INCLUDE_DIR)
libfind_process(Freetype)

if (Freetype_INCLUDE_DIRS)
Expand Down
193 changes: 44 additions & 149 deletions cmake/FindMyGUI.cmake
Original file line number Diff line number Diff line change
@@ -1,158 +1,53 @@
# - 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
# MYGUI_INCLUDE_DIRS
# 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_INCLUDE_DIRS
# MyGUI_LIBRARIES, the libraries to link against to use MyGUI.
# MyGUI_FOUND, If false, do not try to use MyGUI
#
# Copyright © 2007, Matt Williams
#
# Redistribution and use is allowed according to the terms of the BSD license.
# 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 )

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 )
set(LIB_SUFFIX "Static")
find_package(Freetype)
endif ( MYGUI_STATIC )

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 )

make_library_set ( MYGUI_LIBRARIES )

MESSAGE ("${MYGUI_LIBRARIES}")

#findpkg_finish ( "MYGUI" )
ENDIF (MYGUISDK)
ELSE (WIN32) #Unix
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
FIND_PACKAGE(PkgConfig)
IF(MYGUI_STATIC)
# don't use pkgconfig on OS X, find freetype & append it's libs to resulting MYGUI_LIBRARIES
IF (NOT APPLE AND NOT ANDROID)
PKG_SEARCH_MODULE(MYGUI MYGUIStatic MyGUIStatic)
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 myguistatic PATHS /usr/lib /usr/local/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)
ELSE (NOT APPLE AND NOT ANDROID)
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${MYGUI_DEPENDENCIES_DIR})
FIND_PACKAGE(Freetype REQUIRED)
FIND_PATH(MYGUI_INCLUDE_DIRS MyGUI.h PATHS /usr/local/include /usr/include PATH_SUFFIXES MyGUI MYGUI)
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)
include(LibFindMacros)

if (MYGUI_STATIC)
set(MYGUI_STATIC_SUFFIX "Static")
else()
set(MYGUI_STATIC_SUFFIX "")
endif()

libfind_pkg_detect(MyGUI_Debug MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX}
FIND_LIBRARY MyGUIEngine_d${MYGUI_STATIC_SUFFIX}
HINTS $ENV{MYGUI_HOME}/lib
PATH_SUFFIXES "" debug
)
set(MyGUI_Debug_FIND_QUIETLY TRUE)
libfind_process(MyGUI_Debug)

libfind_pkg_detect(MyGUI MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX}
FIND_PATH MyGUI.h
HINTS $ENV{MYGUI_HOME}/include
PATH_SUFFIXES MYGUI MyGUI
FIND_LIBRARY MyGUIEngine${MYGUI_STATIC_SUFFIX}
HINTS $ENV{MYGUI_HOME}/lib
PATH_SUFFIXES "" release relwithdebinfo minsizerel
)
if (MYGUI_STATIC AND (APPLE OR ANDROID))
# we need explicit Freetype libs only on OS X and ANDROID for static build
libfind_package(MyGUI Freetype)
endif()

libfind_version_n_header(MyGUI
NAMES MyGUI_Prerequest.h
DEFINES MYGUI_VERSION_MAJOR MYGUI_VERSION_MINOR MYGUI_VERSION_PATCH
)
libfind_process(MyGUI)

if (MyGUI_Debug_FOUND)
set(MyGUI_LIBRARIES optimized ${MyGUI_LIBRARIES} debug ${MyGUI_Debug_LIBRARIES})
endif()
1 change: 0 additions & 1 deletion cmake/FindTinyXML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#

include(LibFindMacros)
include(PreprocessorUtils)

libfind_pkg_detect(TinyXML tinyxml
FIND_PATH tinyxml.h
Expand Down
85 changes: 0 additions & 85 deletions cmake/PreprocessorUtils.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ target_link_libraries(components
${SDL2_LIBRARY}
# For MyGUI platform
${GL_LIB}
${MYGUI_LIBRARIES}
${MyGUI_LIBRARIES}
)

if (WIN32)
Expand Down
1 change: 0 additions & 1 deletion plugins/mygui_resource_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ set_target_properties(${MYGUI_RESOURCE_PLUGIN_LIBRARY} PROPERTIES PREFIX "")

target_link_libraries(${MYGUI_RESOURCE_PLUGIN_LIBRARY}
${OGRE_LIBRARIES}
${MYGUI_LIBRARIES}
components
)

0 comments on commit a44ba0e

Please sign in to comment.