Create OGRE 2.1 Empty project

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Create OGRE 2.1 Empty project

Post by 123iamking »

According to this article, I can setup OGRE empty project by the following step:

Setup OGRE (refer this article) successfully first, then you have
: C:\GIT\Ogre\build (Ogre is the git source repository, build folder is the Binary of Ogre source created by CMake)
* : C:\GIT\Ogre\Samples\2.0\Tutorials\EmptyProject
** :C:\GIT\Ogre\Dependencies (The content of this folder is bin, include, lib)

Now gonna make empty project
1. Copy folder EmptyProject (*), to D:\EmptyProject
2. Copy folder C:\GIT\Ogre to D:\EmptyProject\Dependencies\Ogre (of course the folder ** is copied with it too)
3. Now the folder structure is right, just run CMake any everything gonna be OK.

But the problem is: why do I have to copy the folder C:\GIT\Ogre every time I make a new project, can I just link the Source to C:\GIT\Ogre?
I have tried on this idea, I read the cmake code (I'm new to cmake)

1. Copy folder EmptyProject (*), to D:\EmptyProject
Now I don't want to copy folder C:\GIT\Ogre, I try to link it.
2. I set
OGRE_SOURCE = C:\GIT\Ogre
OGRE_BINARIES = C:\GIT\Ogre\build
3. I hit configure - I got error said it couldn't find the file: C:\GIT\Ogre\CMake\Packages\FindSDL2.cmake . Well, it's a little weird, I think it's best for the code to determine the FindSDL2.cmake base on the OGRE_SOURCE, instead of the ${CMAKE_CURRENT_SOURCE_DIR} . Oh well, I workaround by copy the folder C:\GIT\Ogre\CMake\Packages to D:\EmptyProject\Dependencies\Ogre\CMake\Packages .
4. I hit configure again, now it gives me error: SDL2_DIR-NOTFOUND, SDL2_INCLUDE_DIR-NOTFOUND. Weird, it found: SDL2MAIN_LIBRARY = C:/GIT/Ogre/Dependencies/lib/SDL2main.lib , but not found SDL2_INCLUDE_DIR = C:/GIT/Ogre/Dependencies/include/SDL2? I even try to copy the folder C:\GIT\Ogre\Dependencies to D:\EmptyProject\Dependencies\Ogre\Dependencies, but it couldn't found either.

So you see, I think that the CMake script should allow to link OGRE library instead of copy this library into each of your project. I want my OGRE project always up-to-date, so I just pull git and build at one place, any every other project just refer to it, I don't want to re-copy it every time I update OGRE library.

Thanks for reading.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Create OGRE 2.1 Empty project

Post by dark_sylinc »

Setting OGRE_SOURCE & OGRE_BINARIES should work. I should check there are no bugs though (i.e. hardcoded paths).
But it's also possible SDL2's path for some reason got stuck using the old path.

Manually configuring the paths for CMake is possible.

Though something I prefer 1000x times (since it's much less pain) is to use symbolic links (assuming you have NTFS in Windows).

Open Command Line with admin privileges, and type:

Code: Select all

cd Dependencies
mklink /D Ogre D:\Path\To\Ogre
This will create a symbolic link to wherever Ogre is, without the need to have a real copy for every Ogre project you have. Very useful, fast, and saves a lot of hard disk space.
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

Thank dark_sylinc, Using symbolic links is a good solution. But I still expect an update to make OGRE_SOURCE & OGRE_BINARIES works. Anyway, in Using Ogre in your App said
OGRE_DEPENDENCIES: Path to Ogre's dependencies. By default it assumes it's Dependencies/Ogre/Dependencies or Dependencies/Ogre/iOSDependencies. Only used when Ogre was configured as static build.
I think it's better to give the user the right to edit this path too (currently, I only see OGRE_SOURCE & OGRE_BINARIES - I want OGRE_DEPENDENCIES showed by default)

Currently, I have folder structure like this:
1. E:\Source\OgreSDK : The Git repository of Ogre
2. E:\Source\OgreDeps : The Git repository of Ogre Deps
3. E:\Build\OgreSDK : The Binary of Ogre by CMake
4. E:\Build\OgreDeps : The Binary of Ogre Deps by CMake
5. E:\Project\EmptyProject: The Ogre empty project.

I only work with 5, and 1-4 I want it to be untouched & shared by many Ogre empty projects. So I thinks it is good to set up Ogre Empty project like this:
Set:
OGRE_SOURCE = E:\Source\OgreSDK
OGRE_BINARIES = E:\Build\OgreSDK
OGRE_DEPENDENCIES = E:\Build\OgreDeps\ogredeps
And just set like this and configure Ogre - Do nothing more - That's what I really want. Do you think it's a good idea? :D
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

123iamking wrote: I only work with 5, and 1-4 I want it to be untouched & shared by many Ogre empty projects. So I thinks it is good to set up Ogre Empty project like this:
Set:
OGRE_SOURCE = E:\Source\OgreSDK
OGRE_BINARIES = E:\Build\OgreSDK
OGRE_DEPENDENCIES = E:\Build\OgreDeps\ogredeps
And just set like this and configure Ogre - Do nothing more - That's what I really want. Do you think it's a good idea? :D
I finally make it work with CMake.
First, I need to edit the file EmptyProject\CMake\Dependencies\OGRE.cmake
Add:

Code: Select all

set( OGRE_DEPENDENCIES "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Ogre/Dependencies" CACHE STRING "Path to OGRE Dependencies" )
Change:

Code: Select all

set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Ogre/CMake/Packages" )
...
set( CMAKE_PREFIX_PATH "${OGRE_SOURCE}/Dependencies ${CMAKE_PREFIX_PATH}" )
To

Code: Select all

set( CMAKE_MODULE_PATH "${OGRE_SOURCE}/CMake/Packages" )
...
set( CMAKE_PREFIX_PATH "${OGRE_DEPENDENCIES} ${CMAKE_PREFIX_PATH}" )
So the final OGRE.cmake gonna look like this:

Code: Select all

#-------------------------------------------------------------------
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------

# Finds the string "#define RESULT_NAME" in OgreBuildSettings.h
# (provided as a string in an argument)
function( findOgreBuildSetting OGRE_BUILD_SETTINGS_STR RESULT_NAME )
	string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define ${RESULT_NAME}" TMP_RESULT )
	if( NOT TMP_RESULT EQUAL -1 )
		set( ${RESULT_NAME} 1 PARENT_SCOPE )
	else()
		unset( ${RESULT_NAME} PARENT_SCOPE )
	endif()
endfunction()

#----------------------------------------------------------------------------------------

# On Windows it's a regular copy.
# On Apple it does nothing
# On Linux, it copies both libOgreMain.so.2.1 and its symbolic link libOgreMain.so
function( copyWithSymLink SRC DST )
	if( NOT APPLE )
		if( UNIX )
			get_filename_component( RESOLVED_LIB_PATH ${SRC} REALPATH )
			file( COPY ${RESOLVED_LIB_PATH} DESTINATION ${DST} )
		endif()
		file( COPY ${SRC} DESTINATION ${DST} )
	endif()
endfunction()

#----------------------------------------------------------------------------------------

# Finds if Ogre has been built a library with LIBRARY_NAME.dll,
# and if so sets the string for Plugins.cfg in CFG_VARIABLE.
macro( findPluginAndSetPath BUILD_TYPE CFG_VARIABLE LIBRARY_NAME )
	set( REAL_LIB_PATH ${LIBRARY_NAME} )
	if( ${BUILD_TYPE} STREQUAL "Debug" )
		set( REAL_LIB_PATH ${REAL_LIB_PATH}_d )
	endif()

	if( WIN32 )
		set( REAL_LIB_PATH "${OGRE_BINARIES}/bin/${BUILD_TYPE}/${REAL_LIB_PATH}.dll" )
	else()
		set( REAL_LIB_PATH "${OGRE_BINARIES}/lib/${REAL_LIB_PATH}.so" )
	endif()

	if( EXISTS ${REAL_LIB_PATH} )
		# DLL Exists, set the variable for Plugins.cfg
		if( ${BUILD_TYPE} STREQUAL "Debug" )
			set( ${CFG_VARIABLE} "Plugin=${LIBRARY_NAME}_d" )
		else()
			set( ${CFG_VARIABLE} "Plugin=${LIBRARY_NAME}" )
		endif()

		# Copy the DLLs to the folders.
		copyWithSymLink( ${REAL_LIB_PATH} "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Plugins" )
	endif()
endmacro()

#----------------------------------------------------------------------------------------

# Generates Plugins.cfg file out of user-editable Plugins.cfg.in file. Will automatically disable those plugins
# that were not built
# Copies all relevant DLLs: RenderSystem files, OgreOverlay, Hlms PBS & Unlit.
macro( setupPluginFileFromTemplate BUILD_TYPE )
	if( NOT APPLE )
		file( MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Plugins" )
	endif()

	findPluginAndSetPath( ${BUILD_TYPE} OGRE_PLUGIN_RS_D3D11	RenderSystem_Direct3D11 )
	findPluginAndSetPath( ${BUILD_TYPE} OGRE_PLUGIN_RS_GL3PLUS	RenderSystem_GL3Plus )

	if( ${BUILD_TYPE} STREQUAL "Debug" )
		configure_file( ${CMAKE_SOURCE_DIR}/CMake/Templates/Plugins.cfg.in ${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/plugins_d.cfg )
	else()
		configure_file( ${CMAKE_SOURCE_DIR}/CMake/Templates/Plugins.cfg.in ${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/plugins.cfg )
	endif()

	if( CMAKE_BUILD_TYPE )
		if( ${CMAKE_BUILD_TYPE} STREQUAL ${BUILD_TYPE} )
			set( OGRE_BUILD_TYPE_MATCHES 1 )
		endif()
	endif()

	# Copy
	# "${OGRE_BINARIES}/bin/${BUILD_TYPE}/OgreMain.dll" to "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}
	# and the other DLLs as well. On non-Windows machines, we can only the DLLs for the current build.
	if( WIN32 OR OGRE_BUILD_TYPE_MATCHES )
		# Lists of DLLs to copy
		set( OGRE_DLLS
				OgreMain
				OgreOverlay
				OgreHlmsPbs
				OgreHlmsUnlit
			)

		# Deal with OS and Ogre naming shenanigans:
		#	* OgreMain.dll vs libOgreMain.so
		#	* OgreMain_d.dll vs libOgreMain_d.so in Debug mode.
		if( WIN32 )
			set( DLL_OS_PREFIX "" )
			if( ${BUILD_TYPE} STREQUAL "Debug" )
				set( DLL_OS_SUFFIX "_d.dll" )
			else()
				set( DLL_OS_SUFFIX ".dll" )
			endif()
		else()
			set( DLL_OS_PREFIX "lib" )
			if( ${BUILD_TYPE} STREQUAL "Debug" )
				set( DLL_OS_SUFFIX "_d.so" )
			else()
				set( DLL_OS_SUFFIX ".so" )
			endif()
		endif()

		# On Windows DLLs are in build/bin/Debug & build/bin/Release;
		# On Linux DLLs are in build/Debug/lib.
		if( WIN32 )
			set( OGRE_DLL_PATH "${OGRE_BINARIES}/bin/${BUILD_TYPE}" )
		else()
			set( OGRE_DLL_PATH "${OGRE_BINARIES}/lib/" )
		endif()

		# Do not copy anything if we don't find OgreMain.dll (likely Ogre was not build)
		list( GET OGRE_DLLS 0 DLL_NAME )
		if( EXISTS "${OGRE_DLL_PATH}/${DLL_OS_PREFIX}${DLL_NAME}${DLL_OS_SUFFIX}" )
			foreach( DLL_NAME ${OGRE_DLLS} )
				copyWithSymLink( "${OGRE_DLL_PATH}/${DLL_OS_PREFIX}${DLL_NAME}${DLL_OS_SUFFIX}"
								 "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}" )
			endforeach()
		endif()
	endif()

	unset( OGRE_PLUGIN_RS_D3D11 )
	unset( OGRE_PLUGIN_RS_GL3PLUS )
	unset( OGRE_BUILD_TYPE_MATCHES )
endmacro()

#----------------------------------------------------------------------------------------

# Creates Resources.cfg out of user-editable CMake/Templates/Resources.cfg.in
function( setupResourceFileFromTemplate )
	message( STATUS "Generating ${CMAKE_SOURCE_DIR}/bin/Data/resources2.cfg from template
		${CMAKE_SOURCE_DIR}/CMake/Templates/Resources.cfg.in" )
	if( APPLE )
		set( OGRE_MEDIA_DIR "" )
	else()
		set( OGRE_MEDIA_DIR "../" )
	endif()
	configure_file( ${CMAKE_SOURCE_DIR}/CMake/Templates/Resources.cfg.in ${CMAKE_SOURCE_DIR}/bin/Data/resources2.cfg )
endfunction()

#----------------------------------------------------------------------------------------

function( setupOgreSamplesCommon )
	message( STATUS "Copying OgreSamplesCommon cpp and header files to
		${CMAKE_SOURCE_DIR}/include/OgreCommon
		${CMAKE_SOURCE_DIR}/src/OgreCommon/" )
	include_directories( "${CMAKE_SOURCE_DIR}/include/OgreCommon/" )
	file( COPY "${OGRE_SOURCE}/Samples/2.0/Common/include/"	DESTINATION "${CMAKE_SOURCE_DIR}/include/OgreCommon/" )
	file( COPY "${OGRE_SOURCE}/Samples/2.0/Common/src/"		DESTINATION "${CMAKE_SOURCE_DIR}/src/OgreCommon/" )
endfunction()

#----------------------------------------------------------------------------------------

# Main call to setup Ogre.
macro( setupOgre OGRE_SOURCE, OGRE_BINARIES, OGRE_LIBRARIES_OUT )

# Guess the paths.
set( OGRE_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Ogre" CACHE STRING "Path to OGRE source code (see http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CMake+Quick+Start+Guide)" )
if( WIN32 )
	set( OGRE_BINARIES "${OGRE_SOURCE}/build" CACHE STRING "Path to OGRE's build folder generated by CMake" )
	link_directories( "${OGRE_BINARIES}/lib/$(ConfigurationName)" )
elseif( APPLE )
	set( OGRE_BINARIES "${OGRE_SOURCE}/build" CACHE STRING "Path to OGRE's build folder generated by CMake" )
	link_directories( "${OGRE_BINARIES}/lib/$(PLATFORM_NAME)/$(CONFIGURATION)" )
else()
	set( OGRE_BINARIES "${OGRE_SOURCE}/build/${CMAKE_BUILD_TYPE}" CACHE STRING "Path to OGRE's build folder generated by CMake" )
	link_directories( "${OGRE_BINARIES}/lib" )
endif()

set( OGRE_DEPENDENCIES "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Ogre/Dependencies" CACHE STRING "Path to OGRE Dependencies" )

set( CMAKE_MODULE_PATH "${OGRE_SOURCE}/CMake/Packages" )

# Ogre config
include_directories( "${OGRE_SOURCE}/OgreMain/include" )

# Ogre includes
include_directories( "${OGRE_BINARIES}/include" )
include_directories( "${OGRE_SOURCE}/Components/Hlms/Common/include" )
include_directories( "${OGRE_SOURCE}/Components/Hlms/Unlit/include" )
include_directories( "${OGRE_SOURCE}/Components/Hlms/Pbs/include" )
include_directories( "${OGRE_SOURCE}/Components/Overlay/include" )

# Parse OgreBuildSettings.h to see if it's a static build
set( OGRE_DEPENDENCY_LIBS "" )
file( READ "${OGRE_BINARIES}/include/OgreBuildSettings.h" OGRE_BUILD_SETTINGS_STR )
string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_STATIC_LIB" OGRE_STATIC )
if( NOT OGRE_STATIC EQUAL -1 )
	message( STATUS "Detected static build of Ogre" )
	set( OGRE_STATIC "Static" )

	# Static builds must link against its dependencies
	addStaticDependencies( OGRE_SOURCE, OGRE_BINARIES, OGRE_BUILD_SETTINGS_STR, OGRE_DEPENDENCY_LIBS )
else()
	message( STATUS "Detected DLL build of Ogre" )
	unset( OGRE_STATIC )
endif()
findOgreBuildSetting( ${OGRE_BUILD_SETTINGS_STR} OGRE_BUILD_RENDERSYSTEM_METAL )
unset( OGRE_BUILD_SETTINGS_STR )

if( NOT APPLE )
  # Create debug libraries with _d suffix
  set( OGRE_DEBUG_SUFFIX "_d" )
endif()

if( NOT IOS )
	set( CMAKE_PREFIX_PATH "${OGRE_DEPENDENCIES} ${CMAKE_PREFIX_PATH}" )
	find_package( SDL2 )
	if( NOT SDL2_FOUND )
		message( "Could not find SDL2. https://www.libsdl.org/" )
	else()
		message( STATUS "Found SDL2" )
		include_directories( ${SDL2_INCLUDE_DIR} )
		set( OGRE_DEPENDENCY_LIBS ${OGRE_DEPENDENCY_LIBS} ${SDL2_LIBRARY} )
	endif()
endif()

set( OGRE_LIBRARIES
	debug OgreMain${OGRE_STATIC}${OGRE_DEBUG_SUFFIX}
	debug OgreOverlay${OGRE_STATIC}${OGRE_DEBUG_SUFFIX}
	debug OgreHlmsUnlit${OGRE_STATIC}${OGRE_DEBUG_SUFFIX}
	debug OgreHlmsPbs${OGRE_STATIC}${OGRE_DEBUG_SUFFIX}

	optimized OgreMain${OGRE_STATIC}
	optimized OgreOverlay${OGRE_STATIC}
	optimized OgreHlmsUnlit${OGRE_STATIC}
	optimized OgreHlmsPbs${OGRE_STATIC}
	${OGRE_DEPENDENCY_LIBS}
	)

if( OGRE_STATIC )
	if( OGRE_BUILD_RENDERSYSTEM_METAL )
		message( STATUS "Detected Metal RenderSystem. Linking against it." )
		set( OGRE_LIBRARIES
			${OGRE_LIBRARIES}
			debug RenderSystem_Metal${OGRE_STATIC}${OGRE_DEBUG_SUFFIX}
			optimized RenderSystem_Metal${OGRE_STATIC} )
		include_directories( "${OGRE_SOURCE}/RenderSystems/Metal/include" )
	endif()
endif()

set( OGRE_LIBRARIES_OUT ${OGRE_LIBRARIES} )

# Plugins.cfg
if( NOT APPLE )
	set( OGRE_PLUGIN_DIR "Plugins" )
endif()

message( STATUS "Copying Hlms data files from Ogre repository" )
file( COPY "${OGRE_SOURCE}/Samples/Media/Hlms/Common"	DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Hlms" )
file( COPY "${OGRE_SOURCE}/Samples/Media/Hlms/Pbs"		DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Hlms" )
file( COPY "${OGRE_SOURCE}/Samples/Media/Hlms/Unlit"	DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Hlms" )

message( STATUS "Copying Common data files from Ogre repository" )
file( COPY "${OGRE_SOURCE}/Samples/Media/2.0/scripts/materials/Common"	DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Materials" )
file( COPY "${OGRE_SOURCE}/Samples/Media/packs/DebugPack.zip"	DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data" )

message( STATUS "Copying DLLs and generating Plugins.cfg for Debug" )
setupPluginFileFromTemplate( "Debug" )
message( STATUS "Copying DLLs and generating Plugins.cfg for Release" )
setupPluginFileFromTemplate( "Release" )
message( STATUS "Copying DLLs and generating Plugins.cfg for RelWithDebInfo" )
setupPluginFileFromTemplate( "RelWithDebInfo" )
message( STATUS "Copying DLLs and generating Plugins.cfg for MinSizeRel" )
setupPluginFileFromTemplate( "MinSizeRel" )

setupResourceFileFromTemplate()
setupOgreSamplesCommon()

endmacro()

#----------------------------------------------------------------------------------------

macro( addStaticDependencies OGRE_SOURCE, OGRE_BINARIES, OGRE_BUILD_SETTINGS_STR, OGRE_DEPENDENCY_LIBS )
	if( WIN32 )
		# Win32 seems to be the only one actually doing Debug builds for Dependencies w/ _d
		set( OGRE_DEP_DEBUG_SUFFIX "_d" )
	endif()

	if( WIN32 )
		set( OGRE_DEPENDENCIES "${OGRE_SOURCE}/Dependencies/lib/$(ConfigurationName)" CACHE STRING
			 "Path to OGRE's dependencies folder. Only used in Static Builds" )
	elseif( IOS )
		set( OGRE_DEPENDENCIES "${OGRE_SOURCE}/iOSDependencies/lib/$(CONFIGURATION)" CACHE STRING
			 "Path to OGRE's dependencies folder. Only used in Static Builds" )
	else()
		set( OGRE_DEPENDENCIES "${OGRE_SOURCE}/Dependencies/lib" CACHE STRING
			 "Path to OGRE's dependencies folder. Only used in Static Builds" )
	endif()
	link_directories( ${OGRE_DEPENDENCIES} )

	string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_NO_FREEIMAGE 0" OGRE_USES_FREEIMAGE )
	if( NOT OGRE_USES_FREEIMAGE EQUAL -1 )
		message( STATUS "Static lib needs FreeImage. Linking against it." )
		set( TMP_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS}
			debug FreeImage${OGRE_DEP_DEBUG_SUFFIX}
			optimized FreeImage )
	endif()

	string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_NO_ZIP_ARCHIVE 0" OGRE_USES_ZIP )
	if( NOT OGRE_USES_FREEIMAGE EQUAL -1 )
		message( STATUS "Static lib needs zzip. Linking against it." )
		set( TMP_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS}
			debug zzip${OGRE_DEP_DEBUG_SUFFIX}
			optimized zzip )
	endif()

	set( OGRE_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS} )
endmacro()

I hope this fix will be updated to the official OGRE source :D
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

After a while playing with CMake, I find out something: you can add a new file to the project just by creating new files (with notepad or anyway you like) in folder .\include and .\src , and create solution with CMake again, and the new files are added to the project. Awesome.
But still, I encounter a problem, if I want to edit the files in .\include\OgreCommon and .\src\OgreCommon (Like add new methods, changing namespace name,...), how do I do that. Once I run CMake again, these files get overwritten from the Ogre source. Please help.
Swarthon
Gnoblar
Posts: 7
Joined: Thu Aug 13, 2015 2:28 pm
x 2

Re: Create OGRE 2.1 Empty project

Post by Swarthon »

I think the problem comes from the call of the function setupOgreSamplesCommon at line 281.
By calling this function, you copy the OgreCommon files, so all your modifications are lost when you run CMake again.
If you want to copy them only at the setup, maybe add something like if the files exist don't copy them.
If you add

Code: Select all

if(EXISTS ${CMAKE_SOURCE_DIR}/include/OgreCommon)
before calling setupOgreSamplesCommon, it should solve the problem
I didn't test what I'm saying, so if I'm wrong, sorry
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

Swarthon wrote:I think the problem comes from the call of the function setupOgreSamplesCommon at line 281.
By calling this function, you copy the OgreCommon files, so all your modifications are lost when you run CMake again.
If you want to copy them only at the setup, maybe add something like if the files exist don't copy them.
If you add

Code: Select all

if(EXISTS ${CMAKE_SOURCE_DIR}/include/OgreCommon)
before calling setupOgreSamplesCommon, it should solve the problem
I didn't test what I'm saying, so if I'm wrong, sorry
Thank man, you give me the direction (you forgot to put NOT before EXISTS :) ). Anyway, I have tested and here is the edit code for the new setupOgreSamplesCommon in the file OGRE.cmake

Code: Select all

function( setupOgreSamplesCommon )
	message( STATUS "Copying OgreSamplesCommon cpp and header files to
		${CMAKE_SOURCE_DIR}/include/OgreCommon
		${CMAKE_SOURCE_DIR}/src/OgreCommon/" )
	include_directories( "${CMAKE_SOURCE_DIR}/include/OgreCommon/" )
	if(NOT EXISTS ${CMAKE_SOURCE_DIR}/include/OgreCommon)
		file( COPY "${OGRE_SOURCE}/Samples/2.0/Common/include/"	DESTINATION "${CMAKE_SOURCE_DIR}/include/OgreCommon/" )
	endif()
	if(NOT EXISTS ${CMAKE_SOURCE_DIR}/src/OgreCommon)
		file( COPY "${OGRE_SOURCE}/Samples/2.0/Common/src/"		DESTINATION "${CMAKE_SOURCE_DIR}/src/OgreCommon/" )
	endif()
endfunction()
Once again, thanks for your help, my friend :D
Swarthon
Gnoblar
Posts: 7
Joined: Thu Aug 13, 2015 2:28 pm
x 2

Re: Create OGRE 2.1 Empty project

Post by Swarthon »

No problem, first time helping someone. Good job for the .cmake !
Somtin
Gnoblar
Posts: 10
Joined: Thu Nov 03, 2016 6:57 am
x 1

Re: Create OGRE 2.1 Empty project

Post by Somtin »

I'm also having some issues with the empty project. I followed the "Speeding things up" instructions here: https://ogrecave.github.io/ogre/api/2.1 ... urApp.html

It wouldn't compile due to SDL not being in the path, so I added it to the include path, and also the following libraries:
SDL2.lib
SDL2main.lib
winmm.lib
version.lib
imm32.lib

It compiles now, but when I run it, there's no graphics engines to choose from! My bin/Debug/plugins_d.cfg file looks like:

Code: Select all

# Defines plugins to load

# Define plugin folder
PluginFolder=Plugins

# Define plugins
Plugin=RenderSystem_Direct3D11_d
Plugin=RenderSystem_GL3Plus_d
If I click cancel, I get an assertion. Debug output below:

Code: Select all

'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\EmptyProject.exe'. Symbols loaded.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\kernel32.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreOverlay_d.dll'. Symbols loaded.
'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreMain_d.dll'. Symbols loaded.
'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsUnlit_d.dll'. Symbols loaded.
'EmptyProject.exe' (Win32): Unloaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsUnlit_d.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsPbs_d.dll'. Symbols loaded.
'EmptyProject.exe' (Win32): Unloaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsPbs_d.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp120d.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp120d.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsUnlit_d.dll'. Symbols loaded.
'EmptyProject.exe' (Win32): Unloaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsUnlit_d.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp120d.dll'
'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsUnlit_d.dll'. Symbols loaded.
'EmptyProject.exe' (Win32): Loaded 'C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\OgreHlmsPbs_d.dll'. Symbols loaded.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput8.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\XInput1_4.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\deviceaccess.dll'. Cannot find or open the PDB file.
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Mesh2
Registering ResourceManager for type OldSkeleton
MovableObjectFactory for type 'ParticleSystem' registered.
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
ArchiveFactory for archive type EmbeddedZip registered.
DDS codec registering
FreeImage version: 3.15.3
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic
ETC codec registering
Registering ResourceManager for type HighLevelGpuProgram
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Item' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject2' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
MovableObjectFactory for type 'WireAabb' registered.
First-chance exception at 0x74EEB832 in EmptyProject.exe: Microsoft C++ exception: Ogre::FileNotFoundException at memory location 0x010FE564.
../Data/plugins_d.cfg not found, automatic plugin loading disabled.
*-*-* OGRE Initialising
*-*-* Version 2.1.0unstable (Tindalos)
First-chance exception at 0x74EEB832 in EmptyProject.exe: Microsoft C++ exception: Ogre::FileNotFoundException at memory location 0x010FE948.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.15063.483_none_6dad63fefc436da8\comctl32.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\TextInputFramework.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'EmptyProject.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usermgrcli.dll'. Cannot find or open the PDB file.
*-*-* OGRE Shutdown
Unregistering ResourceManager for type OldSkeleton
Unregistering ResourceManager for type Mesh2
Unregistering ResourceManager for type Mesh
Unregistering ResourceManager for type Material
Unregistering ResourceManager for type HighLevelGpuProgram
The thread 0x1b4 has exited with code 0 (0x0).
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msasn1.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\crypt32.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\wintrust.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\setupapi.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\hid.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\dinput8.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\deviceaccess.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\devobj.dll'
'EmptyProject.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\XInput1_4.dll'
The thread 0x3908 has exited with code 0 (0x0).
Assertion failed!

Program: ...ments\projects\ogre-empty\bin\Debug\OgreMain_d.dll
File: C:\Users\TheAlmightyChin\Documents\...\OgreLog...ger.cpp
Line: 43

Expression: msSingleton

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)The thread 0x3afc has exited with code 3 (0x3).
The thread 0x2958 has exited with code 3 (0x3).
The thread 0x14ac has exited with code 3 (0x3).
The thread 0x3ae8 has exited with code 3 (0x3).
The program '[964] EmptyProject.exe' has exited with code 3 (0x3).
The samples in the Ogre solution work fine in that I can select a render system and run the samples, but I also get the assertion when exiting. Any ideas?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Create OGRE 2.1 Empty project

Post by dark_sylinc »

Somtin wrote:The samples in the Ogre solution work fine in that I can select a render system and run the samples, but I also get the assertion when exiting. Any ideas?
That assertion is a recent bug. It was fixed today. Pull again and it will be fixed. Sorry about that :)
Somtin
Gnoblar
Posts: 10
Joined: Thu Nov 03, 2016 6:57 am
x 1

Re: Create OGRE 2.1 Empty project

Post by Somtin »

Yeah that fixed the assertion, which is good! But I still have the problem where there is nothing in the "Rendering Subsystem" drop down box when I run the EmptyProject :(
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Create OGRE 2.1 Empty project

Post by dark_sylinc »

Three questions:
  1. Is there a plugins_d.cfg file in C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Data\plugins_d.cfg ? That's where the code is currently looking for plugins_d.cfg according to the Ogre.log
  2. Is there a RenderSystem_Direct3D11_d.dll and RenderSystem_GL3Plus_d.dll files in C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\Plugins ?
  3. Are you launching from Visual Studio? If so, it's possible the relative paths are messed up due to the working dir being wrong. This is a common issue with Visual Studio. Go to config settings (Alt+F7) Configuration Properties -> Debugging -> Working Directory; set it to C:\Users\TheAlmightyChin\Documents\projects\ogre-empty\bin\Debug\
Somtin
Gnoblar
Posts: 10
Joined: Thu Nov 03, 2016 6:57 am
x 1

Re: Create OGRE 2.1 Empty project

Post by Somtin »

plugins_d.cfg is in the ogre-empty/bin/Debug folder, not the Data folder. Moving it into the Data folder fixed it! I have both render systems showing up and it works fine!

Yes I am running from Visual Studio, and I have already updated the working directory.
IndieGuy11
Halfling
Posts: 50
Joined: Fri May 19, 2017 8:09 pm
x 2

Re: Create OGRE 2.1 Empty project

Post by IndieGuy11 »

Edit: Did not see that you solved your issue. Ill just leave this here for future reference.

Visual Studio loves to have the directory not in the build directory.

I would breakpoint this line and see where its trying to look...

Loook for: OGRE_NEW Ogre::Root -- Ignore the additional variables, we modified it to fit our needs.

Code: Select all

m_Root = OGRE_NEW Ogre::Root(pluginsPath + "plugins" + pluginMode, pluginsPath + "ogre.cfg", pluginsPath + "ogre.log");
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

Somtin wrote:Yeah that fixed the assertion, which is good! But I still have the problem where there is nothing in the "Rendering Subsystem" drop down box when I run the EmptyProject :(
About that, I'd like to add a quick workaround for future reference.
1. In the folder .\bin\Data of Empty Project must have 2 file: plugins_d.cfg, resources2.cfg.
2. In Visual Studio, Right click project Empty Project and choose Properties (Alt+Enter). Go to: Debugging > Set [Working Directory] to $(OutDir)
Note: Step 2 can be skipped, but if you skip step 2, it will not work when you press F5 in Visual Studio to run exe but you have to manual open the exe in the .\bin\Debug folder.

Explain why 2 step above: Put breakpoint in Visual Studio: File .\src\OgreCommon\GraphicsSystem.cpp , code

Code: Select all

#if OGRE_DEBUG_MODE && !((OGRE_PLATFORM == OGRE_PLATFORM_APPLE) || (OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS))
        pluginsPath = mResourcePath + "plugins_d.cfg";
    #else
        pluginsPath = mResourcePath + "plugins.cfg";
You should see that mResourcePath = "../Data/", so the pluginsPath = "../Data/plugins_d.cfg".
tlogre
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 7:27 pm
x 1

Re: Create OGRE 2.1 Empty project

Post by tlogre »

I was able to compile and run the Empty Project.
I am using VS2017

Based on the posts in this thread and my own setup, the following are the essential steps I needed to perform (after the CMake Process)

1. Make a symbolic link from EmptyProject\Dependencies to Ogre path… In my case:
While in EmptyProject\Dependencies enter the command:
mklink /D Ogre E:\user\Develop\Ogre3D\Ogre
2. Add …\Ogre\Dependencies\build\ogredeps\include\SDL2 to my include path
3. Based on several link errors, added the following to the linker input libraries:
• SDL2main.lib
• SDL2.lib
• Imm32.lib
• Winmm.lib
• Mincore.lib
• version.lib
4. Copy plugins_d.cfg from EmptyProject\bin\Debug to EmptyProject\bin\Data
5. Change the Working Directory (under configuration, Debug) to $(OutDir)
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

Setup Ogre 2.1 Empty project can even be easier. Try this CMake project that I made (Thank dark_sylinc for the original CMake Empty project :D )

With this, there only 3 steps (read the ReadMe.txt in the download package for more info):
1. Give CMake the path of Ogre source & Ogre deps, then create project with CMake.
2. Set [Working Directory] to $(OutDir) for Visual Studio (I try to set it automatically with CMake - but I can't find a way to do so, if you successfully do this with CMake, please share)
3. Copy config files (resources2.cfg & plugins_d.cfg) for Ogre.
Done!

Please try & share your experience.
tlogre
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 7:27 pm
x 1

Re: Create OGRE 2.1 Empty project

Post by tlogre »

Thank you.

I was able to use your CMake project and build and run the program (I am using VS2017 on Windows)

I needed to configure my SDL directories and libraries before running the configuration (You may want to add a reminder to do so in the ReadMe.text file)

And...

I needed to copy the plugins_d.cfg file to the bin\Data directory.

123iamking wrote:Setup Ogre 2.1 Empty project can even be easier. Try this CMake project that I made (Thank dark_sylinc for the original CMake Empty project :D )

With this, there only 3 steps (read the ReadMe.txt in the download package for more info):
1. Give CMake the path of Ogre source & Ogre deps, then create project with CMake.
2. Set [Working Directory] to $(OutDir) for Visual Studio (I try to set it automatically with CMake - but I can't find a way to do so, if you successfully do this with CMake, please share)
3. Copy config files (resources2.cfg & plugins_d.cfg) for Ogre.
Done!

Please try & share your experience.
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

tlogre wrote: I needed to configure my SDL directories and libraries before running the configuration (You may want to add a reminder to do so in the ReadMe.text file)
No need to, because OGRE_DEPENDENCIES already contains that.

Code: Select all

E:\Source\_build\OgreDeps\ogredeps\include\SDL2
You just only need to set in CMake:

Code: Select all

OGRE_DEPENDENCIES= 	E:/Source/_build/OgreDeps/ogredeps
And CMake will automatically config SDL directories for you :D
tlogre wrote: I needed to copy the plugins_d.cfg file to the bin\Data directory.
I did write that in the ReadMe.txt

Code: Select all

--------Config file
In the folder .\bin\Data of Empty Project must have the file: plugins_d.cfg.
My goal is setup empty project with just 1 step

Code: Select all

1. Give CMake the path of Ogre source & Ogre deps, then create project with CMake.
It's totally possible to reduce step 2 & 3, but will require more effort to edit the CMake script :D
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: Create OGRE 2.1 Empty project

Post by 123iamking »

Ok, today I tweak the Empty project that:
1st, Easier to setup.
2nd, Not only Ogre setup but also Bullet physic setup.

Download here

The final result shall be a ball falling from the sky (Bullet Hello World)
Image

And there are only 2 steps to setup this project (not include the steps that you build Ogre & Bullet):
step 1: Set CMake settings for this project
Image
step 2: Set Visual Studio's [Working Directory] to $(OutDir)
Image

And we done.
Post Reply