Merge remote-tracking branch 'slothlife/cmake-fixes'

deque
Marc Zinnschlag 11 years ago
commit f130f8535c

@ -239,16 +239,40 @@ find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(SDL2 REQUIRED)
find_package(OpenAL REQUIRED)
find_package(Bullet REQUIRED)
IF(OGRE_STATIC)
find_package(Cg)
IF(WIN32)
set(OGRE_PLUGIN_INCLUDE_DIRS ${OGRE_Plugin_CgProgramManager_INCLUDE_DIRS} ${OGRE_Plugin_OctreeSceneManager_INCLUDE_DIRS} ${OGRE_Plugin_ParticleFX_INCLUDE_DIRS} ${OGRE_RenderSystem_Direct3D9_INCLUDE_DIRS} ${OGRE_RenderSystem_GL_INCLUDE_DIRS})
ELSE(WIN32)
set(OGRE_PLUGIN_INCLUDE_DIRS ${OGRE_Plugin_CgProgramManager_INCLUDE_DIRS} ${OGRE_Plugin_OctreeSceneManager_INCLUDE_DIRS} ${OGRE_Plugin_ParticleFX_INCLUDE_DIRS} ${OGRE_RenderSystem_GL_INCLUDE_DIRS})
ENDIF(WIN32)
ENDIF(OGRE_STATIC)
set(OGRE_PLUGIN_INCLUDE_DIRS "")
set(OGRE_STATIC_PLUGINS "")
macro(add_static_ogre_plugin PLUGIN)
if(OGRE_${PLUGIN}_FOUND)
# strip RenderSystem_ or Plugin_ prefix from plugin name
string(REPLACE "RenderSystem_" "" PLUGIN_TEMP ${PLUGIN})
string(REPLACE "Plugin_" "" PLUGIN_NAME ${PLUGIN_TEMP})
add_definitions(-DENABLE_PLUGIN_${PLUGIN_NAME})
list(APPEND OGRE_PLUGIN_INCLUDE_DIRS ${OGRE_${PLUGIN}_INCLUDE_DIRS})
list(APPEND OGRE_STATIC_PLUGINS ${OGRE_${PLUGIN}_LIBRARIES})
endif(OGRE_${PLUGIN}_FOUND)
endmacro(add_static_ogre_plugin)
if(OGRE_STATIC)
# set up OGRE_PLUGIN_INCLUDE_DIRS and OGRE_STATIC_PLUGINS
add_static_ogre_plugin(Plugin_OctreeSceneManager)
add_static_ogre_plugin(Plugin_ParticleFX)
find_package(Cg)
if(Cg_FOUND)
add_static_ogre_plugin(Plugin_CgProgramManager)
list(APPEND OGRE_STATIC_PLUGINS ${Cg_LIBRARIES})
endif(Cg_FOUND)
add_static_ogre_plugin(RenderSystem_GL)
if(WIN32)
add_static_ogre_plugin(RenderSystem_Direct3D9)
endif(WIN32)
endif(OGRE_STATIC)
include_directories("."
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_PLUGIN_INCLUDE_DIRS}
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_INCLUDE_DIRS} ${OGRE_PLUGIN_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${PLATFORM_INCLUDE_DIR}
@ -260,6 +284,10 @@ include_directories("."
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR} ${MYGUI_LIB_DIR})
if(MYGUI_STATIC)
add_definitions(-DMYGUI_STATIC)
endif (MYGUI_STATIC)
if (APPLE)
# List used Ogre plugins
SET(USED_OGRE_PLUGINS ${OGRE_RenderSystem_GL_LIBRARY_REL}

@ -94,15 +94,6 @@ if(NOT WIN32)
endif(NOT WIN32)
# Main executable
IF(OGRE_STATIC)
IF(WIN32)
ADD_DEFINITIONS(-DENABLE_PLUGIN_Direct3D9 -DENABLE_PLUGIN_GL)
set(OGRE_STATIC_PLUGINS ${OGRE_RenderSystem_Direct3D9_LIBRARIES} ${OGRE_RenderSystem_GL_LIBRARIES})
ELSE(WIN32)
ADD_DEFINITIONS(-DENABLE_PLUGIN_GL)
set(OGRE_STATIC_PLUGINS ${OGRE_RenderSystem_GL_LIBRARIES})
ENDIF(WIN32)
ENDIF(OGRE_STATIC)
add_executable(omwlauncher
${GUI_TYPE}
${LAUNCHER}
@ -116,7 +107,7 @@ target_link_libraries(omwlauncher
${Boost_LIBRARIES}
${OGRE_LIBRARIES}
${OGRE_STATIC_PLUGINS}
${SDL2_LIBRARY}
${SDL2_LIBRARY_ONLY}
${QT_LIBRARIES}
components
)

@ -192,6 +192,7 @@ endif(APPLE)
target_link_libraries(opencs
${OGRE_LIBRARIES}
${OGRE_STATIC_PLUGINS}
${SHINY_LIBRARIES}
${Boost_LIBRARIES}
${QT_LIBRARIES}

@ -89,19 +89,6 @@ endif(WIN32)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
IF(OGRE_STATIC)
ADD_DEFINITIONS(-DENABLE_PLUGIN_OctreeSceneManager -DENABLE_PLUGIN_ParticleFX -DENABLE_PLUGIN_GL)
set(OGRE_STATIC_PLUGINS ${OGRE_Plugin_OctreeSceneManager_LIBRARIES} ${OGRE_Plugin_ParticleFX_LIBRARIES} ${OGRE_RenderSystem_GL_LIBRARIES})
IF(WIN32)
ADD_DEFINITIONS(-DENABLE_PLUGIN_Direct3D9)
list (APPEND OGRE_STATIC_PLUGINS ${OGRE_RenderSystem_Direct3D9_LIBRARIES})
ENDIF(WIN32)
IF (Cg_FOUND)
ADD_DEFINITIONS(-DENABLE_PLUGIN_CgProgramManager)
list (APPEND OGRE_STATIC_PLUGINS ${OGRE_Plugin_CgProgramManager_LIBRARIES} ${Cg_LIBRARIES})
ENDIF (Cg_FOUND)
ENDIF(OGRE_STATIC)
add_executable(openmw
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
${OPENMW_FILES}

@ -0,0 +1,72 @@
#-------------------------------------------------------------------
# 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.
#-------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Find DirectX9 SDK
# Define:
# DirectX9_FOUND
# DirectX9_INCLUDE_DIR
# DirectX9_LIBRARY
# DirectX9_ROOT_DIR
if(WIN32) # The only platform it makes sense to check for DirectX9 SDK
include(FindPkgMacros)
findpkg_begin(DirectX9)
# Get path, convert backslashes as ${ENV_DXSDK_DIR}
getenv_path(DXSDK_DIR)
getenv_path(DirectX_HOME)
getenv_path(DirectX_ROOT)
getenv_path(DirectX_BASE)
# construct search paths
set(DirectX9_PREFIX_PATH
"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
"${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
"C:/apps_x86/Microsoft DirectX SDK*"
"C:/Program Files (x86)/Microsoft DirectX SDK*"
"C:/apps/Microsoft DirectX SDK*"
"C:/Program Files/Microsoft DirectX SDK*"
"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
)
create_search_paths(DirectX9)
# redo search if prefix path changed
clear_if_changed(DirectX9_PREFIX_PATH
DirectX9_LIBRARY
DirectX9_INCLUDE_DIR
)
find_path(DirectX9_INCLUDE_DIR NAMES d3d9.h D3DCommon.h HINTS ${DirectX9_INC_SEARCH_PATH})
# dlls are in DirectX9_ROOT_DIR/Developer Runtime/x64|x86
# lib files are in DirectX9_ROOT_DIR/Lib/x64|x86
if(CMAKE_CL_64)
set(DirectX9_LIBPATH_SUFFIX "x64")
else(CMAKE_CL_64)
set(DirectX9_LIBPATH_SUFFIX "x86")
endif(CMAKE_CL_64)
find_library(DirectX9_LIBRARY NAMES d3d9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
find_library(DirectX9_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
find_library(DirectX9_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
find_library(DirectX9_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
findpkg_finish(DirectX9)
set(DirectX9_LIBRARIES ${DirectX9_LIBRARIES}
${DirectX9_D3DX9_LIBRARY}
${DirectX9_DXERR_LIBRARY}
${DirectX9_DXGUID_LIBRARY}
)
mark_as_advanced(DirectX9_D3DX9_LIBRARY DirectX9_DXERR_LIBRARY DirectX9_DXGUID_LIBRARY
DirectX9_DXGI_LIBRARY DirectX9_D3DCOMPILER_LIBRARY)
endif(WIN32)

@ -0,0 +1,114 @@
#-------------------------------------------------------------------
# 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.
#-------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Find DirectX11 SDK
# Define:
# DirectX11_FOUND
# DirectX11_INCLUDE_DIR
# DirectX11_LIBRARY
# DirectX11_ROOT_DIR
if(WIN32) # The only platform it makes sense to check for DirectX11 SDK
include(FindPkgMacros)
findpkg_begin(DirectX11)
# Get path, convert backslashes as ${ENV_DXSDK_DIR}
getenv_path(DXSDK_DIR)
getenv_path(DIRECTX_HOME)
getenv_path(DIRECTX_ROOT)
getenv_path(DIRECTX_BASE)
# construct search paths
set(DirectX11_PREFIX_PATH
"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
"${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
"C:/apps_x86/Microsoft DirectX SDK*"
"C:/Program Files (x86)/Microsoft DirectX SDK*"
"C:/apps/Microsoft DirectX SDK*"
"C:/Program Files/Microsoft DirectX SDK*"
"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
)
if(OGRE_BUILD_PLATFORM_WINRT)
# Windows 8 SDK has custom layout
set(DirectX11_INC_SEARCH_PATH
"C:/Program Files (x86)/Windows Kits/8.0/Include/shared"
"C:/Program Files (x86)/Windows Kits/8.0/Include/um"
)
set(DirectX11_LIB_SEARCH_PATH
"C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um"
)
endif()
create_search_paths(DirectX11)
# redo search if prefix path changed
clear_if_changed(DirectX11_PREFIX_PATH
DirectX11_LIBRARY
DirectX11_INCLUDE_DIR
)
# dlls are in DirectX11_ROOT_DIR/Developer Runtime/x64|x86
# lib files are in DirectX11_ROOT_DIR/Lib/x64|x86
if(CMAKE_CL_64)
set(DirectX11_LIBPATH_SUFFIX "x64")
else(CMAKE_CL_64)
set(DirectX11_LIBPATH_SUFFIX "x86")
endif(CMAKE_CL_64)
# look for D3D11 components
find_path(DirectX11_INCLUDE_DIR NAMES D3D11Shader.h HINTS ${DirectX11_INC_SEARCH_PATH})
find_library(DirectX11_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
find_library(DirectX11_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
find_library(DirectX11_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
find_library(DirectX11_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
find_library(DirectX11_LIBRARY NAMES d3d11 HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
find_library(DirectX11_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX11_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX11_LIBPATH_SUFFIX})
if (DirectX11_INCLUDE_DIR AND DirectX11_LIBRARY)
set(DirectX11_D3D11_FOUND TRUE)
set(DirectX11_INCLUDE_DIR ${DirectX11_INCLUDE_DIR})
set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES}
${DirectX11_LIBRARY}
${DirectX11_DXGI_LIBRARY}
${DirectX11_DXGUID_LIBRARY}
${DirectX11_D3DCOMPILER_LIBRARY}
)
endif ()
if (DirectX11_D3DX11_LIBRARY)
set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES} ${DirectX11_D3DX11_LIBRARY})
endif ()
if (DirectX11_DXERR_LIBRARY)
set(DirectX11_D3D11_LIBRARIES ${DirectX11_D3D11_LIBRARIES} ${DirectX11_DXERR_LIBRARY})
endif ()
findpkg_finish(DirectX11)
set(DirectX11_LIBRARIES
${DirectX11_D3D11_LIBRARIES}
)
if (OGRE_BUILD_PLATFORM_WINDOWS_PHONE)
set(DirectX11_FOUND TRUE)
set(DirectX11_INCLUDE_DIR "C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/WPSDK/WP80/include" CACHE STRING "" FORCE)
set(DirectX11_LIBRARY "C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/WPSDK/WP80/lib" CACHE STRING "" FORCE)
set(DirectX11_LIBRARIES ${DirectX11_LIBRARY})
set(CMAKE_CXX_FLAGS "/EHsc" CACHE STRING "" FORCE)
endif ()
mark_as_advanced(DirectX11_INCLUDE_DIR
DirectX11_D3D11_LIBRARIES
DirectX11_D3DX11_LIBRARY
DirectX11_DXERR_LIBRARY
DirectX11_DXGUID_LIBRARY
DirectX11_DXGI_LIBRARY
DirectX11_D3DCOMPILER_LIBRARY)
endif(WIN32)

@ -19,58 +19,34 @@ include(FindPkgMacros)
IF (WIN32) #Windows
MESSAGE(STATUS "Looking for MyGUI")
SET(MYGUISDK $ENV{MYGUI_HOME})
SET(MYGUISDK $ENV{MYGUI_HOME})
IF (MYGUISDK)
findpkg_begin ( "MYGUI" )
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 )
find_path ( MYGUI_PLATFORM_INCLUDE_DIRS
MyGUI_OgrePlatform.h
"${MYGUISDK}/Platforms/Ogre/OgrePlatform/include"
NO_DEFAULT_PATH )
SET ( MYGUI_LIB_DIR ${MYGUISDK}/lib ${MYGUISDK}/*/lib )
find_library ( MYGUI_LIBRARIES_REL NAMES
MyGUIEngine.lib
MyGUI.OgrePlatform.lib
HINTS
${MYGUI_LIB_DIR}
PATH_SUFFIXES "" release relwithdebinfo minsizerel )
find_library ( MYGUI_LIBRARIES_DBG NAMES
MyGUIEngine_d.lib
MyGUI.OgrePlatform_d.lib
HINTS
${MYGUI_LIB_DIR}
PATH_SUFFIXES "" debug )
find_library ( MYGUI_PLATFORM_LIBRARIES_REL NAMES
MyGUI.OgrePlatform.lib
HINTS
${MYGUI_LIB_DIR}
PATH_SUFFIXES "" release relwithdebinfo minsizerel )
find_library ( MYGUI_PLATFORM_LIBRARIES_DBG NAMES
MyGUI.OgrePlatform_d.lib
HINTS
${MYGUI_LIB_DIR}
PATH_SUFFIXES "" debug )
make_library_set ( MYGUI_LIBRARIES )
make_library_set ( MYGUI_PLATFORM_LIBRARIES )
MESSAGE ("${MYGUI_LIBRARIES}")
MESSAGE ("${MYGUI_PLATFORM_LIBRARIES}")
#findpkg_finish ( "MYGUI" )
STRING(REGEX REPLACE "[\\]" "/" MYGUISDK "${MYGUISDK}" )
find_path ( MYGUI_INCLUDE_DIRS MyGUI.h "${MYGUISDK}/MyGUIEngine/include" NO_DEFAULT_PATH )
find_path ( MYGUI_PLATFORM_INCLUDE_DIRS MyGUI_OgrePlatform.h "${MYGUISDK}/Platforms/Ogre/OgrePlatform/include" NO_DEFAULT_PATH )
SET ( MYGUI_LIB_DIR ${MYGUISDK}/lib ${MYGUISDK}/*/lib )
if ( MYGUI_STATIC )
set(LIB_SUFFIX "Static")
endif ( MYGUI_STATIC )
find_library ( MYGUI_LIBRARIES_REL NAMES MyGUIEngine${LIB_SUFFIX}.lib MyGUI.OgrePlatform.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" release relwithdebinfo minsizerel )
find_library ( MYGUI_LIBRARIES_DBG NAMES MyGUIEngine${LIB_SUFFIX}_d.lib MyGUI.OgrePlatform_d.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" debug )
find_library ( MYGUI_PLATFORM_LIBRARIES_REL NAMES MyGUI.OgrePlatform.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" release relwithdebinfo minsizerel )
find_library ( MYGUI_PLATFORM_LIBRARIES_DBG NAMES MyGUI.OgrePlatform_d.lib HINTS ${MYGUI_LIB_DIR} PATH_SUFFIXES "" debug )
make_library_set ( MYGUI_LIBRARIES )
make_library_set ( MYGUI_PLATFORM_LIBRARIES )
MESSAGE ("${MYGUI_LIBRARIES}")
MESSAGE ("${MYGUI_PLATFORM_LIBRARIES}")
#findpkg_finish ( "MYGUI" )
ENDIF (MYGUISDK)
IF (OGRESOURCE)
MESSAGE(STATUS "Using MyGUI in OGRE dependencies")

@ -493,14 +493,18 @@ ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/D
if (OGRE_STATIC)
# check if dependencies for plugins are met
if (NOT DirectX_FOUND)
if (NOT DirectX9_FOUND)
set(OGRE_RenderSystem_Direct3D9_FOUND FALSE)
else ()
set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} ${DirectX9_INCLUDE_DIR})
endif ()
if (NOT DirectX_D3D10_FOUND)
set(OGRE_RenderSystem_Direct3D10_FOUND FALSE)
endif ()
if (NOT DirectX_D3D11_FOUND)
set(OGRE_RenderSystem_Direct3D11_FOUND FALSE)
else ()
set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} ${DirectX_D3D11_INCLUDE_DIR})
endif ()
if (NOT OPENGL_FOUND)
set(OGRE_RenderSystem_GL_FOUND FALSE)
@ -513,7 +517,7 @@ if (OGRE_STATIC)
endif ()
set(OGRE_RenderSystem_Direct3D9_LIBRARIES ${OGRE_RenderSystem_Direct3D9_LIBRARIES}
${DirectX_LIBRARIES}
${DirectX9_LIBRARIES}
)
set(OGRE_RenderSystem_Direct3D10_LIBRARIES ${OGRE_RenderSystem_Direct3D10_LIBRARIES}
${DirectX_D3D10_LIBRARIES}

@ -87,7 +87,7 @@ FIND_PATH(SDL2_INCLUDE_DIR SDL.h
)
#MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}")
FIND_LIBRARY(SDL2_LIBRARY_TEMP
FIND_LIBRARY(SDL2_LIBRARY_PATH
NAMES SDL2
HINTS
$ENV{SDL2DIR}
@ -99,6 +99,9 @@ FIND_LIBRARY(SDL2_LIBRARY_TEMP
/opt
)
set(SDL2_LIBRARY_ONLY ${SDL2_LIBRARY_PATH} CACHE STRING "The SDL2 library, with no other libraries.")
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_PATH})
#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}")
IF(NOT SDL2_BUILDING_LIBRARY)

Loading…
Cancel
Save