Skip to content

Commit

Permalink
Add OGRE_USE_NEW_PROJECT_NAME CMake option
Browse files Browse the repository at this point in the history
When enabled, all projects and libraries will be named "OgreNext"
instead of Ogre.
  • Loading branch information
darksylinc committed Apr 2, 2022
1 parent ce8ecb0 commit 419e584
Show file tree
Hide file tree
Showing 24 changed files with 212 additions and 117 deletions.
41 changes: 25 additions & 16 deletions CMake/Packages/FindOGRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
#
# Additionally this script searches for the following optional
# parts of the Ogre package:
# Plugin_CgProgramManager, Plugin_ParticleFX,
# RenderSystem_GL, RenderSystem_GL3Plus,
# RenderSystem_GLES, RenderSystem_GLES2,
# RenderSystem_Direct3D9, RenderSystem_Direct3D11
# Paging, Terrain, Volume, Overlay
# Plugin_ParticleFX,
# RenderSystem_GL3Plus,
# RenderSystem_GLES2,
# RenderSystem_Direct3D11
# Paging, Volume, Overlay
#
# For each of these components, the following variables are defined:
#
Expand Down Expand Up @@ -69,21 +69,31 @@ else ()
endif ()

if(APPLE AND NOT OGRE_STATIC)
set(OGRE_LIBRARY_NAMES "Ogre${OGRE_LIB_SUFFIX}")
set(OGRE_LIBRARY_NAMES "OgreNext${OGRE_LIB_SUFFIX}" "Ogre${OGRE_LIB_SUFFIX}")
else()
set(OGRE_LIBRARY_NAMES "OgreMain${OGRE_LIB_SUFFIX}")
set(OGRE_LIBRARY_NAMES "OgreNextMain${OGRE_LIB_SUFFIX}" "OgreMain${OGRE_LIB_SUFFIX}")
endif()
get_debug_names(OGRE_LIBRARY_NAMES)

