Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 30 additions & 33 deletions ports/ogre/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,27 @@ vcpkg_from_github(

file(REMOVE "${SOURCE_PATH}/CMake/Packages/FindOpenEXR.cmake")

if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(OGRE_STATIC ON)
else()
set(OGRE_STATIC OFF)
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" OGRE_STATIC)

# Configure features

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
d3d9 OGRE_BUILD_RENDERSYSTEM_D3D9
java OGRE_BUILD_COMPONENT_JAVA
python OGRE_BUILD_COMPONENT_PYTHON
csharp OGRE_BUILD_COMPONENT_CSHARP
overlay OGRE_BUILD_COMPONENT_OVERLAY
zziplib OGRE_CONFIG_ENABLE_ZIP
strict OGRE_RESOURCEMANAGER_STRICT
FEATURES
d3d9 OGRE_BUILD_RENDERSYSTEM_D3D9
java OGRE_BUILD_COMPONENT_JAVA
python OGRE_BUILD_COMPONENT_PYTHON
csharp OGRE_BUILD_COMPONENT_CSHARP
overlay OGRE_BUILD_COMPONENT_OVERLAY
zziplib OGRE_CONFIG_ENABLE_ZIP
strict OGRE_RESOURCEMANAGER_STRICT
)

# OGRE_RESOURCEMANAGER_STRICT need to be 0 for OFF and 1 for ON, because it is used 'as is' in sources
string(REPLACE "OGRE_RESOURCEMANAGER_STRICT=ON" "OGRE_RESOURCEMANAGER_STRICT=1" FEATURE_OPTIONS "${FEATURE_OPTIONS}")
string(REPLACE "OGRE_RESOURCEMANAGER_STRICT=OFF" "OGRE_RESOURCEMANAGER_STRICT=0" FEATURE_OPTIONS "${FEATURE_OPTIONS}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DOGRE_BUILD_DEPENDENCIES=OFF
-DOGRE_BUILD_SAMPLES=OFF
Expand All @@ -65,7 +61,6 @@ vcpkg_configure_cmake(
-DOGRE_BUILD_RENDERSYSTEM_D3D11=ON
-DOGRE_BUILD_RENDERSYSTEM_GL=ON
-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=ON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove:

-DOGRE_BUILD_RENDERSYSTEM_GLES=OFF

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this option doesn't exist on the current source codes.

-DOGRE_BUILD_RENDERSYSTEM_GLES=OFF
-DOGRE_BUILD_RENDERSYSTEM_GLES2=OFF
-DFREETYPE_FOUND=ON
# Optional stuff
Expand All @@ -74,57 +69,59 @@ vcpkg_configure_cmake(
-DOGRE_CMAKE_DIR=share/ogre
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets()
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(GLOB REL_CFGS ${CURRENT_PACKAGES_DIR}/bin/*.cfg)
file(GLOB REL_CFGS "${CURRENT_PACKAGES_DIR}/bin/*.cfg")
if(REL_CFGS)
file(COPY ${REL_CFGS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${REL_CFGS} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(REMOVE ${REL_CFGS})
endif()

file(GLOB DBG_CFGS ${CURRENT_PACKAGES_DIR}/debug/bin/*.cfg)
file(GLOB DBG_CFGS "${CURRENT_PACKAGES_DIR}/debug/bin/*.cfg")
if(DBG_CFGS)
file(COPY ${DBG_CFGS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${DBG_CFGS} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
file(REMOVE ${DBG_CFGS})
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

#Remove OgreMain*.lib from lib/ folder, because autolink would complain, since it defines a main symbol
#manual-link subfolder is here to the rescue!
if(VCPKG_TARGET_IS_WINDOWS)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "Release")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/OgreMain.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/OgreMain.lib)
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/OgreMain.lib" "${CURRENT_PACKAGES_DIR}/lib/manual-link/OgreMain.lib")
else()
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/OgreMainStatic.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/OgreMainStatic.lib)
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/OgreMainStatic.lib" "${CURRENT_PACKAGES_DIR}/lib/manual-link/OgreMainStatic.lib")
endif()
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "Debug")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/OgreMain_d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/OgreMain_d.lib)
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/OgreMain_d.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/OgreMain_d.lib")
else()
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/OgreMainStatic_d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/OgreMainStatic_d.lib)
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/OgreMainStatic_d.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/OgreMainStatic_d.lib")
endif()
endif()

file(GLOB SHARE_FILES ${CURRENT_PACKAGES_DIR}/share/ogre/*.cmake)
file(GLOB SHARE_FILES "${CURRENT_PACKAGES_DIR}/share/ogre/*.cmake")
foreach(SHARE_FILE ${SHARE_FILES})
file(READ "${SHARE_FILE}" _contents)
string(REPLACE "lib/OgreMain" "lib/manual-link/OgreMain" _contents "${_contents}")
file(WRITE "${SHARE_FILE}" "${_contents}")
endforeach()
endif()

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/OGRE/Bites/OgreSGTechniqueResolverListener.h" "OgreRTShaderSystem.h" "../RTShaderSystem/OgreRTShaderSystem.h")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a bug in upstream, has it been reported there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it seems unlikely that this is the only header affected; in the issue report the user says that they would have to edit "hundreds of header files", not only this one. I'm not positive what the correct fix is but I don't think this is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. Since this only affects the usage in the project. I'm not sure if this is a upstream bug. In user's project sample, there is only one place that needs to update. For other header files, it is due to the user didn't include the header path correctly in his project.

The same kinds of problem may be also in other header files. I also have no better way to solve this. I'll report this problem to upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upstream issue OGRECave/ogre#2172


# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

vcpkg_copy_pdbs()
12 changes: 10 additions & 2 deletions ports/ogre/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{
"name": "ogre",
"version-string": "1.12.9",
"port-version": 5,
"version-semver": "1.12.9",
"port-version": 6,
"description": "3D Object-Oriented Graphics Rendering Engine",
"homepage": "https://github.com/OGRECave/ogre",
"dependencies": [
"pugixml",
"sdl2",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
],
"default-features": [
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4546,7 +4546,7 @@
},
"ogre": {
"baseline": "1.12.9",
"port-version": 5
"port-version": 6
},
"ogre-next": {
"baseline": "2019-10-20-1",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/ogre.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "9c35ef4f5b30d305e6a128f9531692a64eae1b4a",
"version-semver": "1.12.9",
"port-version": 6
},
{
"git-tree": "322b9a5290ce1656aa66b684b07d1e327b18eeeb",
"version-string": "1.12.9",
Expand Down