Skip to content

Commit 9bf809b

Browse files
zi-mvicroms
authored andcommitted
[ogre-next] Add new port (#8677)
* ogre-next * add rename_config_cmake.patch * add fix_find_package_sdl2.patch * Update ports/ogre-next/portfile.cmake Co-Authored-By: Victor Romero <[email protected]> * Use vcpkg_check_features to simplify the portfile a little bit (thanks to @vicroms) * add features in CONTROL file * add "Building steps for ogre-next[d3d9]"
1 parent 84bafa6 commit 9bf809b

File tree

6 files changed

+484
-0
lines changed

6 files changed

+484
-0
lines changed

ports/ogre-next/CONTROL

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Source: ogre-next
2+
Version: 2019-10-20
3+
Build-Depends: zlib, freeimage, freetype, rapidjson, openvr, boost-thread, boost-date-time, poco, tbb, sdl2, tinyxml, zziplib
4+
Homepage: https://github.com/OGRECave/ogre-next
5+
Description: Ogre 2.1 & 2.2 - scene-oriented, flexible 3D engine written in C++
6+
7+
Feature: d3d9
8+
Description: Build Direct3D9 RenderSystem
9+
10+
Feature: csharp
11+
Description: Build csharp bindings
12+
13+
Feature: java
14+
Description: Build Java (JNI) bindings
15+
16+
Feature: python
17+
Description: Build Python bindings
18+
Build-Depends: python3
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#[[
2+
3+
Building steps for ogre-next[d3d9]:
4+
5+
1. Download and install "Microsoft DirectX SDK"
6+
https://www.microsoft.com/en-us/download/confirmation.aspx?id=6812
7+
8+
2. Set env variable
9+
set DXSDK_DIR=C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)
10+
11+
3. Install port
12+
.\vcpkg.exe install ogre-next[d3d9] --triplet x64-windows
13+
14+
]]
15+
16+
set(VCPKG_ENV_PASSTHROUGH DXSDK_DIR)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake
2+
index 4b67ed8cb..7da194820 100644
3+
--- a/CMake/Dependencies.cmake
4+
+++ b/CMake/Dependencies.cmake
5+
@@ -292,11 +292,11 @@ macro_log_feature(PYTHONLIBS_FOUND "Python" "Language bindings to use OGRE from
6+
# Find sdl2
7+
if(NOT ANDROID AND NOT EMSCRIPTEN)
8+
# find script does not work in cross compilation environment
9+
- find_package(SDL2)
10+
+ find_package(SDL2 CONFIG)
11+
macro_log_feature(SDL2_FOUND "SDL2" "Simple DirectMedia Library needed for input handling in samples" "https://www.libsdl.org/" FALSE "" "")
12+
if(SDL2_FOUND AND WIN32 AND NOT SDL2_BINARY)
13+
# fix linking static SDL2 on windows
14+
- set(SDL2_LIBRARY ${SDL2_LIBRARY} winmm.lib imm32.lib version.lib)
15+
+ set(SDL2_LIBRARY SDL2::SDL2 winmm.lib imm32.lib version.lib)
16+
endif()
17+
endif()
18+

ports/ogre-next/portfile.cmake

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# This portfile is based (shamelessly copied and adapted a bit) on 'ogre' portfile.
2+
3+
include(vcpkg_common_functions)
4+
5+
if(NOT VCPKG_TARGET_IS_WINDOWS)
6+
message("${PORT} currently requires the following library from the system package manager:\n Xaw\n\nIt can be installed on Ubuntu systems via apt-get install libxaw7-dev")
7+
endif()
8+
9+
vcpkg_from_github(
10+
OUT_SOURCE_PATH SOURCE_PATH
11+
REPO OGRECave/ogre-next
12+
REF 8083067c1835147de5d82015347d95c710e36bc0
13+
SHA512 2660f739def7076b42009ba932a27532f2a20e7be8ec2674aff29116c7dcd7f2d75564d8ce07bef3dba13ece5293d604573ad4f8734f6086c1750127f52834cd
14+
HEAD_REF master
15+
PATCHES
16+
toolchain_fixes.patch
17+
rename_config_cmake.patch
18+
fix_find_package_sdl2.patch
19+
)
20+
21+
file(REMOVE "${SOURCE_PATH}/CMake/Packages/FindOpenEXR.cmake")
22+
23+
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
24+
set(OGRE_STATIC ON)
25+
else()
26+
set(OGRE_STATIC OFF)
27+
endif()
28+
29+
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
30+
d3d9 OGRE_BUILD_RENDERSYSTEM_D3D9
31+
java OGRE_BUILD_COMPONENT_JAVA
32+
python OGRE_BUILD_COMPONENT_PYTHON
33+
csharp OGRE_BUILD_COMPONENT_CSHARP
34+
)
35+
36+
vcpkg_configure_cmake(
37+
SOURCE_PATH ${SOURCE_PATH}
38+
PREFER_NINJA
39+
OPTIONS
40+
-DOGRE_BUILD_DEPENDENCIES=OFF
41+
-DOGRE_BUILD_SAMPLES=OFF
42+
-DOGRE_BUILD_TESTS=OFF
43+
-DOGRE_BUILD_TOOLS=OFF
44+
-DOGRE_BUILD_MSVC_MP=ON
45+
-DOGRE_BUILD_MSVC_ZM=ON
46+
-DOGRE_INSTALL_DEPENDENCIES=OFF
47+
-DOGRE_INSTALL_DOCS=OFF
48+
-DOGRE_INSTALL_PDB=OFF
49+
-DOGRE_INSTALL_SAMPLES=OFF
50+
-DOGRE_INSTALL_TOOLS=OFF
51+
-DOGRE_INSTALL_CMAKE=ON
52+
-DOGRE_INSTALL_VSPROPS=OFF
53+
-DOGRE_STATIC=${OGRE_STATIC}
54+
-DOGRE_CONFIG_THREAD_PROVIDER=std
55+
-DOGRE_BUILD_RENDERSYSTEM_D3D11=ON
56+
-DOGRE_BUILD_RENDERSYSTEM_GL=ON
57+
-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=ON
58+
-DOGRE_BUILD_RENDERSYSTEM_GLES=OFF
59+
-DOGRE_BUILD_RENDERSYSTEM_GLES2=OFF
60+
# Optional stuff
61+
${FEATURE_OPTIONS}
62+
# vcpkg specific stuff
63+
-DOGRE_CMAKE_DIR=share/ogre-next
64+
)
65+
66+
vcpkg_install_cmake()
67+
vcpkg_fixup_cmake_targets()
68+
69+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
70+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
71+
72+
file(GLOB REL_CFGS ${CURRENT_PACKAGES_DIR}/bin/*.cfg)
73+
if(REL_CFGS)
74+
file(COPY ${REL_CFGS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
75+
file(REMOVE ${REL_CFGS})
76+
endif()
77+
78+
file(GLOB DBG_CFGS ${CURRENT_PACKAGES_DIR}/debug/bin/*.cfg)
79+
if(DBG_CFGS)
80+
file(COPY ${DBG_CFGS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
81+
file(REMOVE ${DBG_CFGS})
82+
endif()
83+
84+
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
85+
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
86+
endif()
87+
88+
#Remove OgreMain*.lib from lib/ folder, because autolink would complain, since it defines a main symbol
89+
#manual-link subfolder is here to the rescue!
90+
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
91+
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "Release")
92+
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
93+
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
94+
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/OgreMain.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/OgreMain.lib)
95+
else()
96+
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/OgreMainStatic.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/OgreMainStatic.lib)
97+
endif()
98+
endif()
99+
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "Debug")
100+
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
101+
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
102+
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/OgreMain_d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/OgreMain_d.lib)
103+
else()
104+
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/OgreMainStatic_d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/OgreMainStatic_d.lib)
105+
endif()
106+
endif()
107+
108+
file(GLOB SHARE_FILES ${CURRENT_PACKAGES_DIR}/share/ogre-next/*.cmake)
109+
foreach(SHARE_FILE ${SHARE_FILES})
110+
file(READ "${SHARE_FILE}" _contents)
111+
string(REPLACE "lib/OgreMain" "lib/manual-link/OgreMain" _contents "${_contents}")
112+
file(WRITE "${SHARE_FILE}" "${_contents}")
113+
endforeach()
114+
endif()
115+
116+
# Handle copyright
117+
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/ogre-next RENAME copyright)
118+
119+
vcpkg_copy_pdbs()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/CMake/InstallResources.cmake b/CMake/InstallResources.cmake
2+
index 79f7514..79bc033 100644
3+
--- a/CMake/InstallResources.cmake
4+
+++ b/CMake/InstallResources.cmake
5+
@@ -215,7 +215,7 @@ if(NOT DEFINED OGRE_CMAKE_DIR)
6+
set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
7+
endif()
8+
endif()
9+
-configure_package_config_file(${OGRE_TEMPLATES_DIR}/OGREConfig.cmake.in ${PROJECT_BINARY_DIR}/cmake/OGREConfig.cmake
10+
+configure_package_config_file(${OGRE_TEMPLATES_DIR}/OGREConfig.cmake.in ${PROJECT_BINARY_DIR}/cmake/ogre-nextConfig.cmake
11+
INSTALL_DESTINATION ${OGRE_CMAKE_DIR}
12+
PATH_VARS CMAKE_INSTALL_PREFIX)
13+
write_basic_package_version_file(
14+
@@ -223,7 +223,7 @@ write_basic_package_version_file(
15+
VERSION ${OGRE_VERSION}
16+
COMPATIBILITY SameMajorVersion)
17+
install(FILES
18+
- ${PROJECT_BINARY_DIR}/cmake/OGREConfig.cmake
19+
+ ${PROJECT_BINARY_DIR}/cmake/ogre-nextConfig.cmake
20+
${PROJECT_BINARY_DIR}/cmake/OGREConfigVersion.cmake
21+
DESTINATION ${OGRE_CMAKE_DIR}
22+
)

0 commit comments

Comments
 (0)