# construct search paths from environmental hints and
# OS specific guesses
if (WIN32)
set(OGRE_PREFIX_GUESSES
${ENV_PROGRAMFILES}/OGRE-Next
C:/OgreNextSDK
${ENV_PROGRAMFILES}/OGRE
C:/OgreSDK
)
elseif (UNIX)
set(OGRE_PREFIX_GUESSES
/opt/ogre-next
/opt/OGRE-Next
/usr/lib${LIB_SUFFIX}/ogre-next
/usr/lib${LIB_SUFFIX}/OGRE-Next
/usr/local/lib${LIB_SUFFIX}/ogre-next
/usr/local/lib${LIB_SUFFIX}/OGRE-Next
$ENV{HOME}/ogre-next
$ENV{HOME}/OGRE-Next
/opt/ogre
/opt/OGRE
/usr/lib${LIB_SUFFIX}/ogre
Expand Down Expand Up @@ -146,9 +156,9 @@ else()
endif ()

# redo search if any of the environmental hints changed
set(OGRE_COMPONENTS Paging Terrain Volume Overlay
Plugin_CgProgramManager Plugin_ParticleFX
RenderSystem_Direct3D11 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GL3Plus RenderSystem_GLES RenderSystem_GLES2)
set(OGRE_COMPONENTS Paging Volume Overlay
Plugin_ParticleFX
RenderSystem_Direct3D11 RenderSystem_GL3Plus RenderSystem_GLES2)
set(OGRE_RESET_VARS
OGRE_CONFIG_INCLUDE_DIR OGRE_INCLUDE_DIR
OGRE_FRAMEWORK_INCLUDES OGRE_FRAMEWORK_PATH OGRE_LIBRARY_FWK OGRE_LIBRARY_REL OGRE_LIBRARY_DBG
Expand Down Expand Up @@ -359,9 +369,9 @@ set(OGRE_LIBRARY_DIRS ${OGRE_LIBRARY_DIR_REL} ${OGRE_LIBRARY_DIR_DBG})
# find binaries
if (NOT OGRE_STATIC)
if (WIN32)
find_file(OGRE_BINARY_REL NAMES "OgreMain.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
find_file(OGRE_BINARY_REL NAMES "OgreNextMain.dll" "OgreMain.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel)
find_file(OGRE_BINARY_DBG NAMES "OgreMain_d.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
find_file(OGRE_BINARY_DBG NAMES "OgreNextMain_d.dll" "OgreMain_d.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
PATH_SUFFIXES "" Debug )
endif()
mark_as_advanced(OGRE_BINARY_REL OGRE_BINARY_DBG)
Expand All @@ -387,7 +397,7 @@ macro(ogre_find_component COMPONENT HEADER PATH_HINTS)
set(OGRE_${COMPONENT}_FIND_QUIETLY ${OGRE_FIND_QUIETLY})
findpkg_begin(OGRE_${COMPONENT})
find_path(OGRE_${COMPONENT}_INCLUDE_DIR NAMES ${HEADER} HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE} PATH_SUFFIXES ${PATH_HINTS} ${COMPONENT} OGRE/${COMPONENT} )
set(OGRE_${COMPONENT}_LIBRARY_NAMES "Ogre${COMPONENT}${OGRE_LIB_SUFFIX}")
set(OGRE_${COMPONENT}_LIBRARY_NAMES "OgreNext${COMPONENT}${OGRE_LIB_SUFFIX}" "Ogre${COMPONENT}${OGRE_LIB_SUFFIX}")
get_debug_names(OGRE_${COMPONENT}_LIBRARY_NAMES)
find_library(OGRE_${COMPONENT}_LIBRARY_REL NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" "Release" "RelWithDebInfo" "MinSizeRel")
find_library(OGRE_${COMPONENT}_LIBRARY_DBG NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" "Debug")
Expand All @@ -397,8 +407,8 @@ macro(ogre_find_component COMPONENT HEADER PATH_HINTS)
# find binaries
if (NOT OGRE_STATIC)
if (WIN32)
find_file(OGRE_${COMPONENT}_BINARY_REL NAMES "Ogre${COMPONENT}.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_REL} PATH_SUFFIXES "" bin bin/Release bin/RelWithDebInfo bin/MinSizeRel Release)
find_file(OGRE_${COMPONENT}_BINARY_DBG NAMES "Ogre${COMPONENT}_d.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_DBG} PATH_SUFFIXES "" bin bin/Debug Debug)
find_file(OGRE_${COMPONENT}_BINARY_REL NAMES "OgreNext${COMPONENT}.dll" "Ogre${COMPONENT}.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_REL} PATH_SUFFIXES "" bin bin/Release bin/RelWithDebInfo bin/MinSizeRel Release)
find_file(OGRE_${COMPONENT}_BINARY_DBG NAMES "OgreNext${COMPONENT}_d.dll" "Ogre${COMPONENT}_d.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_DBG} PATH_SUFFIXES "" bin bin/Debug Debug)
endif()
mark_as_advanced(OGRE_${COMPONENT}_BINARY_REL OGRE_${COMPONENT}_BINARY_DBG)
endif()
Expand Down Expand Up @@ -505,7 +515,6 @@ macro(ogre_find_plugin PLUGIN HEADER)
endmacro(ogre_find_plugin)

ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include)
ogre_find_plugin(RenderSystem_GL OgreGLRenderSystem.h RenderSystems/GL/include)
ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus/include)
ogre_find_plugin(RenderSystem_GLES2 OgreGLES2RenderSystem.h RenderSystems/GLES2/include)
ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)
Expand Down
6 changes: 2 additions & 4 deletions CMake/Utils/AndroidMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ macro(create_android_proj ANDROID_PROJECT_TARGET)
##################################################################

if(OGRE_BUILD_RENDERSYSTEM_GLES2)
SET(DEPENDENCIES OgreMain RenderSystem_GLES2)
else()
SET(DEPENDENCIES OgreMain RenderSystem_GLES)
SET(DEPENDENCIES ${OGRE_NEXT}Main RenderSystem_GLES2)
endif()

SET(DEPENDENCIES ${DEPENDENCIES} OgreTerrain OgreRTShaderSystem OgreMeshLodGenerator OgreOverlay OgrePaging OgreVolume Plugin_ParticleFX Plugin_OctreeSceneManager)
SET(DEPENDENCIES ${DEPENDENCIES} ${OGRE_NEXT}MeshLodGenerator ${OGRE_NEXT}Overlay ${OGRE_NEXT}Paging ${OGRE_NEXT}Volume Plugin_ParticleFX)
add_dependencies(${ANDROID_PROJECT_TARGET} ${DEPENDENCIES})
set(DEPEND_STATIC_LIBS "")
foreach(DEPENDENCY ${DEPENDENCIES})
Expand Down
20 changes: 15 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,24 @@ if (APPLE AND OGRE_BUILD_RENDERSYSTEM_METAL)
endif ()
endif (APPLE AND OGRE_BUILD_RENDERSYSTEM_METAL)

# This option needs to be set now
option(OGRE_USE_NEW_PROJECT_NAME
"Libraries containing Ogre name will be called OgreNext, e.g. 'OgreNext.dll' instead of 'Ogre.dll'"
FALSE)
if( OGRE_USE_NEW_PROJECT_NAME )
set( OGRE_NEXT "OgreNext" )
else()
set( OGRE_NEXT "Ogre" )
endif()

# Find dependencies
include(Dependencies)
# definitions for samples
set(OGRE_LIBRARIES OgreMain)
set(OGRE_MeshLodGenerator_LIBRARIES OgreMeshLodGenerator)
set(OGRE_Paging_LIBRARIES OgrePaging)
set(OGRE_Terrain_LIBRARIES OgreTerrain)
set(OGRE_Volume_LIBRARIES OgreVolume)
set(OGRE_LIBRARIES ${OGRE_NEXT}Main)
set(OGRE_MeshLodGenerator_LIBRARIES ${OGRE_NEXT}MeshLodGenerator)
set(OGRE_Paging_LIBRARIES ${OGRE_NEXT}Paging)
set(OGRE_Terrain_LIBRARIES ${OGRE_NEXT}Terrain)
set(OGRE_Volume_LIBRARIES ${OGRE_NEXT}Volume)

# Specify build paths
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OGRE_BINARY_DIR}/lib")
Expand Down
14 changes: 7 additions & 7 deletions Components/Hlms/Pbs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Configure Ogre HLMS Physically Based Shading for OpenGL 3.3+ and D3D11 build

PROJECT(OgreHlmsPbs)
PROJECT(${OGRE_NEXT}HlmsPbs)

file(
GLOB HEADER_FILES
Expand Down Expand Up @@ -40,16 +40,16 @@ if( OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS )
ogre_add_component_include_dir( PlanarReflections )
endif()

ogre_add_library(OgreHlmsPbs ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(OgreHlmsPbs PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreHlmsPbs OgreMain)
ogre_add_library(${OGRE_NEXT}HlmsPbs ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(${OGRE_NEXT}HlmsPbs PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(${OGRE_NEXT}HlmsPbs ${OGRE_NEXT}Main)

if( OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS )
target_link_libraries( OgreHlmsPbs OgrePlanarReflections )
target_link_libraries( ${OGRE_NEXT}HlmsPbs ${OGRE_NEXT}PlanarReflections )
endif()

ogre_config_framework(OgreHlmsPbs)
ogre_config_component(OgreHlmsPbs)
ogre_config_framework(${OGRE_NEXT}HlmsPbs)
ogre_config_component(${OGRE_NEXT}HlmsPbs)

install (DIRECTORY include/
DESTINATION include/OGRE/Hlms/Pbs
Expand Down
12 changes: 6 additions & 6 deletions Components/Hlms/Unlit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Configure Ogre HLMS User Interface (2D) for OpenGL 3.3+ and D3D11 build

PROJECT(OgreHlmsUnlit)
PROJECT(${OGRE_NEXT}HlmsUnlit)

file(
GLOB HEADER_FILES
Expand All @@ -26,12 +26,12 @@ file(
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Common/include)

ogre_add_library(OgreHlmsUnlit ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(OgreHlmsUnlit PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreHlmsUnlit OgreMain)
ogre_add_library(${OGRE_NEXT}HlmsUnlit ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(${OGRE_NEXT}HlmsUnlit PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(${OGRE_NEXT}HlmsUnlit ${OGRE_NEXT}Main)

ogre_config_framework(OgreHlmsUnlit)
ogre_config_component(OgreHlmsUnlit)
ogre_config_framework(${OGRE_NEXT}HlmsUnlit)
ogre_config_component(${OGRE_NEXT}HlmsUnlit)

install (DIRECTORY include/
DESTINATION include/OGRE/Hlms/Unlit
Expand Down
14 changes: 7 additions & 7 deletions Components/MeshLodGenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# MeshLodGenerator optional component
############################################################

PROJECT(OgreMeshLodGenerator)
PROJECT(${OGRE_NEXT}MeshLodGenerator)

# define header and source files for the library
file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
Expand All @@ -25,16 +25,16 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${OGRE_SOURCE_DIR}/OgreMain/include)

# setup target
ogre_add_library(OgreMeshLodGenerator ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgreMeshLodGenerator PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreMeshLodGenerator OgreMain)
ogre_add_library(${OGRE_NEXT}MeshLodGenerator ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(${OGRE_NEXT}MeshLodGenerator PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(${OGRE_NEXT}MeshLodGenerator ${OGRE_NEXT}Main)
if (OGRE_CONFIG_THREADS)
target_link_libraries(OgreMeshLodGenerator ${OGRE_THREAD_LIBRARIES})
target_link_libraries(${OGRE_NEXT}MeshLodGenerator ${OGRE_THREAD_LIBRARIES})
endif ()

# install
ogre_config_framework(OgreMeshLodGenerator)
ogre_config_component(OgreMeshLodGenerator)
ogre_config_framework(${OGRE_NEXT}MeshLodGenerator)
ogre_config_component(${OGRE_NEXT}MeshLodGenerator)

install(FILES ${HEADER_FILES}
DESTINATION include/OGRE/MeshLodGenerator
Expand Down
14 changes: 7 additions & 7 deletions Components/Overlay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Overlay optional component
############################################################

PROJECT(OgreOverlay)
PROJECT(${OGRE_NEXT}Overlay)

# define header and source files for the library
file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
Expand All @@ -29,16 +29,16 @@ ogre_add_component_include_dir(Hlms/Unlit)
ogre_add_component_include_dir(Hlms/Common)

# setup target
ogre_add_library(OgreOverlay ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgreOverlay PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreOverlay OgreMain ${FREETYPE_LIBRARIES} OgreHlmsUnlit )
ogre_add_library(${OGRE_NEXT}Overlay ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(${OGRE_NEXT}Overlay PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(${OGRE_NEXT}Overlay ${OGRE_NEXT}Main ${FREETYPE_LIBRARIES} ${OGRE_NEXT}HlmsUnlit )
if (OGRE_CONFIG_THREADS)
target_link_libraries(OgreOverlay ${OGRE_THREAD_LIBRARIES})
target_link_libraries(${OGRE_NEXT}Overlay ${OGRE_THREAD_LIBRARIES})
endif ()

# install
ogre_config_framework(OgreOverlay)
ogre_config_component(OgreOverlay)
ogre_config_framework(${OGRE_NEXT}Overlay)
ogre_config_component(${OGRE_NEXT}Overlay)

install(FILES ${HEADER_FILES}
DESTINATION include/OGRE/Overlay
Expand Down
12 changes: 6 additions & 6 deletions Components/PlanarReflections/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#-------------------------------------------------------------------


PROJECT(OgrePlanarReflections)
PROJECT(${OGRE_NEXT}PlanarReflections)

file(
GLOB HEADER_FILES
Expand All @@ -23,12 +23,12 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

add_definitions( -DOgrePlanarReflections_EXPORTS )

ogre_add_library(OgrePlanarReflections ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(OgrePlanarReflections PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgrePlanarReflections OgreMain)
ogre_add_library(${OGRE_NEXT}PlanarReflections ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(${OGRE_NEXT}PlanarReflections PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(${OGRE_NEXT}PlanarReflections ${OGRE_NEXT}Main)

ogre_config_framework(OgrePlanarReflections)
ogre_config_component(OgrePlanarReflections)
ogre_config_framework(${OGRE_NEXT}PlanarReflections)
ogre_config_component(${OGRE_NEXT}PlanarReflections)

install(FILES ${HEADER_FILES}
DESTINATION include/OGRE/PlanarReflections
Expand Down
12 changes: 6 additions & 6 deletions Components/SceneFormat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#-------------------------------------------------------------------


PROJECT(OgreSceneFormat)
PROJECT(${OGRE_NEXT}SceneFormat)

file(
GLOB HEADER_FILES
Expand All @@ -26,12 +26,12 @@ ogre_add_component_include_dir(Hlms/Pbs)

add_definitions( -DOgreSceneFormat_EXPORTS )

ogre_add_library(OgreSceneFormat ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(OgreSceneFormat PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(OgreSceneFormat OgreMain OgreHlmsPbs)
ogre_add_library(${OGRE_NEXT}SceneFormat ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(${OGRE_NEXT}SceneFormat PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
target_link_libraries(${OGRE_NEXT}SceneFormat ${OGRE_NEXT}Main ${OGRE_NEXT}HlmsPbs)

ogre_config_framework(OgreSceneFormat)
ogre_config_component(OgreSceneFormat)
ogre_config_framework(${OGRE_NEXT}SceneFormat)
ogre_config_component(${OGRE_NEXT}SceneFormat)

install(FILES ${HEADER_FILES}
DESTINATION include/OGRE/SceneFormat
Expand Down
Loading

0 comments on commit 419e584

Please sign in to comment.