Here is the short version. In the following conditions:
- get TBB sources, then convert the VS project file to VS2012 project file (can be automated);
- get Ogre from source;
- set TBB as threading provider for Ogre;
- add some CMake code to make Ogre link with tbb (I can provide the code it's nothing special);
- generate VS2012 U3 32 bit version of the Ogre projects;
Then on compilation I get this error:
Code: Select all
1>e:\projects\games\netrush\netrush_dependencies\ogre\ogremain\include\OgreAtomicScalar.h(206): error C3861: 'InterlockedIncrement64': identifier not found
1> e:\projects\games\netrush\netrush_dependencies\ogre\ogremain\include\OgreAtomicScalar.h(200) : while compiling class template member function 'unsigned int Ogre::AtomicScalar<T>::operator ++(void)'
1> with
1> [
1> T=unsigned int
1> ]
1> e:\projects\games\netrush\netrush_dependencies\ogre\ogremain\include\OgreSharedPtr.h(105) : see reference to function template instantiation 'unsigned int Ogre::AtomicScalar<T>::operator ++(void)' being compiled
1> with
1> [
1> T=unsigned int
1> ]
1> e:\projects\games\netrush\netrush_dependencies\ogre\ogremain\include\OgreSharedPtr.h(59) : see reference to class template instantiation 'Ogre::AtomicScalar<T>' being compiled
1> with
1> [
1> T=unsigned int
1> ]
Code: Select all
if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "tbb")
set(OGRE_THREAD_PROVIDER 3)
include_directories(${TBB_INCLUDE_DIRS})
if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0501) # HERE
endif ()
set(OGRE_THREAD_LIBRARIES ${TBB_LIBRARIES})
endif ()
In this case, if the compiler is set to compile for 32bits, the macros hides 64 bits functions.
Apparently this flag is often used (in Ogre cmake files and it's dependencies) mostly for compatibility with MINGW, but in this specific line it is not the case.
So, why? It looks like the change is a recent patch by masterfalcon ( 409379704eea ) Which says: "Patch #1430 Fixed GL render system build for TBB".
The problem is that apparently this is not necessary at least in my build (which uses GL render system).
My immediate solution would be just to remove this line. However I suspect (but don't have the time to check right now) that
the binaries provided by Intel might have been compiled with MINGW which would explain this patch.
If I'm correct, I have no idea how to provide a patch to fix this because I don't see a way to know if the flag is necessary or not.
Thoughts?