Add ogre port

This commit is contained in:
Silvio 2016-12-18 23:00:35 +01:00
parent 835693ce97
commit effbdfbb91
6 changed files with 178 additions and 0 deletions

View File

@ -0,0 +1,17 @@
diff --git a/OgreMain/CMakeLists.txt b/OgreMain/CMakeLists.txt
index 6a43378..22f950e 100644
--- a/OgreMain/CMakeLists.txt
+++ b/OgreMain/CMakeLists.txt
@@ -220,7 +220,11 @@ endif ()
list(APPEND HEADER_FILES ${THREAD_HEADER_FILES})
# Add needed definitions and nedmalloc include dir
-add_definitions(-DOGRE_NONCLIENT_BUILD -DFREEIMAGE_LIB -D_MT -D_USRDLL)
+# vcpkg specific patch: we removed -DFREEIMAGE_LIB
+# from the defines, because vcpkg's freeimage can
+# be both static or dynamic, and FREEIMAGE_LIB
+# remove all the symbol exporting declaration from FreeImage.h
+add_definitions(-DOGRE_NONCLIENT_BUILD -D_MT -D_USRDLL)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/nedmalloc)
set(LIBRARIES ${PLATFORM_LIBS})

View File

@ -0,0 +1,19 @@
diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt
index 4c496b7..feb4017 100644
--- a/CMake/CMakeLists.txt
+++ b/CMake/CMakeLists.txt
@@ -14,10 +14,12 @@
#############################################################
if(WIN32 OR APPLE)
- set(OGRE_CMAKE_DIR "CMake")
+ set(OGRE_DEFAULT_CMAKE_DIR "CMake")
else()
- set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
+ set(OGRE_DEFAULT_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
endif()
+set(OGRE_CMAKE_DIR ${OGRE_DEFAULT_CMAKE_DIR} CACHE STRING "Install directory for CMake files.")
+mark_as_advanced(OGRE_DEFAULT_CMAKE_DIR)
set(INST_FILES
Packages/FindOIS.cmake

View File

@ -0,0 +1,41 @@
diff --git a/CMake/Utils/OgreConfigTargets.cmake b/CMake/Utils/OgreConfigTargets.cmake
index c6b3b40..2da7ebf 100644
--- a/CMake/Utils/OgreConfigTargets.cmake
+++ b/CMake/Utils/OgreConfigTargets.cmake
@@ -41,15 +41,28 @@ if (NOT OGRE_RUNTIME_OUTPUT)
set(OGRE_RUNTIME_OUTPUT ${OGRE_BINARY_DIR}/bin)
endif ()
+option(OGRE_NO_INSTALLATION_SUFFIXES_ON_WIN32 "Do not install in configuration-specific directories in Windows" FALSE)
+
if (WIN32)
- set(OGRE_RELEASE_PATH "/Release")
- set(OGRE_RELWDBG_PATH "/RelWithDebInfo")
- set(OGRE_MINSIZE_PATH "/MinSizeRel")
- set(OGRE_DEBUG_PATH "/Debug")
- set(OGRE_LIB_RELEASE_PATH "/Release")
- set(OGRE_LIB_RELWDBG_PATH "/RelWithDebInfo")
- set(OGRE_LIB_MINSIZE_PATH "/MinSizeRel")
- set(OGRE_LIB_DEBUG_PATH "/Debug")
+ if (OGRE_NO_INSTALLATION_SUFFIXES_ON_WIN32)
+ set(OGRE_RELEASE_PATH "")
+ set(OGRE_RELWDBG_PATH "")
+ set(OGRE_MINSIZE_PATH "")
+ set(OGRE_DEBUG_PATH "")
+ set(OGRE_LIB_RELEASE_PATH "")
+ set(OGRE_LIB_RELWDBG_PATH "")
+ set(OGRE_LIB_MINSIZE_PATH "")
+ set(OGRE_LIB_DEBUG_PATH "/")
+ else ()
+ set(OGRE_RELEASE_PATH "/Release")
+ set(OGRE_RELWDBG_PATH "/RelWithDebInfo")
+ set(OGRE_MINSIZE_PATH "/MinSizeRel")
+ set(OGRE_DEBUG_PATH "/Debug")
+ set(OGRE_LIB_RELEASE_PATH "/Release")
+ set(OGRE_LIB_RELWDBG_PATH "/RelWithDebInfo")
+ set(OGRE_LIB_MINSIZE_PATH "/MinSizeRel")
+ set(OGRE_LIB_DEBUG_PATH "/Debug")
+ endif ()
set(OGRE_PLUGIN_PATH "/opt")
set(OGRE_SAMPLE_PATH "/opt/samples")
elseif (UNIX)

4
ports/ogre/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: ogre
Version: 1.9.0
Build-Depends: freeimage, freetype, zlib, zziplib
Description: 3D Object-Oriented Graphics Rendering Engine

View File

@ -0,0 +1,37 @@
#.rst:
# OGREConfig
# ------------
#
# Dummy OGREConfig to simplify use of OGRE-provided FindOGRE module.
#
# This file is provided as part of the vcpkg port of OGRE .
# It is meant to be found automatically by find_package(OGRE),
# but then offloads all the real work to the FindOGRE module by temporarly
# adding its directory to CMAKE_MODULE_PATH
#
# See the FindOGRE module to see the defined variables::
#
# Temporarly add the directory in which OGREConfig.cmake is contained to
# get access to the FindOGRE module
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(ORIGINAL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${SELF_DIR})
find_package(OGRE MODULE)
# Leave CMAKE_MODULE_PATH as we found it
set(CMAKE_MODULE_PATH ${ORIGINAL_CMAKE_MODULE_PATH})
# Handle components
# imported from https://github.com/Kitware/CMake/blob/v3.7.1/Modules/CMakePackageConfigHelpers.cmake#L300
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
check_required_components(OGRE)

60
ports/ogre/portfile.cmake Normal file
View File

@ -0,0 +1,60 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sinbad-ogre-dd30349ea667)
vcpkg_download_distfile(ARCHIVE
URLS "https://bitbucket.org/sinbad/ogre/get/v1-9-0.zip"
FILENAME "ogre-v1-9-0.zip"
SHA512 de7315a2450ecf0d9073e6a8f0c54737e041016f7ad820556d10701c7d23eefab9d3473476a8e95447c30ab21518b8e4cfb0271db72494ea67a3dea284c9a3d3
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-use-vcpkg-freeimage.patch"
"${CMAKE_CURRENT_LIST_DIR}/0002-ogre-cmake-dir-as-option.patch"
"${CMAKE_CURRENT_LIST_DIR}/0003-use-flat-installation.patch"
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(OGRE_STATIC ON)
else()
set(OGRE_STATIC OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DOGRE_USE_BOOST:BOOL=OFF
-DOGRE_BUILD_RENDERSYSTEM_D3D9:BOOL=OFF
-DOGRE_INSTALL_DEPENDENCIES:BOOL=OFF
-DOGRE_COPY_DEPENDENCIES:BOOL=OFF
-DOGRE_BUILD_TOOLS:BOOL=OFF
-DOGRE_CMAKE_DIR:STRING=share/ogre
-DOGRE_STATIC:BOOL=${OGRE_STATIC}
-DOGRE_INSTALL_SAMPLES:BOOL=OFF
-DOGRE_INSTALL_TOOLS:BOOL=OFF
# We disable this option because it is broken and we rely on vcpkg_copy_pdbs
-DOGRE_INSTALL_PDB:BOOL=OFF
-DOGRE_BUILD_DOCS:BOOL=OFF
-DOGRE_INSTALL_DOCS:BOOL=OFF
-DOGRE_INSTALL_SAMPLES_SOURCE:BOOL=OFF
-DOGRE_NO_INSTALLATION_SUFFIXES_ON_WIN32:BOOL=ON
)
vcpkg_install_cmake()
# Add a OGREConfig.cmake to simplify the process of finding vcpkg OGRE
file(COPY ${CMAKE_CURRENT_LIST_DIR}/OGREConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/ogre)
# Remove debug includes
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Remove debug CMake files
# Note that at the moment OGRE do not export imported targets,
# so we do not need to copy the debug imported targets in the
# release CMake path
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/ogre)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/ogre/COPYING ${CURRENT_PACKAGES_DIR}/share/ogre/copyright)
vcpkg_copy_pdbs()