From 59fc6b29f9638fbe6d65a87a5a8af505ccae3e90 Mon Sep 17 00:00:00 2001 From: gerrit Date: Wed, 5 Dec 2012 16:29:56 +0800 Subject: [PATCH] fixed: c++11 build problems ("" operator) : cuda cleanup (for 5.0) --- CMake/SetupCompiler.cmake | 4 + CMakeLists.txt | 21 +- Source/Base/Base/OSGNormalQuantifier.cpp | 6 +- Source/Base/Field/OSGFieldDescFactory.cpp | 3 +- Source/Base/FieldContainer/Base/OSGAspect.cpp | 6 +- Source/Base/FieldContainer/Base/OSGChangeList.cpp | 10 +- .../Base/FieldContainer/Base/OSGFieldContainer.cpp | 2 +- .../FieldContainer/Base/OSGFieldContainerType.cpp | 2 +- .../Base/OSGReflexiveContainerType.cpp | 2 +- .../FieldContainer/Base/testChangedCallback.cpp | 5 +- .../Mixins/OSGDynamicContainerMixin.inl | 4 +- Source/Base/FieldContainer/Node/testNodeThread.cpp | 16 +- .../Network/Socket/OSGGroupMCastConnection.cpp | 2 +- Source/Base/Threading/OSGThreadManager.cpp | 12 +- Source/Contrib/CgFXMaterial/OSGCgFXMaterial.cpp | 4 +- .../ComplexSceneManager/Helper/OSGGestureData.cpp | 4 +- .../ComplexSceneManager/Helper/OSGMTouchData.cpp | 4 +- .../ComplexSceneManager/OSGCSMClusterWindow.cpp | 2 +- .../Contrib/ComplexSceneManager/OSGCSMDrawer.cpp | 6 +- .../ConfigurePackages.OSGContribComputeBase.cmake | 129 +- Source/Contrib/ComputeBase/CMake/CudaHelper.cmake | 63 + .../Contrib/ComputeBase/CMake/cuda/FindCUDA.cmake | 1229 -------------------- .../CMake/cuda/FindCUDA/make2cmake.cmake | 79 -- .../CMake/cuda/FindCUDA/parse_cubin.cmake | 112 -- .../ComputeBase/CMake/cuda/FindCUDA/run_nvcc.cmake | 259 ----- .../CMakeLists.Support.OSGContribComputeBase.txt | 15 +- .../OSGContribComputeBase.Prepare.cmake | 25 +- .../ComputeBase/Support/CudaCommon/CMakeLists.txt | 40 +- .../ComputeBase/Support/NVSdkCommon/CMakeLists.txt | 48 +- .../ComputeBase/Support/cudpp/CMakeLists.txt | 35 - .../ComputeBase/Support/cudpp/CudPPCommon.cmake | 150 --- .../ComputeBase/Support/cudppE/CMakeLists.txt | 32 - .../Action/RenderAction/OSGRenderPartition.cpp | 2 +- Source/System/Cluster/Server/OSGClusterServer.cpp | 2 +- .../BalancedMultiWindow/OSGBalancedMultiWindow.cpp | 2 +- .../System/Depreciated/State/OSGTextureChunk.cpp | 2 +- .../OSGVRMLCoordinateInterpolator.cpp | 2 +- .../VRMLAnimation/OSGVRMLNormalInterpolator.cpp | 2 +- .../OSGVRMLOrientationInterpolator.cpp | 2 +- .../VRMLAnimation/OSGVRMLPositionInterpolator.cpp | 2 +- .../VRMLAnimation/OSGVRMLScalarInterpolator.cpp | 2 +- .../System/FileIO/Collada/OSGColladaController.cpp | 4 +- .../System/FileIO/Collada/OSGColladaGeometry.cpp | 8 +- Source/System/FileIO/OBJ/OSGOBJSceneFileType.cpp | 11 +- Source/System/FileIO/OSB/OSGOSBRootElement.cpp | 2 +- .../FileIO/OpenFlight/OSGOFPrimaryRecords.cpp | 2 +- Source/System/GraphOp/OSGGeometryMergeGraphOp.cpp | 2 +- Source/System/GraphOp/OSGVerifyGeoGraphOp.cpp | 2 +- Source/System/Image/FileIO/OSGDBImageFileType.cpp | 2 +- Source/System/Image/FileIO/OSGITFImageFileType.cpp | 2 +- Source/System/Image/OSGImageFunctions.cpp | 8 +- .../Properties/OSGTypedGeoVectorProperty.h | 7 +- .../Drawables/Geometry/Util/OSGGeoFunctions.cpp | 12 +- .../NodeCores/Drawables/Particles/OSGParticles.cpp | 2 +- .../DisplayFilter/OSGDisplayFilterStageData.cpp | 2 +- .../State/Auxiliary/OSGTextureSelectChunk.cpp | 6 +- Source/System/State/OpenGL/OSGTextureEnvChunk.cpp | 2 +- .../System/State/Shader/Base/OSGShaderCacheTree.h | 12 +- .../State/Shader/Base/OSGShaderCacheTree.inl | 12 +- .../Window/Background/OSGPolygonBackground.cpp | 2 +- Source/System/Window/Base/OSGWindow.cpp | 11 +- .../Window/FrameBufferObjects/OSGFBOViewport.cpp | 5 +- .../OSGFrameBufferAttachment.cpp | 4 +- .../Window/FrameBufferObjects/OSGTextureBuffer.cpp | 5 +- Source/System/Window/Passive/OSGPassiveWindow.cpp | 3 +- Source/Test/SystemLib/OSGTestFC.cpp | 2 +- Source/Test/SystemLib/testFieldContainer.cpp | 8 +- Source/WindowSystem/QT4/OSGWindowQT4Def.h | 2 + Source/WindowSystem/QT4/testPassiveQT4.cpp | 2 + Source/WindowSystem/QT4/testWindowQT4SSM_qt.cpp | 1 + Source/WindowSystem/QT4/testWindowQT4_qt.cpp | 2 + Support/CMakeLists.txt | 6 +- 72 files changed, 295 insertions(+), 2205 deletions(-) create mode 100644 Source/Contrib/ComputeBase/CMake/CudaHelper.cmake delete mode 100644 Source/Contrib/ComputeBase/CMake/cuda/FindCUDA.cmake delete mode 100755 Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/make2cmake.cmake delete mode 100644 Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/parse_cubin.cmake delete mode 100755 Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/run_nvcc.cmake delete mode 100644 Source/Contrib/ComputeBase/Support/cudpp/CMakeLists.txt delete mode 100644 Source/Contrib/ComputeBase/Support/cudpp/CudPPCommon.cmake delete mode 100644 Source/Contrib/ComputeBase/Support/cudppE/CMakeLists.txt diff --git a/CMake/SetupCompiler.cmake b/CMake/SetupCompiler.cmake index bbdfd0464..277ec0b8b 100644 --- a/CMake/SetupCompiler.cmake +++ b/CMake/SetupCompiler.cmake @@ -262,6 +262,10 @@ IF(CMAKE_COMPILER_IS_GNUCC) SET(OSG_CXX_FLAGS "${OSG_CXX_FLAGS} -D__STDC_FORMAT_MACROS -fPIC") SET(OSG_C_FLAGS "${OSG_C_FLAGS} -D__STDC_FORMAT_MACROS -fPIC") + IF(OSG_ENABLE_C++11) + SET(OSG_CXX_FLAGS "${OSG_CXX_FLAGS} -std=c++11") + ENDIF() + ENDIF(CMAKE_COMPILER_IS_GNUCC) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58be57e05..f48db077e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,6 +372,18 @@ IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux") SET(LINUX 1) ENDIF() +IF(WIN32) + SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt" + CACHE STRING "OpenSG Build Types" FORCE ) +ELSE() + SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV" + CACHE STRING "OpenSG Build Types" FORCE ) +ENDIF(WIN32) +IF(APPLE AND IOS) + SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos" + CACHE STRING "OpenSG Build Types" FORCE ) +ENDIF() + IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: Debug Release." @@ -2287,15 +2299,6 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README IF(WIN32) - SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt" - CACHE STRING "OpenSG Build Types" FORCE ) -ENDIF(WIN32) -IF(APPLE AND IOS) - SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos" - CACHE STRING "OpenSG Build Types" FORCE ) -ENDIF() - -IF(WIN32) FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake" "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n") diff --git a/Source/Base/Base/OSGNormalQuantifier.cpp b/Source/Base/Base/OSGNormalQuantifier.cpp index 15b47d974..2a8ce7751 100644 --- a/Source/Base/Base/OSGNormalQuantifier.cpp +++ b/Source/Base/Base/OSGNormalQuantifier.cpp @@ -151,8 +151,10 @@ void NormalQuantifier::build (UInt32 numberSubdivisions) } else { - FLOG(("NormalQuantifier init: %d subdivision, %"PRISize" normal\n", - _numberSubdivisions, _normalTable.size())); + FLOG(("NormalQuantifier init: %d subdivision, %" + PRISize " normal\n", + _numberSubdivisions, + _normalTable.size())); } } } diff --git a/Source/Base/Field/OSGFieldDescFactory.cpp b/Source/Base/Field/OSGFieldDescFactory.cpp index 5ce596b89..3f67c1a11 100644 --- a/Source/Base/Field/OSGFieldDescFactory.cpp +++ b/Source/Base/Field/OSGFieldDescFactory.cpp @@ -287,7 +287,8 @@ FieldDescriptionBase *FieldDescFactoryBase::create( { if(uiFieldTypeId >= _vCreators.size()) { - FWARNING(("FieldDescFactory::create, unknown type id %d (%"PRISize")\n", + FWARNING(("FieldDescFactory::create, unknown type id %d (%" + PRISize ")\n", uiFieldTypeId, _vCreators.size())); diff --git a/Source/Base/FieldContainer/Base/OSGAspect.cpp b/Source/Base/FieldContainer/Base/OSGAspect.cpp index f0d6f7fd2..245a19203 100644 --- a/Source/Base/FieldContainer/Base/OSGAspect.cpp +++ b/Source/Base/FieldContainer/Base/OSGAspect.cpp @@ -108,7 +108,7 @@ namespace Aspect { #if 0 fprintf(stderr, - "initializing mfield[%"PRIUSize + "initializing mfield[%" PRIUSize "] %s, cnt: %s\n", i, fDesc->getCName(), @@ -175,7 +175,7 @@ namespace Aspect } fprintf(stderr, - "CE : %u %u 0x%016"PRIx64" 0x%016"PRIx64" (%p|%p) | %s\n", + "CE : %u %u 0x%016" PRIx64 " 0x%016" PRIx64 " (%p|%p) | %s\n", pChanges->uiEntryDesc, pChanges->uiContainerId, tmpChanges, @@ -195,7 +195,7 @@ namespace Aspect if(pDesc != NULL) { - fprintf(stderr, "Desc[%d] = %s [%d|0x%016"PRIx64"\n", + fprintf(stderr, "Desc[%d] = %s [%d|0x%016" PRIx64 "\n", i, pDesc->getCName(), pDesc->getFieldId(), diff --git a/Source/Base/FieldContainer/Base/OSGChangeList.cpp b/Source/Base/FieldContainer/Base/OSGChangeList.cpp index 649c84209..f3a804012 100644 --- a/Source/Base/FieldContainer/Base/OSGChangeList.cpp +++ b/Source/Base/FieldContainer/Base/OSGChangeList.cpp @@ -436,7 +436,7 @@ void ChangeList::dump( UInt32 uiIndent, } fprintf(stderr, - "CE : %u %u 0x%016"PRIx64" 0x%016"PRIx64" (%p|%p) | %s\n", + "CE : %u %u 0x%016" PRIx64 " 0x%016" PRIx64 " (%p|%p) | %s\n", (*cIt)->uiEntryDesc, (*cIt)->uiContainerId, tmpChanges, @@ -478,7 +478,7 @@ void ChangeList::dump( UInt32 uiIndent, } fprintf(stderr, - "CE : %u %u 0x%016"PRIx64" 0x%016"PRIx64" (%p|%p) | %s\n", + "CE : %u %u 0x%016" PRIx64 " 0x%016" PRIx64 " (%p|%p) | %s\n", (*cIt)->uiEntryDesc, (*cIt)->uiContainerId, tmpChanges, @@ -512,7 +512,7 @@ void ChangeList::dump( UInt32 uiIndent, tmpChanges = *((*cIt)->bvUncommittedChanges); } - fprintf(stderr, "CE : %u %u 0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "CE : %u %u 0x%016" PRIx64 " 0x%016" PRIx64 "\n", (*cIt)->uiEntryDesc, (*cIt)->uiContainerId, tmpChanges, @@ -524,8 +524,8 @@ void ChangeList::dump( UInt32 uiIndent, void ChangeList::dumpListSizes(void) const { - fprintf(stderr, "CL : CH_S : %"PRISize" | CR_S : %"PRISize" | UC_S : %" - PRISize" | P_S %"PRISize"\n", + fprintf(stderr, "CL : CH_S : %" PRISize " | CR_S : %" PRISize " | UC_S : %" + PRISize " | P_S %" PRISize "\n", _changedStore.size(), _createdStore.size(), _uncommitedChanges.size(), diff --git a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp index 3b1636d28..84d658e03 100644 --- a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp +++ b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp @@ -158,7 +158,7 @@ void FieldContainer::dumpFieldInfo(void) const fprintf(stderr, "\n"); #if 0 - fprintf(stderr, "0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "0x%016" PRIx64 " 0x%016" PRIx64 "\n", _pFieldFlags->_bClusterLocalFlags, pDesc ->getFieldMask()); #endif diff --git a/Source/Base/FieldContainer/Base/OSGFieldContainerType.cpp b/Source/Base/FieldContainer/Base/OSGFieldContainerType.cpp index 297f18e8b..b19684fac 100644 --- a/Source/Base/FieldContainer/Base/OSGFieldContainerType.cpp +++ b/Source/Base/FieldContainer/Base/OSGFieldContainerType.cpp @@ -461,7 +461,7 @@ void FieldContainerType::dump( UInt32 OSG_CHECK_ARG(uiIndent), for(UInt32 i = 0; i < _vDescVec.size(); i++) { - FLOG(("Desc : %s | %d | 0x%016"PRIx64"\n", + FLOG(("Desc : %s | %d | 0x%016" PRIx64 "\n", _vDescVec[i]->getCName(), _vDescVec[i]->getFieldId(), _vDescVec[i]->getFieldMask())); diff --git a/Source/Base/FieldContainer/Base/OSGReflexiveContainerType.cpp b/Source/Base/FieldContainer/Base/OSGReflexiveContainerType.cpp index c7425419b..069e39a70 100644 --- a/Source/Base/FieldContainer/Base/OSGReflexiveContainerType.cpp +++ b/Source/Base/FieldContainer/Base/OSGReflexiveContainerType.cpp @@ -145,7 +145,7 @@ bool ReflexiveContainerType::initialize(void) if(_vDescVec.size() > sizeof(BitVector) * 8) { - FWARNING(("FCType %s has %"PRISize" (>%"PRISize") fields!\n", + FWARNING(("FCType %s has %" PRISize " (>%" PRISize ") fields!\n", getCName(), _vDescVec.size(), sizeof(BitVector) * 8)); diff --git a/Source/Base/FieldContainer/Base/testChangedCallback.cpp b/Source/Base/FieldContainer/Base/testChangedCallback.cpp index 0c3668bfc..48539cd2e 100644 --- a/Source/Base/FieldContainer/Base/testChangedCallback.cpp +++ b/Source/Base/FieldContainer/Base/testChangedCallback.cpp @@ -11,13 +11,14 @@ class Foo void testCB(OSG::FieldContainer *pObj, OSG::BitVector whichField, OSG::UInt32 origin) { - fprintf(stderr, "Foo::testCB %"PRIx64" origin %u\n", whichField, origin); + fprintf(stderr, "Foo::testCB %" PRIx64 " origin %u\n", + whichField, origin); } }; void testCB(OSG::FieldContainer *pObj, OSG::BitVector whichField, OSG::UInt32 origin) { - fprintf(stderr, "testCB %"PRIx64" origin %u\n", whichField, origin); + fprintf(stderr, "testCB %" PRIx64 " origin %u\n", whichField, origin); } int main (int argc, char **argv) diff --git a/Source/Base/FieldContainer/Mixins/OSGDynamicContainerMixin.inl b/Source/Base/FieldContainer/Mixins/OSGDynamicContainerMixin.inl index 26f46325e..fa5884d3a 100644 --- a/Source/Base/FieldContainer/Mixins/OSGDynamicContainerMixin.inl +++ b/Source/Base/FieldContainer/Mixins/OSGDynamicContainerMixin.inl @@ -463,7 +463,7 @@ void DynFieldContainer::dump( << ")" << std::endl; - fprintf(stderr, "[%d] : 0x%016"PRIx64"\n", + fprintf(stderr, "[%d] : 0x%016" PRIx64 "\n", i, getType().getFieldDesc(i)->getFieldMask()); } @@ -513,7 +513,7 @@ void DynFieldContainer::dump( << ")" << std::endl; - fprintf(stderr, "[%d] : 0x%016"PRIx64"\n", + fprintf(stderr, "[%d] : 0x%016" PRIx64 "\n", i, getType().getFieldDesc(i)->getFieldMask()); diff --git a/Source/Base/FieldContainer/Node/testNodeThread.cpp b/Source/Base/FieldContainer/Node/testNodeThread.cpp index 542c0bcba..78b6f5550 100644 --- a/Source/Base/FieldContainer/Node/testNodeThread.cpp +++ b/Source/Base/FieldContainer/Node/testNodeThread.cpp @@ -11,14 +11,14 @@ void *runThread(void *) { fprintf(stderr, "run thread \n"); - fprintf(stderr, "th : %p %p %d 0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "th : %p %p %d 0x%016" PRIx64 " 0x%016" PRIx64 "\n", OSG::Thread::getCurrentChangeList (), OSG::Thread::getCurrent (), OSG::Thread::getCurrentAspect (), OSG::Thread::getCurrentNamespaceMask(), OSG::Thread::getCurrentLocalFlags ()); - fprintf(stderr, "th : %p %p %d 0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "th : %p %p %d 0x%016" PRIx64 " 0x%016" PRIx64 "\n", OSG::Thread::getCurrentChangeList (), OSG::Thread::getCurrent (), OSG::Thread::getCurrentAspect (), @@ -42,14 +42,14 @@ void runThread1(void *) { fprintf(stderr, "run thread \n"); - fprintf(stderr, "th : %p %p %d 0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "th : %p %p %d 0x%016" PRIx64 " 0x%016" PRIx64 "\n", OSG::Thread::getCurrentChangeList (), OSG::Thread::getCurrent (), OSG::Thread::getCurrentAspect (), OSG::Thread::getCurrentNamespaceMask(), OSG::Thread::getCurrentLocalFlags ()); - fprintf(stderr, "th : %p %p %d 0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "th : %p %p %d 0x%016" PRIx64 " 0x%016" PRIx64 "\n", OSG::Thread::getCurrentChangeList (), OSG::Thread::getCurrent (), OSG::Thread::getCurrentAspect (), @@ -114,10 +114,10 @@ void *runThread(void *) fprintf(stderr, "CL:%p ", OSG::Thread::getCurrentChangeList ()); - fprintf(stderr, "0x%016"PRIx64" ", + fprintf(stderr, "0x%016" PRIx64 " ", OSG::Thread::getCurrentNamespaceMask()); - fprintf(stderr, "0x%016"PRIx64"\n", + fprintf(stderr, "0x%016" PRIx64 "\n", OSG::Thread::getCurrentLocalFlags ()); OSG::NodeUnrecPtr pNode1 = OSG::Node::create(); @@ -138,14 +138,14 @@ void runThread1(void *) { fprintf(stderr, "run thread \n"); - fprintf(stderr, "th : CL:%p T:%p %d 0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "th : CL:%p T:%p %d 0x%016" PRIx64 " 0x%016" PRIx64 "\n", OSG::Thread::getCurrentChangeList (), OSG::Thread::getCurrent (), OSG::Thread::getCurrentAspect (), OSG::Thread::getCurrentNamespaceMask(), OSG::Thread::getCurrentLocalFlags ()); - fprintf(stderr, "th : CL:%p T:%p %d 0x%016"PRIx64" 0x%016"PRIx64"\n", + fprintf(stderr, "th : CL:%p T:%p %d 0x%016" PRIx64 " 0x%016" PRIx64 "\n", OSG::Thread::getCurrentChangeList (), OSG::Thread::getCurrent (), OSG::Thread::getCurrentAspect (), diff --git a/Source/Base/Network/Socket/OSGGroupMCastConnection.cpp b/Source/Base/Network/Socket/OSGGroupMCastConnection.cpp index 9a4a331f7..99d1f8dc4 100644 --- a/Source/Base/Network/Socket/OSGGroupMCastConnection.cpp +++ b/Source/Base/Network/Socket/OSGGroupMCastConnection.cpp @@ -452,7 +452,7 @@ bool GroupMCastConnection::sendQueue(void) printf("send %d end %d\n",send,end); printf("lastack %lf\n",getSystemTime() - lastAckTime); #endif - FDEBUG(("timeout count %d %d missing %"PRISize"\n", + FDEBUG(("timeout count %d %d missing %" PRISize "\n", count,sendId,missing[ack].size())) // printf("%.10f timeout count %d %d missing %d\n",getSystemTime()-t1,count,sendId,missing[ack].size()); diff --git a/Source/Base/Threading/OSGThreadManager.cpp b/Source/Base/Threading/OSGThreadManager.cpp index c842f38d0..187ed2386 100644 --- a/Source/Base/Threading/OSGThreadManager.cpp +++ b/Source/Base/Threading/OSGThreadManager.cpp @@ -329,9 +329,9 @@ void ThreadManager::dump(void) } FLOG( - ("Sizes: ThreadStore: %"PRISize" BarrierStore: %"PRISize - " CondVarStore: %"PRISize" LockStore: %"PRISize" LockPoolStore: %" - PRISize" SemaphoreStore: %"PRISize"\n", + ("Sizes: ThreadStore: %" PRISize " BarrierStore: %" PRISize + " CondVarStore: %" PRISize " LockStore: %" PRISize " LockPoolStore: %" + PRISize " SemaphoreStore: %" PRISize "\n", _sThreadStore ._mFieldMap.size(), _sBarrierStore ._mFieldMap.size(), _sCondVarStore ._mFieldMap.size(), @@ -633,9 +633,9 @@ bool ThreadManager::shutdown(void) #endif FDEBUG( - ("Sizes: ThreadStore: %"PRISize" BarrierStore: %"PRISize - " CondVarStore: %"PRISize" LockStore: %"PRISize" LockPoolStore: %" - PRISize" SemaphoreStore: %"PRISize"\n", + ("Sizes: ThreadStore: %" PRISize " BarrierStore: %" PRISize + " CondVarStore: %" PRISize " LockStore: %" PRISize " LockPoolStore: %" + PRISize " SemaphoreStore: %" PRISize "\n", _sThreadStore ._mFieldMap.size(), _sBarrierStore ._mFieldMap.size(), _sCondVarStore ._mFieldMap.size(), diff --git a/Source/Contrib/CgFXMaterial/OSGCgFXMaterial.cpp b/Source/Contrib/CgFXMaterial/OSGCgFXMaterial.cpp index fc358cf5a..20c82eecb 100755 --- a/Source/Contrib/CgFXMaterial/OSGCgFXMaterial.cpp +++ b/Source/Contrib/CgFXMaterial/OSGCgFXMaterial.cpp @@ -176,7 +176,7 @@ UInt32 CgFXMaterial::handleGL(DrawEnv *pEnv, pEnv->getWindow()->setGLObjectId(osgId, glId); #if OSG_CGFX_DUMP_DEBUG - fprintf( stderr, "setting gl id %"PRIUSize" | %p\n", + fprintf( stderr, "setting gl id %" PRIUSize " | %p\n", glId, _pCGcontext); #endif @@ -227,7 +227,7 @@ void CgFXMaterial::handleDestroyGL(DrawEnv *pEnv, CGcontext pCGcontext = reinterpret_cast(glId); - fprintf(stderr, "destroying gl id %"PRIUSize"\n", + fprintf(stderr, "destroying gl id %" PRIUSize "\n", glId); if(pCGcontext != NULL) diff --git a/Source/Contrib/ComplexSceneManager/Helper/OSGGestureData.cpp b/Source/Contrib/ComplexSceneManager/Helper/OSGGestureData.cpp index 92a3c870c..0598dd415 100644 --- a/Source/Contrib/ComplexSceneManager/Helper/OSGGestureData.cpp +++ b/Source/Contrib/ComplexSceneManager/Helper/OSGGestureData.cpp @@ -257,7 +257,7 @@ void GestureData::clear(void) void GestureData::dump(void) const { - fprintf(stderr, "Blobs (%"PRISize") :\n", _vBlobs.size()); + fprintf(stderr, "Blobs (%" PRISize ") :\n", _vBlobs.size()); for(UInt32 i = 0; i < _vBlobs.size(); ++i) { fprintf(stderr, " [%d] : %d %d %d | %f %f\n", @@ -269,7 +269,7 @@ void GestureData::dump(void) const _vBlobs[i]._vPosition[1]); } - fprintf(stderr, "Active Blobs (%"PRISize") :\n", _vActiveBlobs.size()); + fprintf(stderr, "Active Blobs (%" PRISize ") :\n", _vActiveBlobs.size()); for(UInt32 i = 0; i < _vActiveBlobs.size(); ++i) { diff --git a/Source/Contrib/ComplexSceneManager/Helper/OSGMTouchData.cpp b/Source/Contrib/ComplexSceneManager/Helper/OSGMTouchData.cpp index 90a077943..e366cf2d0 100644 --- a/Source/Contrib/ComplexSceneManager/Helper/OSGMTouchData.cpp +++ b/Source/Contrib/ComplexSceneManager/Helper/OSGMTouchData.cpp @@ -258,7 +258,7 @@ void MTouchData::clear(void) void MTouchData::dump(void) const { - fprintf(stderr, "Blobs (%"PRISize") :\n", _vBlobs.size()); + fprintf(stderr, "Blobs (%" PRISize ") :\n", _vBlobs.size()); for(UInt32 i = 0; i < _vBlobs.size(); ++i) { const Char8 *szCSys = ""; @@ -306,7 +306,7 @@ void MTouchData::dump(void) const _vBlobs[i]._pActiveViewport); } - fprintf(stderr, "Active Blobs (%"PRISize") :\n", _vActiveBlobs.size()); + fprintf(stderr, "Active Blobs (%" PRISize ") :\n", _vActiveBlobs.size()); for(UInt32 i = 0; i < _vActiveBlobs.size(); ++i) { fprintf(stderr, "[%d] : %d\n", diff --git a/Source/Contrib/ComplexSceneManager/OSGCSMClusterWindow.cpp b/Source/Contrib/ComplexSceneManager/OSGCSMClusterWindow.cpp index a73080c04..9327424e8 100644 --- a/Source/Contrib/ComplexSceneManager/OSGCSMClusterWindow.cpp +++ b/Source/Contrib/ComplexSceneManager/OSGCSMClusterWindow.cpp @@ -180,7 +180,7 @@ bool CSMClusterWindow::init(void) { if(this->getMFServerIds()->size() != 0) { - FWARNING(("Not enough server ids (%"PRISize"/%"PRISize"), " + FWARNING(("Not enough server ids (%" PRISize "/%" PRISize "), " "field ignored\n", this->getMFServerIds()->size(), this->getMFServers ()->size() )); diff --git a/Source/Contrib/ComplexSceneManager/OSGCSMDrawer.cpp b/Source/Contrib/ComplexSceneManager/OSGCSMDrawer.cpp index 2e3db45be..2913134d4 100644 --- a/Source/Contrib/ComplexSceneManager/OSGCSMDrawer.cpp +++ b/Source/Contrib/ComplexSceneManager/OSGCSMDrawer.cpp @@ -343,7 +343,8 @@ void CSMDrawer::runParallel(void) fprintf(stderr, "Running without swap lock\n"); fflush (stderr); - fprintf(stderr, "Running with %"PRISize"-windws\n", _mfWindows.size()); + fprintf(stderr, "Running with %" PRISize "-windws\n", + _mfWindows.size()); fflush (stderr); while(_bRun == true) @@ -382,7 +383,8 @@ void CSMDrawer::runParallel(void) fprintf(stderr, "Running with swap lock\n"); fflush (stderr); - fprintf(stderr, "Running with %"PRISize"-windws\n", _mfWindows.size()); + fprintf(stderr, "Running with %" PRISize "-windws\n", + _mfWindows.size()); fflush (stderr); while(_bRun == true) diff --git a/Source/Contrib/ComputeBase/CMake/ConfigurePackages.OSGContribComputeBase.cmake b/Source/Contrib/ComputeBase/CMake/ConfigurePackages.OSGContribComputeBase.cmake index 252b6279b..04a5536f3 100644 --- a/Source/Contrib/ComputeBase/CMake/ConfigurePackages.OSGContribComputeBase.cmake +++ b/Source/Contrib/ComputeBase/CMake/ConfigurePackages.OSGContribComputeBase.cmake @@ -4,7 +4,7 @@ MACRO(OSG_CONFIGURE_NVSDKCOMMON) IF(NOT OSG_BUILD_DEPENDEND) IF(OSG_USE_OSGSUPPORT_LIBS) - IF(EXISTS ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/nvsdk/shrQATest.h) + IF(EXISTS ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/nvsdk/helper_functions.h) OSG_SET(OSG_NVSDKCOMMON_INCLUDE_DIR ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/nvsdk CACHE PATH "" FORCE) ENDIF() @@ -36,15 +36,15 @@ MACRO(OSG_CONFIGURE_NVSDKCOMMON) ENDIF() IF(OSG_NVSDKCOMMON_INCLUDE_DIR) - IF(OSG_NVSDKCOMMON_LIBRARY_DEBUG OR OSG_NVSDKCOMMON_LIBRARY_RELEASE) +# IF(OSG_NVSDKCOMMON_LIBRARY_DEBUG OR OSG_NVSDKCOMMON_LIBRARY_RELEASE) SET(OSG_NVSDKCOMMON_FOUND TRUE) - ENDIF() +# ENDIF() ENDIF() - IF(OSG_NVSDKCOMMON_FOUND) - OSG_ADD_IMPORT_LIB(OSG_NVSDKCOMMON_TARGETS OSG_NVSDKCOMMON_LIBRARY) - SET(OSG_NVSDKCOMMON_LIBRARIES ${OSG_NVSDKCOMMON_TARGETS} CACHE STRING "" FORCE) - ENDIF(OSG_NVSDKCOMMON_FOUND) +# IF(OSG_NVSDKCOMMON_FOUND) +# OSG_ADD_IMPORT_LIB(OSG_NVSDKCOMMON_TARGETS OSG_NVSDKCOMMON_LIBRARY) +# SET(OSG_NVSDKCOMMON_LIBRARIES ${OSG_NVSDKCOMMON_TARGETS} CACHE STRING "" FORCE) +# ENDIF(OSG_NVSDKCOMMON_FOUND) ENDIF(OSG_USE_OSGSUPPORT_LIBS) @@ -54,7 +54,7 @@ MACRO(OSG_CONFIGURE_NVSDKCOMMON) ELSE(NOT OSG_BUILD_DEPENDEND) IF(OSG_WITH_NVSDKCOMMON) SET(OSG_NVSDKCOMMON_FOUND TRUE) - SET(OSG_NVSDKCOMMON_LIBRARIES OSG_OSG_NVSDKCOMMON_LIBRARY_TARGET CACHE STRING "" FORCE) +# SET(OSG_NVSDKCOMMON_LIBRARIES OSG_OSG_NVSDKCOMMON_LIBRARY_TARGET CACHE STRING "" FORCE) ENDIF(OSG_WITH_NVSDKCOMMON) ENDIF(NOT OSG_BUILD_DEPENDEND) @@ -128,7 +128,7 @@ MACRO(OSG_CONFIGURE_CUDACOMMON) IF(NOT OSG_BUILD_DEPENDEND) IF(OSG_USE_OSGSUPPORT_LIBS) - IF(EXISTS ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/cuda/param.h) + IF(EXISTS ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/cuda/helper_cuda.h) OSG_SET(OSG_CUDACOMMON_INCLUDE_DIR ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/cuda CACHE PATH "" FORCE) ENDIF() @@ -168,15 +168,15 @@ MACRO(OSG_CONFIGURE_CUDACOMMON) ENDIF() IF(OSG_CUDACOMMON_INCLUDE_DIR) - IF(OSG_CUDACOMMON_LIBRARY_DEBUG OR OSG_CUDACOMMON_LIBRARY_RELEASE) +# IF(OSG_CUDACOMMON_LIBRARY_DEBUG OR OSG_CUDACOMMON_LIBRARY_RELEASE) SET(OSG_CUDACOMMON_FOUND TRUE) - ENDIF() +# ENDIF() ENDIF() - IF(OSG_CUDACOMMON_FOUND) - OSG_ADD_IMPORT_LIB(OSG_CUDACOMMON_TARGETS OSG_CUDACOMMON_LIBRARY) - SET(OSG_CUDACOMMON_LIBRARIES ${OSG_CUDACOMMON_TARGETS} CACHE STRING "" FORCE) - ENDIF(OSG_CUDACOMMON_FOUND) +# IF(OSG_CUDACOMMON_FOUND) +# OSG_ADD_IMPORT_LIB(OSG_CUDACOMMON_TARGETS OSG_CUDACOMMON_LIBRARY) +# SET(OSG_CUDACOMMON_LIBRARIES ${OSG_CUDACOMMON_TARGETS} CACHE STRING "" FORCE) +# ENDIF(OSG_CUDACOMMON_FOUND) ENDIF(OSG_USE_OSGSUPPORT_LIBS) @@ -186,7 +186,7 @@ MACRO(OSG_CONFIGURE_CUDACOMMON) ELSE(NOT OSG_BUILD_DEPENDEND) IF(OSG_WITH_CUDACOMMON) SET(OSG_CUDACOMMON_FOUND TRUE) - SET(OSG_CUDACOMMON_LIBRARIES OSG_OSG_CUDACOMMON_LIBRARY_TARGET CACHE STRING "" FORCE) +# SET(OSG_CUDACOMMON_LIBRARIES OSG_OSG_CUDACOMMON_LIBRARY_TARGET CACHE STRING "" FORCE) ENDIF(OSG_WITH_CUDACOMMON) ENDIF(NOT OSG_BUILD_DEPENDEND) @@ -267,103 +267,6 @@ MACRO(OSG_CONFIGURE_CUDAUTIL) ENDMACRO(OSG_CONFIGURE_CUDAUTIL) -MACRO(OSG_CONFIGURE_CUDPP) - - IF(NOT OSG_BUILD_DEPENDEND) - IF(OSG_USE_OSGSUPPORT_LIBS) - - IF(EXISTS ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/cuda/cudpp/cudpp.h) - OSG_SET(OSG_CUDPP_INCLUDE_DIR ${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/cuda CACHE PATH "" FORCE) - ENDIF() - - SET(OSG_CUDPP_LIBRARY_RELEASE "" CACHE INTERNAL "" FORCE) - SET(OSG_CUDPP_LIBRARY_DEBUG "" CACHE INTERNAL "" FORCE) - - IF(UNIX) - IF(OSG_USE_STATIC_SUPPORT_LIBS) - IF(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME libosgcudpplibE) - ELSE(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME libosgcudpplib) - ENDIF(CUDA_BUILD_EMULATION) - - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.a) - SET(OSG_CUDPP_LIBRARY_RELEASE ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.a "" CACHE INTERNAL "" FORCE) - ENDIF() - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/debug/${_OSG_CUP_LIBNAME}.a) - SET(OSG_CUDPP_LIBRARY_DEBUG ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/debug/${_OSG_CUP_LIBNAME}.a "" CACHE INTERNAL "" FORCE) - ENDIF() - ELSE() - IF(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME libosgcudppE) - ELSE(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME libosgcudpp) - ENDIF(CUDA_BUILD_EMULATION) - - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.so) - SET(OSG_CUDPP_LIBRARY_RELEASE ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.so "" CACHE INTERNAL "" FORCE) - ENDIF() - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/debug/${_OSG_CUP_LIBNAME}.so) - SET(OSG_CUDPP_LIBRARY_DEBUG ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/debug/${_OSG_CUP_LIBNAME}.so "" CACHE INTERNAL "" FORCE) - ENDIF() - ENDIF() - ELSEIF(WIN32) - - IF(OSG_USE_STATIC_SUPPORT_LIBS) - - IF(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME libosgcudppE) - ELSE(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME libosgcudpp) - ENDIF(CUDA_BUILD_EMULATION) - - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.lib) - SET(OSG_CUDPP_LIBRARY_RELEASE ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.lib "" CACHE INTERNAL "" FORCE) - ENDIF() - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}D.lib) - SET(OSG_CUDPP_LIBRARY_DEBUG ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}D.lib "" CACHE INTERNAL "" FORCE) - ENDIF() - ELSE() - - IF(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME osgcudppE) - ELSE(CUDA_BUILD_EMULATION) - SET(_OSG_CUP_LIBNAME osgcudpp) - ENDIF(CUDA_BUILD_EMULATION) - - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.lib) - SET(OSG_CUDPP_LIBRARY_RELEASE ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}.lib "" CACHE INTERNAL "" FORCE) - ENDIF() - IF(EXISTS ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}D.lib) - SET(OSG_CUDPP_LIBRARY_DEBUG ${OSG_SUPPORT_ROOT}/lib${OSG_LIBDIR_BASE_SUFFIX}/${_OSG_CUP_LIBNAME}D.lib "" CACHE INTERNAL "" FORCE) - ENDIF() - ENDIF() - ENDIF() - - IF(OSG_CUDPP_INCLUDE_DIR) - IF(OSG_CUDPP_LIBRARY_DEBUG OR OSG_CUDPP_LIBRARY_RELEASE) - SET(OSG_CUDPP_FOUND TRUE) - ENDIF() - ENDIF() - - IF(OSG_CUDPP_FOUND) - OSG_ADD_IMPORT_LIB(OSG_CUDPP_TARGETS OSG_CUDPP_LIBRARY) - SET(OSG_CUDPP_LIBRARIES ${OSG_CUDPP_TARGETS} CACHE STRING "" FORCE) - ENDIF(OSG_CUDPP_FOUND) - - ENDIF(OSG_USE_OSGSUPPORT_LIBS) - - IF(OSG_CUDPP_FOUND) - OSG_SET(OSG_WITH_CUDPP 1) - ENDIF(OSG_CUDPP_FOUND) - ELSE(NOT OSG_BUILD_DEPENDEND) - IF(OSG_WITH_CUDPP) - SET(OSG_CUDPP_FOUND TRUE) - SET(OSG_CUDPP_LIBRARIES OSG_OSG_CUDPP_LIBRARY_TARGET CACHE STRING "" FORCE) - ENDIF(OSG_WITH_CUDPP) - ENDIF(NOT OSG_BUILD_DEPENDEND) - -ENDMACRO(OSG_CONFIGURE_CUDPP) MACRO(OSG_CONFIGURE_CUDAPARTSDK) diff --git a/Source/Contrib/ComputeBase/CMake/CudaHelper.cmake b/Source/Contrib/ComputeBase/CMake/CudaHelper.cmake new file mode 100644 index 000000000..02a272919 --- /dev/null +++ b/Source/Contrib/ComputeBase/CMake/CudaHelper.cmake @@ -0,0 +1,63 @@ + +MACRO(OSG_SETUP_CUDA_FLAGS) + +# MESSAGE("FOOOXX ${CMAKE_CONFIGURATION_TYPES}") + + IF(NOT OSG_CUDA_DEFAULTS) + SET(_OSG_CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} CACHE INTERNAL "Cuda defaults written" FORCE) + + FOREACH(_OSG_CFG_TYPE ${CMAKE_CONFIGURATION_TYPES}) + STRING(TOUPPER ${_OSG_CFG_TYPE} _OSG_CFG_TYPE) + SET(_OSG_CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE} ${CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE}} CACHE INTERNAL "Cuda defaults written" FORCE) + ENDFOREACH() + + SET(OSG_CUDA_DEFAULTS 1 CACHE INTERNAL "Cuda defaults written" FORCE) #INTERNAL + ENDIF(NOT OSG_CUDA_DEFAULTS) + + SET(CUDA_NVCC_FLAGS ${_OSG_CUDA_NVCC_FLAGS};${CUDA_NVCC_OSG_FLAGS} CACHE STRING "" FORCE) + + + IF(CMAKE_CXX_FLAGS) + SET(_CUDA_NVCC_XC_FLAGS "-Xcompiler ") + + STRING(REPLACE " " ";" _OSG_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + + FOREACH(_OSG_CXX_FLAG ${_OSG_CMAKE_CXX_FLAGS}) + SET(_CUDA_NVCC_XC_FLAGS "${_CUDA_NVCC_XC_FLAGS},${_OSG_CXX_FLAG}") + ENDFOREACH() + + STRING(REPLACE ",-std=c++11" "" _CUDA_NVCC_XC_FLAGS ${_CUDA_NVCC_XC_FLAGS}) + + SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};${_CUDA_NVCC_XC_FLAGS}; CACHE STRING "" FORCE) + ENDIF() + + FOREACH(_OSG_CFG_TYPE ${CMAKE_CONFIGURATION_TYPES}) + + STRING(TOUPPER ${_OSG_CFG_TYPE} _OSG_CFG_TYPE) + IF(CMAKE_CXX_FLAGS_${_OSG_CFG_TYPE}) + + SET(CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE} ${_OSG_CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE}};${CUDA_NVCC_OSG_FLAGS_${_OSG_CFG_TYPE}} CACHE STRING "Cuda defaults written" FORCE) + + SET(_CUDA_NVCC_XC_FLAGS "-Xcompiler ") + + STRING(REPLACE " " ";" _OSG_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_${_OSG_CFG_TYPE}}) + + FOREACH(_OSG_CXX_FLAG ${_OSG_CMAKE_CXX_FLAGS}) + SET(_CUDA_NVCC_XC_FLAGS "${_CUDA_NVCC_XC_FLAGS},${_OSG_CXX_FLAG}") + ENDFOREACH() + + STRING(REPLACE ",-Wold-style-cast" "" _CUDA_NVCC_XC_FLAGS ${_CUDA_NVCC_XC_FLAGS}) + + SET(CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE} ${CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE}};${_CUDA_NVCC_XC_FLAGS}; CACHE STRING "Cuda defaults written" FORCE) + ENDIF() + ENDFOREACH() + + + MESSAGE("FOOOO ${CUDA_NVCC_FLAGS} ## ${_OSG_CUDA_NVCC_FLAGS}") + + FOREACH(_OSG_CFG_TYPE ${CMAKE_CONFIGURATION_TYPES}) + STRING(TOUPPER ${_OSG_CFG_TYPE} _OSG_CFG_TYPE) + MESSAGE("FOO CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE} ${CUDA_NVCC_FLAGS_${_OSG_CFG_TYPE}}") + ENDFOREACH() + +ENDMACRO() \ No newline at end of file diff --git a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA.cmake b/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA.cmake deleted file mode 100644 index c671d92d9..000000000 --- a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA.cmake +++ /dev/null @@ -1,1229 +0,0 @@ -# - Tools for building CUDA C files: libraries and build dependencies. -# This script locates the NVIDIA CUDA C tools. It should work on linux, windows, -# and mac and should be reasonably up to date with CUDA C releases. -# -# This script makes use of the standard find_package arguments of , -# REQUIRED and QUIET. CUDA_FOUND will report if an acceptable version of CUDA -# was found. -# -# The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if the prefix -# cannot be determined by the location of nvcc in the system path and REQUIRED -# is specified to find_package(). To use a different installed version of the -# toolkit set the environment variable CUDA_BIN_PATH before running cmake -# (e.g. CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default /usr/local/cuda) -# or set CUDA_TOOLKIT_ROOT_DIR after configuring. If you change the value of -# CUDA_TOOLKIT_ROOT_DIR, various components that depend on the path will be -# relocated. -# -# It might be necessary to set CUDA_TOOLKIT_ROOT_DIR manually on certain -# platforms, or to use a cuda runtime not installed in the default location. In -# newer versions of the toolkit the cuda library is included with the graphics -# driver- be sure that the driver version matches what is needed by the cuda -# runtime version. -# -# The following variables affect the behavior of the macros in the script (in -# alphebetical order). Note that any of these flags can be changed multiple -# times in the same directory before calling CUDA_ADD_EXECUTABLE, -# CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX or CUDA_WRAP_SRCS. -# -# CUDA_64_BIT_DEVICE_CODE (Default matches host bit size) -# -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code. -# Note that making this different from the host code when generating object -# or C files from CUDA code just won't work, because size_t gets defined by -# nvcc in the generated source. If you compile to PTX and then load the -# file yourself, you can mix bit sizes between device and host. -# -# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON) -# -- Set to ON if you want the custom build rule to be attached to the source -# file in Visual Studio. Turn OFF if you add the same cuda file to multiple -# targets. -# -# This allows the user to build the target from the CUDA file; however, bad -# things can happen if the CUDA source file is added to multiple targets. -# When performing parallel builds it is possible for the custom build -# command to be run more than once and in parallel causing cryptic build -# errors. VS runs the rules for every source file in the target, and a -# source can have only one rule no matter how many projects it is added to. -# When the rule is run from multiple targets race conditions can occur on -# the generated file. Eventually everything will get built, but if the user -# is unaware of this behavior, there may be confusion. It would be nice if -# this script could detect the reuse of source files across multiple targets -# and turn the option off for the user, but no good solution could be found. -# -# CUDA_BUILD_CUBIN (Default OFF) -# -- Set to ON to enable and extra compilation pass with the -cubin option in -# Device mode. The output is parsed and register, shared memory usage is -# printed during build. -# -# CUDA_BUILD_EMULATION (Default OFF for device mode) -# -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files -# when CUDA_BUILD_EMULATION is TRUE. -# -# CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR) -# -- Set to the path you wish to have the generated files placed. If it is -# blank output files will be placed in CMAKE_CURRENT_BINARY_DIR. -# Intermediate files will always be placed in -# CMAKE_CURRENT_BINARY_DIR/CMakeFiles. -# -# CUDA_HOST_COMPILATION_CPP (Default ON) -# -- Set to OFF for C compilation of host code. -# -# CUDA_NVCC_FLAGS -# CUDA_NVCC_FLAGS_ -# -- Additional NVCC command line arguments. NOTE: multiple arguments must be -# semi-colon delimited (e.g. --compiler-options;-Wall) -# -# CUDA_PROPAGATE_HOST_FLAGS (Default ON) -# -- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration -# dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the -# host compiler through nvcc's -Xcompiler flag. This helps make the -# generated host code match the rest of the system better. Sometimes -# certain flags give nvcc problems, and this will help you turn the flag -# propagation off. This does not affect the flags supplied directly to nvcc -# via CUDA_NVCC_FLAGS or through the OPTION flags specified through -# CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for -# shared library compilation are not affected by this flag. -# -# CUDA_VERBOSE_BUILD (Default OFF) -# -- Set to ON to see all the commands used when building the CUDA file. When -# using a Makefile generator the value defaults to VERBOSE (run make -# VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will -# always print the output. -# -# The script creates the following macros (in alphebetical order): -# -# CUDA_ADD_CUFFT_TO_TARGET( cuda_target ) -# -- Adds the cufft library to the target (can be any target). Handles whether -# you are in emulation mode or not. -# -# CUDA_ADD_CUBLAS_TO_TARGET( cuda_target ) -# -- Adds the cublas library to the target (can be any target). Handles -# whether you are in emulation mode or not. -# -# CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ... -# [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] ) -# -- Creates an executable "cuda_target" which is made up of the files -# specified. All of the non CUDA C files are compiled using the standard -# build rules specified by CMAKE and the cuda files are compiled to object -# files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is -# added automatically to include_directories(). Standard CMake target calls -# can be used on the target after calling this macro -# (e.g. set_target_properties and target_link_libraries). -# -# CUDA_ADD_LIBRARY( cuda_target file0 file1 ... -# [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] ) -# -- Same as CUDA_ADD_EXECUTABLE except that a library is created. -# -# CUDA_BUILD_CLEAN_TARGET() -# -- Creates a convience target that deletes all the dependency files -# generated. You should make clean after running this target to ensure the -# dependency files get regenerated. -# -# CUDA_COMPILE( generated_files file0 file1 ... [STATIC | SHARED | MODULE] -# [OPTIONS ...] ) -# -- Returns a list of generated files from the input source files to be used -# with ADD_LIBRARY or ADD_EXECUTABLE. -# -# CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] ) -# -- Returns a list of PTX files generated from the input source files. -# -# CUDA_INCLUDE_DIRECTORIES( path0 path1 ... ) -# -- Sets the directories that should be passed to nvcc -# (e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu -# files. -# -# CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ... -# [STATIC | SHARED | MODULE] [OPTIONS ...] ) -# -- This is where all the magic happens. CUDA_ADD_EXECUTABLE, -# CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this -# function under the hood. -# -# Given the list of files (file0 file1 ... fileN) this macro generates -# custom commands that generate either PTX or linkable objects (use "PTX" or -# "OBJ" for the format argument to switch). Files that don't end with .cu -# or have the HEADER_FILE_ONLY property are ignored. -# -# The arguments passed in after OPTIONS are extra command line options to -# give to nvcc. You can also specify per configuration options by -# specifying the name of the configuration followed by the options. General -# options must preceed configuration specific options. Not all -# configurations need to be specified, only the ones provided will be used. -# -# OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag" -# DEBUG -g -# RELEASE --use_fast_math -# RELWITHDEBINFO --use_fast_math;-g -# MINSIZEREL --use_fast_math -# -# For certain configurations (namely VS generating object files with -# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will -# be produced for the given cuda file. This is because when you add the -# cuda file to Visual Studio it knows that this file produces an object file -# and will link in the resulting object file automatically. -# -# This script also looks at optional arguments STATIC, SHARED, or MODULE to -# override the behavior specified by the value of the CMake variable -# BUILD_SHARED_LIBS. See BUILD_SHARED_LIBS below for more details. -# -# This script will also generate a separate cmake script that is used at -# build time to invoke nvcc. This is for serveral reasons. -# -# 1. nvcc can return negative numbers as return values which confuses -# Visual Studio into thinking that the command succeeded. The script now -# checks the error codes and produces errors when there was a problem. -# -# 2. nvcc has been known to not delete incomplete results when it -# encounters problems. This confuses build systems into thinking the -# target was generated when in fact an unusable file exists. The script -# now deletes the output files if there was an error. -# -# 3. By putting all the options that affect the build into a file and then -# make the build rule dependent on the file, the output files will be -# regenerated when the options change. -# -# In addition, on some systems special flags are added for building objects -# intended for shared libraries. FindCUDA make use of the CMake variable -# BUILD_SHARED_LIBS and the usual STATIC, SHARED, and MODULE arguments to -# determine if these flags should be used. Please set BUILD_SHARED_LIBS or -# pass in STATIC, SHARED, or MODULE according to how the objects are to be -# used before calling CUDA_ADD_LIBRARY. A preprocessor macro, -# _EXPORTS is defined when BUILD_SHARED_LIBS is defined. -# -# Flags passed into add_definitions with -D or /D are passed along to nvcc. -# -# The script defines the following variables: -# -# CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc. -# CUDA_VERSION_MINOR -- The minor version. -# CUDA_VERSION -# CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR -# -# CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set). -# CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the -# SDK. This script will not directly support finding -# specific libraries or headers, as that isn't -# supported by NVIDIA. If you want to change -# libraries when the path changes see the -# FindCUDA.cmake script for an example of how to clear -# these variables. There are also examples of how to -# use the CUDA_SDK_ROOT_DIR to locate headers or -# libraries, if you so choose (at your own risk). -# CUDA_INCLUDE_DIRS -- Include directory for cuda headers. Added automatically -# for CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY. -# CUDA_LIBRARIES -- Cuda RT library. -# CUDA_CUFFT_LIBRARIES -- Device or emulation library for the Cuda FFT -# implementation (alternative to: -# CUDA_ADD_CUFFT_TO_TARGET macro) -# CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS -# implementation (alterative to: -# CUDA_ADD_CUBLAS_TO_TARGET macro). -# -# -# James Bigler, NVIDIA Corp (nvidia.com - jbigler) -# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html -# -# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. -# -# Copyright (c) 2007-2009 -# Scientific Computing and Imaging Institute, University of Utah -# -# This code is licensed under the MIT License. See the FindCUDA.cmake script -# for the text of the license. - -# The MIT License -# -# License for the specific language governing rights and limitations under -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# -############################################################################### - -# FindCUDA.cmake - -# We need to have at least this version to support the VERSION_LESS argument to 'if' (2.6.2) and unset (2.6.3) -cmake_policy(PUSH) -cmake_minimum_required(VERSION 2.6.3) -cmake_policy(POP) - -# This macro helps us find the location of helper files we will need the full path to -macro(CUDA_FIND_HELPER_FILE _name _extension) - set(_full_name "${_name}.${_extension}") - # CMAKE_CURRENT_LIST_FILE contains the full path to the file currently being - # processed. Using this variable, we can pull out the current path, and - # provide a way to get access to the other files we need local to here. - get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - find_file(CUDA_${_name} ${_full_name} PATHS ${CMAKE_CURRENT_LIST_DIR}/FindCUDA NO_DEFAULT_PATH) - if(NOT CUDA_${_name}) - set(error_message "${_full_name} not found in CMAKE_MODULE_PATH") - if(CUDA_FIND_REQUIRED) - message(FATAL_ERROR "${error_message}") - else(CUDA_FIND_REQUIRED) - if(NOT CUDA_FIND_QUIETLY) - message(STATUS "${error_message}") - endif(NOT CUDA_FIND_QUIETLY) - endif(CUDA_FIND_REQUIRED) - endif(NOT CUDA_${_name}) - # Set this variable as internal, so the user isn't bugged with it. - set(CUDA_${_name} ${CUDA_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE) -endmacro(CUDA_FIND_HELPER_FILE) - -##################################################################### -## CUDA_INCLUDE_NVCC_DEPENDENCIES -## - -# So we want to try and include the dependency file if it exists. If -# it doesn't exist then we need to create an empty one, so we can -# include it. - -# If it does exist, then we need to check to see if all the files it -# depends on exist. If they don't then we should clear the dependency -# file and regenerate it later. This covers the case where a header -# file has disappeared or moved. - -macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file) - set(CUDA_NVCC_DEPEND) - set(CUDA_NVCC_DEPEND_REGENERATE FALSE) - - - # Include the dependency file. Create it first if it doesn't exist . The - # INCLUDE puts a dependency that will force CMake to rerun and bring in the - # new info when it changes. DO NOT REMOVE THIS (as I did and spent a few - # hours figuring out why it didn't work. - if(NOT EXISTS ${dependency_file}) - file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n") - endif() - # Always include this file to force CMake to run again next - # invocation and rebuild the dependencies. - #message("including dependency_file = ${dependency_file}") - include(${dependency_file}) - - # Now we need to verify the existence of all the included files - # here. If they aren't there we need to just blank this variable and - # make the file regenerate again. -# if(DEFINED CUDA_NVCC_DEPEND) -# message("CUDA_NVCC_DEPEND set") -# else() -# message("CUDA_NVCC_DEPEND NOT set") -# endif() - if(CUDA_NVCC_DEPEND) - #message("CUDA_NVCC_DEPEND true") - foreach(f ${CUDA_NVCC_DEPEND}) - #message("searching for ${f}") - if(NOT EXISTS ${f}) - #message("file ${f} not found") - set(CUDA_NVCC_DEPEND_REGENERATE TRUE) - endif() - endforeach(f) - else(CUDA_NVCC_DEPEND) - #message("CUDA_NVCC_DEPEND false") - # No dependencies, so regenerate the file. - set(CUDA_NVCC_DEPEND_REGENERATE TRUE) - endif(CUDA_NVCC_DEPEND) - - #message("CUDA_NVCC_DEPEND_REGENERATE = ${CUDA_NVCC_DEPEND_REGENERATE}") - # No incoming dependencies, so we need to generate them. Make the - # output depend on the dependency file itself, which should cause the - # rule to re-run. - if(CUDA_NVCC_DEPEND_REGENERATE) - file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n") - endif(CUDA_NVCC_DEPEND_REGENERATE) - -endmacro(CUDA_INCLUDE_NVCC_DEPENDENCIES) - -############################################################################### -############################################################################### -# Setup variables' defaults -############################################################################### -############################################################################### - -# Allow the user to specify if the device code is supposed to be 32 or 64 bit. -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(CUDA_64_BIT_DEVICE_CODE_DEFAULT ON) -else() - set(CUDA_64_BIT_DEVICE_CODE_DEFAULT OFF) -endif() -option(CUDA_64_BIT_DEVICE_CODE "Compile device code in 64 bit mode" ${CUDA_64_BIT_DEVICE_CODE_DEFAULT}) - -# Attach the build rule to the source file in VS. This option -option(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE "Attach the build rule to the CUDA source file. Enable only when the CUDA source file is added to at most one target." ON) - -# Prints out extra information about the cuda file during compilation -option(CUDA_BUILD_CUBIN "Generate and parse .cubin files in Device mode." OFF) - -# Set whether we are using emulation or device mode. -option(CUDA_BUILD_EMULATION "Build in Emulation mode" OFF) - -# Where to put the generated output. -set(CUDA_GENERATED_OUTPUT_DIR "" CACHE PATH "Directory to put all the output files. If blank it will default to the CMAKE_CURRENT_BINARY_DIR") - -# Parse HOST_COMPILATION mode. -option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON) - -# Extra user settable flags -set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") - -# Propagate the host flags to the host compiler via -Xcompiler -option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON) - -# Specifies whether the commands used when compiling the .cu file will be printed out. -option(CUDA_VERBOSE_BUILD "Print out the commands run while compiling the CUDA source file. With the Makefile generator this defaults to VERBOSE variable specified on the command line, but can be forced on with this option." OFF) - -mark_as_advanced( - CUDA_64_BIT_DEVICE_CODE - CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE - CUDA_GENERATED_OUTPUT_DIR - CUDA_HOST_COMPILATION_CPP - CUDA_NVCC_FLAGS - CUDA_PROPAGATE_HOST_FLAGS - ) - -# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we -# need to add another entry for the CMAKE_BUILD_TYPE. We also need to add the -# standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo) -# for completeness. We need run this loop in order to accomodate the addition -# of extra configuration types. Duplicate entries will be removed by -# REMOVE_DUPLICATES. -set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo) -list(REMOVE_DUPLICATES CUDA_configuration_types) -foreach(config ${CUDA_configuration_types}) - string(TOUPPER ${config} config_upper) - set(CUDA_NVCC_FLAGS_${config_upper} "" CACHE STRING "Semi-colon delimit multiple arguments.") - mark_as_advanced(CUDA_NVCC_FLAGS_${config_upper}) -endforeach() - -############################################################################### -############################################################################### -# Locate CUDA, Set Build Type, etc. -############################################################################### -############################################################################### - -# Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed, -# if they have then clear the cache variables, so that will be detected again. -if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}") - unset(CUDA_NVCC_EXECUTABLE CACHE) - unset(CUDA_VERSION CACHE) - unset(CUDA_TOOLKIT_INCLUDE CACHE) - unset(CUDA_CUDART_LIBRARY CACHE) - unset(CUDA_CUDA_LIBRARY CACHE) - unset(CUDA_cublas_LIBRARY CACHE) - unset(CUDA_cublasemu_LIBRARY CACHE) - unset(CUDA_cufft_LIBRARY CACHE) - unset(CUDA_cufftemu_LIBRARY CACHE) -endif() - -if(NOT "${CUDA_SDK_ROOT_DIR}" STREQUAL "${CUDA_SDK_ROOT_DIR_INTERNAL}") - # No specific variables to catch. Use this kind of code before calling - # find_package(CUDA) to clean up any variables that may depend on this path. - - # unset(MY_SPECIAL_CUDA_SDK_INCLUDE_DIR CACHE) - # unset(MY_SPECIAL_CUDA_SDK_LIBRARY CACHE) -endif() - -# Search for the cuda distribution. -if(NOT CUDA_TOOLKIT_ROOT_DIR) - - # Search in the CUDA_BIN_PATH first. - find_path(CUDA_TOOLKIT_ROOT_DIR - NAMES nvcc nvcc.exe - PATHS ENV CUDA_BIN_PATH - DOC "Toolkit location." - NO_DEFAULT_PATH - ) - # Now search default paths - find_path(CUDA_TOOLKIT_ROOT_DIR - NAMES nvcc nvcc.exe - PATHS /usr/local/bin - /usr/local/cuda/bin - DOC "Toolkit location." - ) - - if (CUDA_TOOLKIT_ROOT_DIR) - string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR}) - # We need to force this back into the cache. - set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE) - endif(CUDA_TOOLKIT_ROOT_DIR) - if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) - if(CUDA_FIND_REQUIRED) - message(FATAL_ERROR "Specify CUDA_TOOLKIT_ROOT_DIR") - elseif(NOT CUDA_FIND_QUIETLY) - message("CUDA_TOOLKIT_ROOT_DIR not found or specified") - endif() - endif (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) -endif (NOT CUDA_TOOLKIT_ROOT_DIR) - -# CUDA_NVCC_EXECUTABLE -find_program(CUDA_NVCC_EXECUTABLE - NAMES nvcc - PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin" - "${CUDA_TOOLKIT_ROOT_DIR}/bin64" - ENV CUDA_BIN_PATH - NO_DEFAULT_PATH - ) -# Search default search paths, after we search our own set of paths. -find_program(CUDA_NVCC_EXECUTABLE nvcc) -mark_as_advanced(CUDA_NVCC_EXECUTABLE) - -if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION) - # Compute the version. - exec_program(${CUDA_NVCC_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE NVCC_OUT) - string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT}) - string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT}) - set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.") - mark_as_advanced(CUDA_VERSION) -endif() - -# Always set this convenience variable -set(CUDA_VERSION_STRING "${CUDA_VERSION}") - -# Here we need to determine if the version we found is acceptable. We will -# assume that is unless CUDA_FIND_VERSION_EXACT or CUDA_FIND_VERSION is -# specified. The presence of either of these options checks the version -# string and signals if the version is acceptable or not. -set(_cuda_version_acceptable TRUE) -# -if(CUDA_FIND_VERSION_EXACT AND NOT CUDA_VERSION VERSION_EQUAL CUDA_FIND_VERSION) - set(_cuda_version_acceptable FALSE) -endif() -# -if(CUDA_FIND_VERSION AND CUDA_VERSION VERSION_LESS CUDA_FIND_VERSION) - set(_cuda_version_acceptable FALSE) -endif() -# -if(NOT _cuda_version_acceptable) - set(_cuda_error_message "Requested CUDA version ${CUDA_FIND_VERSION}, but found unacceptable version ${CUDA_VERSION}") - if(CUDA_FIND_REQUIRED) - message("${_cuda_error_message}") - elseif(NOT CUDA_FIND_QUIETLY) - message("${_cuda_error_message}") - endif() -endif() - -# CUDA_TOOLKIT_INCLUDE -find_path(CUDA_TOOLKIT_INCLUDE - device_functions.h # Header included in toolkit - PATHS "${CUDA_TOOLKIT_ROOT_DIR}/include" - ENV CUDA_INC_PATH - NO_DEFAULT_PATH - ) -# Search default search paths, after we search our own set of paths. -find_path(CUDA_TOOLKIT_INCLUDE device_functions.h) -mark_as_advanced(CUDA_TOOLKIT_INCLUDE) - -# Set the user list of include dir to nothing to initialize it. -set (CUDA_NVCC_INCLUDE_ARGS_USER "") -set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) - -macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_cuda_64bit_lib_dir "${CUDA_TOOLKIT_ROOT_DIR}/lib64") - endif() - find_library(${_var} - NAMES ${_names} - PATHS ${_cuda_64bit_lib_dir} - "${CUDA_TOOLKIT_ROOT_DIR}/lib" - ENV CUDA_LIB_PATH - DOC ${_doc} - NO_DEFAULT_PATH - ) - # Search default search paths, after we search our own set of paths. - find_library(${_var} NAMES ${_names} DOC ${_doc}) -endmacro() - -# CUDA_LIBRARIES -find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library") -set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) - -# 1.1 toolkit on linux doesn't appear to have a separate library on -# some platforms. -find_library_local_first(CUDA_CUDA_LIBRARY cuda "\"cuda\" library (older versions only).") - -# Add cuda library to the link line only if it is found. -if (CUDA_CUDA_LIBRARY) - set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) -endif(CUDA_CUDA_LIBRARY) - -mark_as_advanced( - CUDA_CUDA_LIBRARY - CUDA_CUDART_LIBRARY - ) - -####################### -# Look for some of the toolkit helper libraries -macro(FIND_CUDA_HELPER_LIBS _name) - find_library_local_first(CUDA_${_name}_LIBRARY ${_name} "\"${_name}\" library") - mark_as_advanced(CUDA_${_name}_LIBRARY) -endmacro(FIND_CUDA_HELPER_LIBS) - -# Search for cufft and cublas libraries. -find_cuda_helper_libs(cufftemu) -find_cuda_helper_libs(cublasemu) -find_cuda_helper_libs(cufft) -find_cuda_helper_libs(cublas) - -if (CUDA_BUILD_EMULATION) - set(CUDA_CUFFT_LIBRARIES ${CUDA_cufftemu_LIBRARY}) - set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublasemu_LIBRARY}) -else() - set(CUDA_CUFFT_LIBRARIES ${CUDA_cufft_LIBRARY}) - set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY}) -endif() - -######################## -# Look for the SDK stuff -find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h - "$ENV{NVSDKCUDA_ROOT}" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]" - "/Developer/GPU\ Computing/C" - ) - -# Keep the CUDA_SDK_ROOT_DIR first in order to be able to override the -# environment variables. -set(CUDA_SDK_SEARCH_PATH - "${CUDA_SDK_ROOT_DIR}" - "${CUDA_TOOLKIT_ROOT_DIR}/local/NVSDK0.2" - "${CUDA_TOOLKIT_ROOT_DIR}/NVSDK0.2" - "${CUDA_TOOLKIT_ROOT_DIR}/NV_CUDA_SDK" - "$ENV{HOME}/NVIDIA_CUDA_SDK" - "$ENV{HOME}/NVIDIA_CUDA_SDK_MACOSX" - "/Developer/CUDA" - ) - -# Example of how to find an include file from the CUDA_SDK_ROOT_DIR - -# find_path(CUDA_CUT_INCLUDE_DIR -# cutil.h -# PATHS ${CUDA_SDK_SEARCH_PATH} -# PATH_SUFFIXES "common/inc" -# DOC "Location of cutil.h" -# NO_DEFAULT_PATH -# ) -# # Now search system paths -# find_path(CUDA_CUT_INCLUDE_DIR cutil.h DOC "Location of cutil.h") - -# mark_as_advanced(CUDA_CUT_INCLUDE_DIR) - - -# Example of how to find a library in the CUDA_SDK_ROOT_DIR - -# # cutil library is called cutil64 for 64 bit builds on windows. We don't want -# # to get these confused, so we are setting the name based on the word size of -# # the build. - -# if(CMAKE_SIZEOF_VOID_P EQUAL 8) -# set(cuda_cutil_name cutil64) -# else(CMAKE_SIZEOF_VOID_P EQUAL 8) -# set(cuda_cutil_name cutil32) -# endif(CMAKE_SIZEOF_VOID_P EQUAL 8) - -# find_library(CUDA_CUT_LIBRARY -# NAMES cutil ${cuda_cutil_name} -# PATHS ${CUDA_SDK_SEARCH_PATH} -# # The new version of the sdk shows up in common/lib, but the old one is in lib -# PATH_SUFFIXES "common/lib" "lib" -# DOC "Location of cutil library" -# NO_DEFAULT_PATH -# ) -# # Now search system paths -# find_library(CUDA_CUT_LIBRARY NAMES cutil ${cuda_cutil_name} DOC "Location of cutil library") -# mark_as_advanced(CUDA_CUT_LIBRARY) -# set(CUDA_CUT_LIBRARIES ${CUDA_CUT_LIBRARY}) - - - -############################# -# Check for required components -set(CUDA_FOUND TRUE) - -set(CUDA_TOOLKIT_ROOT_DIR_INTERNAL "${CUDA_TOOLKIT_ROOT_DIR}" CACHE INTERNAL - "This is the value of the last time CUDA_TOOLKIT_ROOT_DIR was set successfully." FORCE) -set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL - "This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CUDA DEFAULT_MSG - CUDA_TOOLKIT_ROOT_DIR - CUDA_NVCC_EXECUTABLE - CUDA_INCLUDE_DIRS - CUDA_CUDART_LIBRARY - _cuda_version_acceptable - ) - - - -############################################################################### -############################################################################### -# Macros -############################################################################### -############################################################################### - -############################################################################### -# Add include directories to pass to the nvcc command. -macro(CUDA_INCLUDE_DIRECTORIES) - foreach(dir ${ARGN}) - list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER "-I${dir}") - endforeach(dir ${ARGN}) -endmacro(CUDA_INCLUDE_DIRECTORIES) - - -############################################################################## -cuda_find_helper_file(parse_cubin cmake) -cuda_find_helper_file(make2cmake cmake) -cuda_find_helper_file(run_nvcc cmake) - -############################################################################## -# Separate the OPTIONS out from the sources -# -macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options) - set( ${_sources} ) - set( ${_cmake_options} ) - set( ${_options} ) - set( _found_options FALSE ) - foreach(arg ${ARGN}) - if(arg STREQUAL "OPTIONS") - set( _found_options TRUE ) - elseif( - arg STREQUAL "WIN32" OR - arg STREQUAL "MACOSX_BUNDLE" OR - arg STREQUAL "EXCLUDE_FROM_ALL" OR - arg STREQUAL "STATIC" OR - arg STREQUAL "SHARED" OR - arg STREQUAL "MODULE" - ) - list(APPEND ${_cmake_options} "${arg}") - else() - if ( _found_options ) - list(APPEND ${_options} "${arg}") - else() - # Assume this is a file - list(APPEND ${_sources} "${arg}") - endif() - endif() - endforeach() -endmacro() - -############################################################################## -# Parse the OPTIONS from ARGN and set the variables prefixed by _option_prefix -# -macro(CUDA_PARSE_NVCC_OPTIONS _option_prefix) - set( _found_config ) - foreach(arg ${ARGN}) - # Determine if we are dealing with a perconfiguration flag - foreach(config ${CUDA_configuration_types}) - string(TOUPPER ${config} config_upper) - if (arg STREQUAL "${config_upper}") - set( _found_config _${arg}) - # Set arg to nothing to keep it from being processed further - set( arg ) - endif() - endforeach() - - if ( arg ) - list(APPEND ${_option_prefix}${_found_config} "${arg}") - endif() - endforeach() -endmacro() - -############################################################################## -# Helper to add the include directory for CUDA only once -function(CUDA_ADD_CUDA_INCLUDE_ONCE) - get_directory_property(_include_directories INCLUDE_DIRECTORIES) - set(_add TRUE) - if(_include_directories) - foreach(dir ${_include_directories}) - if("${dir}" STREQUAL "${CUDA_INCLUDE_DIRS}") - set(_add FALSE) - endif() - endforeach() - endif() - if(_add) - include_directories(${CUDA_INCLUDE_DIRS}) - endif() -endfunction() - -############################################################################## -# This helper macro populates the following variables and setups up custom -# commands and targets to invoke the nvcc compiler to generate C or PTX source -# dependant upon the format parameter. The compiler is invoked once with -M -# to generate a dependency file and a second time with -cuda or -ptx to generate -# a .cpp or .ptx file. -# INPUT: -# cuda_target - Target name -# format - PTX or OBJ -# FILE1 .. FILEN - The remaining arguments are the sources to be wrapped. -# OPTIONS - Extra options to NVCC -# OUTPUT: -# generated_files - List of generated files -############################################################################## -############################################################################## - -macro(CUDA_WRAP_SRCS cuda_target format generated_files) - - if( ${format} MATCHES "PTX" ) - set( compile_to_ptx ON ) - elseif( ${format} MATCHES "OBJ") - set( compile_to_ptx OFF ) - else() - message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.") - endif() - - # Set up all the command line flags here, so that they can be overriden on a per target basis. - - set(nvcc_flags "") - - # Emulation if the card isn't present. - if (CUDA_BUILD_EMULATION) - # Emulation. - set(nvcc_flags ${nvcc_flags} --device-emulation --keep -D_DEVICEEMU -g) - else(CUDA_BUILD_EMULATION) - # Device mode. No flags necessary. - endif(CUDA_BUILD_EMULATION) - - if(CUDA_HOST_COMPILATION_CPP) - set(CUDA_C_OR_CXX CXX) - else(CUDA_HOST_COMPILATION_CPP) - set(nvcc_flags ${nvcc_flags} --host-compilation C) - set(CUDA_C_OR_CXX C) - endif(CUDA_HOST_COMPILATION_CPP) - - set(generated_extension ${CMAKE_${CUDA_C_OR_CXX}_OUTPUT_EXTENSION}) - - if(CUDA_64_BIT_DEVICE_CODE) - set(nvcc_flags ${nvcc_flags} -m64) - else() - set(nvcc_flags ${nvcc_flags} -m32) - endif() - - # This needs to be passed in at this stage, because VS needs to fill out the - # value of VCInstallDir from within VS. - if(CMAKE_GENERATOR MATCHES "Visual Studio") - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - # Add nvcc flag for 64b Windows - set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) - endif() - endif() - - # Figure out which configure we will use and pass that in as an argument to - # the script. We need to defer the decision until compilation time, because - # for VS projects we won't know if we are making a debug or release build - # until build time. - if(CMAKE_GENERATOR MATCHES "Visual Studio") - set( CUDA_build_configuration "$(ConfigurationName)" ) - else() - set( CUDA_build_configuration "${CMAKE_BUILD_TYPE}") - endif() - - # Initialize our list of includes with the user ones followed by the CUDA system ones. - set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}") - # Get the include directories for this directory and use them for our nvcc command. - get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES) - if(CUDA_NVCC_INCLUDE_DIRECTORIES) - foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES}) - list(APPEND CUDA_NVCC_INCLUDE_ARGS "-I${dir}") - endforeach() - endif() - - # Reset these variables - set(CUDA_WRAP_OPTION_NVCC_FLAGS) - foreach(config ${CUDA_configuration_types}) - string(TOUPPER ${config} config_upper) - set(CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}) - endforeach() - - CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${ARGN}) - CUDA_PARSE_NVCC_OPTIONS(CUDA_WRAP_OPTION_NVCC_FLAGS ${_cuda_wrap_options}) - - # Figure out if we are building a shared library. Default the value of BUILD_SHARED_LIBS. - set(_cuda_build_shared_libs ${BUILD_SHARED_LIBS}) - # SHARED, MODULE - list(FIND _cuda_wrap_cmake_options SHARED _cuda_found_SHARED) - list(FIND _cuda_wrap_cmake_options MODULE _cuda_found_MODULE) - if(_cuda_found_SHARED GREATER -1 OR _cuda_found_MODULE GREATER -1) - set(_cuda_build_shared_libs TRUE) - endif() - # STATIC - list(FIND _cuda_wrap_cmake_options STATIC _cuda_found_STATIC) - if(_cuda_found_STATIC GREATER -1) - set(_cuda_build_shared_libs FALSE) - endif() - - # CUDA_HOST_FLAGS - if(_cuda_build_shared_libs) - # If we are setting up code for a shared library, then we need to add extra flags for - # compiling objects for shared libraries. - set(CUDA_HOST_SHARED_FLAGS ${CMAKE_SHARED_LIBRARY_${CUDA_C_OR_CXX}_FLAGS}) - endif() - # Only add the CMAKE_{C,CXX}_FLAGS if we are propagating host flags. We - # always need to set the SHARED_FLAGS, though. - if(CUDA_PROPAGATE_HOST_FLAGS) - set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})") - else() - set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})") - endif() - - set(CUDA_NVCC_FLAGS_CONFIG "# Build specific configuration flags") - # Loop over all the configuration types to generate appropriate flags for run_nvcc.cmake - foreach(config ${CUDA_configuration_types}) - string(TOUPPER ${config} config_upper) - # CMAKE_FLAGS are strings and not lists. By not putting quotes around CMAKE_FLAGS - # we convert the strings to lists (like we want). - - if(CUDA_PROPAGATE_HOST_FLAGS) - # nvcc chokes on -g3, so replace it with -g - if(CMAKE_COMPILER_IS_GNUCC) - string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") - else() - set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") - endif() - - STRING(REPLACE "-Werror" "" _cuda_C_FLAGS "${_cuda_C_FLAGS}") - - set(CUDA_HOST_FLAGS "${CUDA_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") - - endif() - - # Note that if we ever want CUDA_NVCC_FLAGS_ to be string (instead of a list - # like it is currently), we can remove the quotes around the - # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_ variable. - set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} \"${CUDA_NVCC_FLAGS_${config_upper}};;${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}}\")") - endforeach() - - if(compile_to_ptx) - # Don't use any of the host compilation flags for PTX targets. - set(CUDA_HOST_FLAGS) - set(CUDA_NVCC_FLAGS_CONFIG) - endif() - - # Get the list of definitions from the directory property - get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS) - if(CUDA_NVCC_DEFINITIONS) - foreach(_definition ${CUDA_NVCC_DEFINITIONS}) - list(APPEND nvcc_flags "-D${_definition}") - endforeach() - endif() - - if(_cuda_build_shared_libs) - list(APPEND nvcc_flags "-D${cuda_target}_EXPORTS") - endif() - - # Determine output directory - if(CUDA_GENERATED_OUTPUT_DIR) - set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}") - else() - set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}") - endif() - - # Reset the output variable - set(_cuda_wrap_generated_files "") - - # Iterate over the macro arguments and create custom - # commands for all the .cu files. - foreach(file ${ARGN}) - # Ignore any file marked as a HEADER_FILE_ONLY - get_source_file_property(_is_header ${file} HEADER_FILE_ONLY) - if(${file} MATCHES ".*\\.cu$" AND NOT _is_header) - - # Add a custom target to generate a c or ptx file. ###################### - - get_filename_component( basename ${file} NAME ) - if( compile_to_ptx ) - set(generated_file_path "${cuda_compile_output_dir}") - set(generated_file_basename "${cuda_target}_generated_${basename}.ptx") - set(format_flag "-ptx") - file(MAKE_DIRECTORY "${cuda_compile_output_dir}") - else( compile_to_ptx ) - set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}") - set(generated_file_basename "${cuda_target}_generated_${basename}${generated_extension}") - set(format_flag "-c") - endif( compile_to_ptx ) - - # Set all of our file names. Make sure that whatever filenames that have - # generated_file_path in them get passed in through as a command line - # argument, so that the ${CMAKE_CFG_INTDIR} gets expanded at run time - # instead of configure time. - set(generated_file "${generated_file_path}/${generated_file_basename}") - set(cmake_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.depend") - set(NVCC_generated_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.NVCC-depend") - set(generated_cubin_file "${generated_file_path}/${generated_file_basename}.cubin.txt") - set(custom_target_script "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.cmake") - - # Setup properties for obj files: - if( NOT compile_to_ptx ) - set_source_files_properties("${generated_file}" - PROPERTIES - EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked. - ) - endif() - - # Don't add CMAKE_CURRENT_SOURCE_DIR if the path is already an absolute path. - get_filename_component(file_path "${file}" PATH) - if(IS_ABSOLUTE "${file_path}") - set(source_file "${file}") - else() - set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") - endif() - - # Bring in the dependencies. Creates a variable CUDA_NVCC_DEPEND ####### - cuda_include_nvcc_dependencies(${cmake_dependency_file}) - - # Convience string for output ########################################### - if(CUDA_BUILD_EMULATION) - set(cuda_build_type "Emulation") - else(CUDA_BUILD_EMULATION) - set(cuda_build_type "Device") - endif(CUDA_BUILD_EMULATION) - - # Build the NVCC made dependency file ################################### - set(build_cubin OFF) - if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN ) - if ( NOT compile_to_ptx ) - set ( build_cubin ON ) - endif( NOT compile_to_ptx ) - endif( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN ) - - # Configure the build script - configure_file("${CUDA_run_nvcc}" "${custom_target_script}" @ONLY) - - # So if a user specifies the same cuda file as input more than once, you - # can have bad things happen with dependencies. Here we check an option - # to see if this is the behavior they want. - if(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE) - set(main_dep MAIN_DEPENDENCY ${source_file}) - else() - set(main_dep DEPENDS ${source_file}) - endif() - - if(CUDA_VERBOSE_BUILD) - set(verbose_output ON) - elseif(CMAKE_GENERATOR MATCHES "Makefiles") - set(verbose_output "$(VERBOSE)") - else() - set(verbose_output OFF) - endif() - - # Create up the comment string - file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}") - if(compile_to_ptx) - set(cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}") - else() - set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}") - endif() - - # Build the generated file and dependency file ########################## - add_custom_command( - OUTPUT ${generated_file} - # These output files depend on the source_file and the contents of cmake_dependency_file - ${main_dep} - DEPENDS ${CUDA_NVCC_DEPEND} - DEPENDS ${custom_target_script} - # Make sure the output directory exists before trying to write to it. - COMMAND ${CMAKE_COMMAND} -E make_directory "${generated_file_path}" - COMMAND ${CMAKE_COMMAND} ARGS - -D verbose:BOOL=${verbose_output} - ${ccbin_flags} - -D build_configuration:STRING=${CUDA_build_configuration} - -D "generated_file:STRING=${generated_file}" - -D "generated_cubin_file:STRING=${generated_cubin_file}" - -P "${custom_target_script}" - COMMENT "${cuda_build_comment_string}" - ) - - # Make sure the build system knows the file is generated. - set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE) - - # Don't add the object file to the list of generated files if we are using - # visual studio and we are attaching the build rule to the cuda file. VS - # will add our object file to the linker automatically for us. - set(cuda_add_generated_file TRUE) - - if(NOT compile_to_ptx AND CMAKE_GENERATOR MATCHES "Visual Studio" AND CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE) - # Visual Studio 8 crashes when you close the solution when you don't add the object file. - if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 8") - #message("Not adding ${generated_file}") - set(cuda_add_generated_file FALSE) - endif() - endif() - - if(cuda_add_generated_file) - list(APPEND _cuda_wrap_generated_files ${generated_file}) - endif() - - # Add the other files that we want cmake to clean on a cleanup ########## - list(APPEND CUDA_ADDITIONAL_CLEAN_FILES "${cmake_dependency_file}") - list(REMOVE_DUPLICATES CUDA_ADDITIONAL_CLEAN_FILES) - set(CUDA_ADDITIONAL_CLEAN_FILES ${CUDA_ADDITIONAL_CLEAN_FILES} CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.") - - endif(${file} MATCHES ".*\\.cu$" AND NOT _is_header) - endforeach(file) - - # Set the return parameter - set(${generated_files} ${_cuda_wrap_generated_files}) -endmacro(CUDA_WRAP_SRCS) - - -############################################################################### -############################################################################### -# ADD LIBRARY -############################################################################### -############################################################################### -macro(CUDA_ADD_LIBRARY cuda_target) - - CUDA_ADD_CUDA_INCLUDE_ONCE() - - # Separate the sources from the options - CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN}) - # Create custom commands and targets for each file. - CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources} ${_cmake_options} - OPTIONS ${_options} ) - - # Add the library. - add_library(${cuda_target} ${_cmake_options} - ${_generated_files} - ${_sources} - ) - - target_link_libraries(${cuda_target} - ${CUDA_LIBRARIES} - ) - - # We need to set the linker language based on what the expected generated file - # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP. - set_target_properties(${cuda_target} - PROPERTIES - LINKER_LANGUAGE ${CUDA_C_OR_CXX} - ) - -endmacro(CUDA_ADD_LIBRARY cuda_target) - - -############################################################################### -############################################################################### -# ADD EXECUTABLE -############################################################################### -############################################################################### -macro(CUDA_ADD_EXECUTABLE cuda_target) - - CUDA_ADD_CUDA_INCLUDE_ONCE() - - # Separate the sources from the options - CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN}) - # Create custom commands and targets for each file. - CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources} OPTIONS ${_options} ) - - # Add the library. - add_executable(${cuda_target} ${_cmake_options} - ${_generated_files} - ${_sources} - ) - - target_link_libraries(${cuda_target} - ${CUDA_LIBRARIES} - ) - - # We need to set the linker language based on what the expected generated file - # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP. - set_target_properties(${cuda_target} - PROPERTIES - LINKER_LANGUAGE ${CUDA_C_OR_CXX} - ) - -endmacro(CUDA_ADD_EXECUTABLE cuda_target) - - -############################################################################### -############################################################################### -# CUDA COMPILE -############################################################################### -############################################################################### -macro(CUDA_COMPILE generated_files) - - # Separate the sources from the options - CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN}) - # Create custom commands and targets for each file. - CUDA_WRAP_SRCS( cuda_compile OBJ _generated_files ${_sources} ${_cmake_options} - OPTIONS ${_options} ) - - set( ${generated_files} ${_generated_files}) - -endmacro(CUDA_COMPILE) - - -############################################################################### -############################################################################### -# CUDA COMPILE PTX -############################################################################### -############################################################################### -macro(CUDA_COMPILE_PTX generated_files) - - # Separate the sources from the options - CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN}) - # Create custom commands and targets for each file. - CUDA_WRAP_SRCS( cuda_compile_ptx PTX _generated_files ${_sources} ${_cmake_options} - OPTIONS ${_options} ) - - set( ${generated_files} ${_generated_files}) - -endmacro(CUDA_COMPILE_PTX) - -############################################################################### -############################################################################### -# CUDA ADD CUFFT TO TARGET -############################################################################### -############################################################################### -macro(CUDA_ADD_CUFFT_TO_TARGET target) - if (CUDA_BUILD_EMULATION) - target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY}) - else() - target_link_libraries(${target} ${CUDA_cufft_LIBRARY}) - endif() -endmacro() - -############################################################################### -############################################################################### -# CUDA ADD CUBLAS TO TARGET -############################################################################### -############################################################################### -macro(CUDA_ADD_CUBLAS_TO_TARGET target) - if (CUDA_BUILD_EMULATION) - target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY}) - else() - target_link_libraries(${target} ${CUDA_cublas_LIBRARY}) - endif() -endmacro() - -############################################################################### -############################################################################### -# CUDA BUILD CLEAN TARGET -############################################################################### -############################################################################### -macro(CUDA_BUILD_CLEAN_TARGET) - # Call this after you add all your CUDA targets, and you will get a convience - # target. You should also make clean after running this target to get the - # build system to generate all the code again. - - set(cuda_clean_target_name clean_cuda_depends) - if (CMAKE_GENERATOR MATCHES "Visual Studio") - string(TOUPPER ${cuda_clean_target_name} cuda_clean_target_name) - endif() - add_custom_target(${cuda_clean_target_name} - COMMAND ${CMAKE_COMMAND} -E remove ${CUDA_ADDITIONAL_CLEAN_FILES}) - - # Clear out the variable, so the next time we configure it will be empty. - # This is useful so that the files won't persist in the list after targets - # have been removed. - set(CUDA_ADDITIONAL_CLEAN_FILES "" CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.") -endmacro(CUDA_BUILD_CLEAN_TARGET) diff --git a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/make2cmake.cmake b/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/make2cmake.cmake deleted file mode 100755 index 7fce167c2..000000000 --- a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/make2cmake.cmake +++ /dev/null @@ -1,79 +0,0 @@ -# James Bigler, NVIDIA Corp (nvidia.com - jbigler) -# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html -# -# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. -# -# Copyright (c) 2007-2009 -# Scientific Computing and Imaging Institute, University of Utah -# -# This code is licensed under the MIT License. See the FindCUDA.cmake script -# for the text of the license. - -# The MIT License -# -# License for the specific language governing rights and limitations under -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# - -####################################################################### -# This converts a file written in makefile syntax into one that can be included -# by CMake. - -file(READ ${input_file} depend_text) - -if (${depend_text} MATCHES ".+") - - # message("FOUND DEPENDS") - - # Remember, four backslashes is escaped to one backslash in the string. - string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text}) - - # This works for the nvcc -M generated dependency files. - string(REGEX REPLACE "^.* : " "" depend_text ${depend_text}) - string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text}) - - set(dependency_list "") - - foreach(file ${depend_text}) - - string(REGEX REPLACE "^ +" "" file ${file}) - - if(NOT IS_DIRECTORY ${file}) - # If softlinks start to matter, we should change this to REALPATH. For now we need - # to flatten paths, because nvcc can generate stuff like /bin/../include instead of - # just /include. - get_filename_component(file_absolute "${file}" ABSOLUTE) - list(APPEND dependency_list "${file_absolute}") - endif(NOT IS_DIRECTORY ${file}) - - endforeach(file) - -else() - # message("FOUND NO DEPENDS") -endif() - -# Remove the duplicate entries and sort them. -list(REMOVE_DUPLICATES dependency_list) -list(SORT dependency_list) - -foreach(file ${dependency_list}) - set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n") -endforeach() - -file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n") diff --git a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/parse_cubin.cmake b/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/parse_cubin.cmake deleted file mode 100644 index 2518c6852..000000000 --- a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/parse_cubin.cmake +++ /dev/null @@ -1,112 +0,0 @@ -# James Bigler, NVIDIA Corp (nvidia.com - jbigler) -# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html -# -# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. -# -# Copyright (c) 2007-2009 -# Scientific Computing and Imaging Institute, University of Utah -# -# This code is licensed under the MIT License. See the FindCUDA.cmake script -# for the text of the license. - -# The MIT License -# -# License for the specific language governing rights and limitations under -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# - -####################################################################### -# Parses a .cubin file produced by nvcc and reports statistics about the file. - - -file(READ ${input_file} file_text) - -if (${file_text} MATCHES ".+") - - # Remember, four backslashes is escaped to one backslash in the string. - string(REGEX REPLACE ";" "\\\\;" file_text ${file_text}) - string(REGEX REPLACE "\ncode" ";code" file_text ${file_text}) - - list(LENGTH file_text len) - - foreach(line ${file_text}) - - # Only look at "code { }" blocks. - if(line MATCHES "^code") - - # Break into individual lines. - string(REGEX REPLACE "\n" ";" line ${line}) - - foreach(entry ${line}) - - # Extract kernel names. - if (${entry} MATCHES "[^g]name = ([^ ]+)") - string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry}) - - # Check to see if the kernel name starts with "_" - set(skip FALSE) - # if (${entry} MATCHES "^_") - # Skip the rest of this block. - # message("Skipping ${entry}") - # set(skip TRUE) - # else (${entry} MATCHES "^_") - message("Kernel: ${entry}") - # endif (${entry} MATCHES "^_") - - endif(${entry} MATCHES "[^g]name = ([^ ]+)") - - # Skip the rest of the block if necessary - if(NOT skip) - - # Registers - if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)") - string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) - message("Registers: ${entry}") - endif() - - # Local memory - if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)") - string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) - message("Local: ${entry}") - endif() - - # Shared memory - if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)") - string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) - message("Shared: ${entry}") - endif() - - if (${entry} MATCHES "^}") - message("") - endif() - - endif(NOT skip) - - - endforeach(entry) - - endif(line MATCHES "^code") - - endforeach(line) - -else() - # message("FOUND NO DEPENDS") -endif() - - diff --git a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/run_nvcc.cmake b/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/run_nvcc.cmake deleted file mode 100755 index 4a9a7d4d6..000000000 --- a/Source/Contrib/ComputeBase/CMake/cuda/FindCUDA/run_nvcc.cmake +++ /dev/null @@ -1,259 +0,0 @@ -# James Bigler, NVIDIA Corp (nvidia.com - jbigler) -# -# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. -# -# This code is licensed under the MIT License. See the FindCUDA.cmake script -# for the text of the license. - -# The MIT License -# -# License for the specific language governing rights and limitations under -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - - -########################################################################## -# This file runs the nvcc commands to produce the desired output file along with -# the dependency file needed by CMake to compute dependencies. In addition the -# file checks the output of each command and if the command fails it deletes the -# output files. - -# Input variables -# -# verbose:BOOL=<> OFF: Be as quiet as possible (default) -# ON : Describe each step -# -# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or -# RelWithDebInfo, but it should match one of the -# entries in CUDA_HOST_FLAGS. This is the build -# configuration used when compiling the code. If -# blank or unspecified Debug is assumed as this is -# what CMake does. -# -# generated_file:STRING=<> File to generate. This argument must be passed in. -# -# generated_cubin_file:STRING=<> File to generate. This argument must be passed -# in if build_cubin is true. - -if(NOT generated_file) - message(FATAL_ERROR "You must specify generated_file on the command line") -endif() - -# Set these up as variables to make reading the generated file easier -set(CMAKE_COMMAND "@CMAKE_COMMAND@") -set(source_file "@source_file@") -set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@") -set(cmake_dependency_file "@cmake_dependency_file@") -set(CUDA_make2cmake "@CUDA_make2cmake@") -set(CUDA_parse_cubin "@CUDA_parse_cubin@") -set(build_cubin @build_cubin@) -# We won't actually use these variables for now, but we need to set this, in -# order to force this file to be run again if it changes. -set(generated_file_path "@generated_file_path@") -set(generated_file_internal "@generated_file@") -set(generated_cubin_file_internal "@generated_cubin_file@") - -set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") -set(CUDA_NVCC_FLAGS "@CUDA_NVCC_FLAGS@;;@CUDA_WRAP_OPTION_NVCC_FLAGS@") -@CUDA_NVCC_FLAGS_CONFIG@ -set(nvcc_flags "@nvcc_flags@") -set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") -set(format_flag "@format_flag@") - -if(build_cubin AND NOT generated_cubin_file) - message(FATAL_ERROR "You must specify generated_cubin_file on the command line") -endif() - -# This is the list of host compilation flags. It C or CXX should already have -# been chosen by FindCUDA.cmake. -@CUDA_HOST_FLAGS@ - -# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler -set(nvcc_host_compiler_flags "") -# If we weren't given a build_configuration, use Debug. -if(NOT build_configuration) - set(build_configuration Debug) -endif() -string(TOUPPER "${build_configuration}" build_configuration) -#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}") -foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}}) - # Extra quotes are added around each flag to help nvcc parse out flags with spaces. - set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"") -endforeach() -if (nvcc_host_compiler_flags) - set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags}) -endif() -#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"") -# Add the build specific configuration flags -list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) - -if(DEFINED CCBIN) - set(CCBIN -ccbin "${CCBIN}") -endif() - -# cuda_execute_process - Executes a command with optional command echo and status message. -# -# status - Status message to print if verbose is true -# command - COMMAND argument from the usual execute_process argument structure -# ARGN - Remaining arguments are the command with arguments -# -# CUDA_result - return value from running the command -# -# Make this a macro instead of a function, so that things like RESULT_VARIABLE -# and other return variables are present after executing the process. -macro(cuda_execute_process status command) - set(_command ${command}) - if(NOT _command STREQUAL "COMMAND") - message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})") - endif() - if(verbose) - execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status}) - # Now we need to build up our command string. We are accounting for quotes - # and spaces, anything else is left up to the user to fix if they want to - # copy and paste a runnable command line. - set(cuda_execute_process_string) - foreach(arg ${ARGN}) - # If there are quotes, excape them, so they come through. - string(REPLACE "\"" "\\\"" arg ${arg}) - # Args with spaces need quotes around them to get them to be parsed as a single argument. - if(arg MATCHES " ") - list(APPEND cuda_execute_process_string "\"${arg}\"") - else() - list(APPEND cuda_execute_process_string ${arg}) - endif() - endforeach() - # Echo the command - execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string}) - endif(verbose) - # Run the command - execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result ) -endmacro() - -# Delete the target file -cuda_execute_process( - "Removing ${generated_file}" - COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}" - ) - -# Generate the dependency file -cuda_execute_process( - "Generating dependency file: ${NVCC_generated_dependency_file}" - COMMAND "${CUDA_NVCC_EXECUTABLE}" - "${source_file}" - ${CUDA_NVCC_FLAGS} - ${nvcc_flags} - ${CCBIN} - ${nvcc_host_compiler_flags} - -DNVCC - -M - -o "${NVCC_generated_dependency_file}" - ${CUDA_NVCC_INCLUDE_ARGS} - ) - -if(CUDA_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Generate the cmake readable dependency file to a temp file. Don't put the -# quotes just around the filenames for the input_file and output_file variables. -# CMake will pass the quotes through and not be able to find the file. -cuda_execute_process( - "Generating temporary cmake readable file: ${cmake_dependency_file}.tmp" - COMMAND "${CMAKE_COMMAND}" - -D "input_file:FILEPATH=${NVCC_generated_dependency_file}" - -D "output_file:FILEPATH=${cmake_dependency_file}.tmp" - -P "${CUDA_make2cmake}" - ) - -if(CUDA_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Copy the file if it is different -cuda_execute_process( - "Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}" - ) - -if(CUDA_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Delete the temporary file -cuda_execute_process( - "Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}" - COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}" - ) - -if(CUDA_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Generate the code -cuda_execute_process( - "Generating ${generated_file}" - COMMAND "${CUDA_NVCC_EXECUTABLE}" - "${source_file}" - ${CUDA_NVCC_FLAGS} - ${nvcc_flags} - ${CCBIN} - ${nvcc_host_compiler_flags} - -DNVCC - ${format_flag} -o "${generated_file}" - ${CUDA_NVCC_INCLUDE_ARGS} - ) - -if(CUDA_result) - # Since nvcc can sometimes leave half done files make sure that we delete the output file. - cuda_execute_process( - "Removing ${generated_file}" - COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}" - ) - message(FATAL_ERROR "Error generating file ${generated_file}") -else() - if(verbose) - message("Generated ${generated_file} successfully.") - endif() -endif() - -# Cubin resource report commands. -if( build_cubin ) - # Run with -cubin to produce resource usage report. - cuda_execute_process( - "Generating ${generated_cubin_file}" - COMMAND "${CUDA_NVCC_EXECUTABLE}" - "${source_file}" - ${CUDA_NVCC_FLAGS} - ${nvcc_flags} - ${CCBIN} - ${nvcc_host_compiler_flags} - -DNVCC - -cubin - -o "${generated_cubin_file}" - ${CUDA_NVCC_INCLUDE_ARGS} - ) - - # Execute the parser script. - cuda_execute_process( - "Executing the parser script" - COMMAND "${CMAKE_COMMAND}" - -D "input_file:STRING=${generated_cubin_file}" - -P "${CUDA_parse_cubin}" - ) - -endif( build_cubin ) diff --git a/Source/Contrib/ComputeBase/CMakeLists.Support.OSGContribComputeBase.txt b/Source/Contrib/ComputeBase/CMakeLists.Support.OSGContribComputeBase.txt index 0b057bcd3..374511d97 100644 --- a/Source/Contrib/ComputeBase/CMakeLists.Support.OSGContribComputeBase.txt +++ b/Source/Contrib/ComputeBase/CMakeLists.Support.OSGContribComputeBase.txt @@ -4,7 +4,6 @@ GET_FILENAME_COMPONENT(_CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) #MESSAGE(STATUS "Prep osgcuda ${_CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_FILE}") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CMAKE_CURRENT_LIST_DIR}/CMake") -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CMAKE_CURRENT_LIST_DIR}/CMake/cuda") IF(OSGNVidiaSDKSrcDir AND NOT OPENCL_INCLUDE_DIR) IF(EXISTS ${OSGNVidiaSDKSrcDir}/OpenCL/common/inc/CL/cl.h) @@ -15,6 +14,10 @@ ENDIF() FIND_PACKAGE(CUDA QUIET) FIND_PACKAGE(OpenCL QUIET) +INCLUDE(CudaHelper) + +OSG_SETUP_CUDA_FLAGS() + SET(CUDA_VERBOSE_BUILD ON) SET(CUDA_BUILD_EMULATION OFF) @@ -22,16 +25,8 @@ SET(OSG_SUPP_CC_BBASE Contrib) IF(CUDA_FOUND) ADD_SUBDIRECTORY("${_CMAKE_CURRENT_LIST_DIR}/Support/NVSdkCommon" ${OSG_SUPP_CC_BBASE}/NVSdkCommon) - ADD_SUBDIRECTORY("${_CMAKE_CURRENT_LIST_DIR}/Support/CudaUtil" ${OSG_SUPP_CC_BBASE}/CudaUtil) ADD_SUBDIRECTORY("${_CMAKE_CURRENT_LIST_DIR}/Support/CudaCommon" ${OSG_SUPP_CC_BBASE}/CudaCommon) -# ADD_SUBDIRECTORY("${_CMAKE_CURRENT_LIST_DIR}/Support/cudpp" ${OSG_SUPP_CC_BBASE}/cudpp) - -# ADD_SUBDIRECTORY("${_CMAKE_CURRENT_LIST_DIR}/Support/NVOCLUtil" ${OSG_SUPP_CC_BBASE}/NVOCLUtil) +# ADD_SUBDIRECTORY("${_CMAKE_CURRENT_LIST_DIR}/Support/CudaUtil" ${OSG_SUPP_CC_BBASE}/CudaUtil) MESSAGE(STATUS "Got cuda version ${CUDA_VERSION}") - - IF(NOT CUDA_VERSION VERSION_GREATER 3.0) - SET(CUDA_BUILD_EMULATION ON) - ADD_SUBDIRECTORY("${_CMAKE_CURRENT_LIST_DIR}/Support/cudppE" ${OSG_SUPP_CC_BBASE}/cudppE) - ENDIF(NOT CUDA_VERSION VERSION_GREATER 3.0) ENDIF(CUDA_FOUND) diff --git a/Source/Contrib/ComputeBase/OSGContribComputeBase.Prepare.cmake b/Source/Contrib/ComputeBase/OSGContribComputeBase.Prepare.cmake index 69c0556dd..1704c0a5c 100644 --- a/Source/Contrib/ComputeBase/OSGContribComputeBase.Prepare.cmake +++ b/Source/Contrib/ComputeBase/OSGContribComputeBase.Prepare.cmake @@ -4,7 +4,6 @@ MESSAGE(STATUS "Prepare OSGComputeBase") GET_FILENAME_COMPONENT(_CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CMAKE_CURRENT_LIST_DIR}/CMake") -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CMAKE_CURRENT_LIST_DIR}/CMake/cuda") IF(CUDA_TOOLKIT_ROOT_DIR) OSG_ADD_OPT(CUDA_TOOLKIT_ROOT_DIR) @@ -20,13 +19,16 @@ ENDIF(CUDA_VERBOSE_BUILD) FIND_PACKAGE(CUDA QUIET) +INCLUDE(CudaHelper) + +OSG_SETUP_CUDA_FLAGS() + INCLUDE(ConfigurePackages.OSGContribComputeBase) OSG_CONFIGURE_NVSDKCOMMON() -OSG_CONFIGURE_NVOCLUTILS() +#OSG_CONFIGURE_NVOCLUTILS() OSG_CONFIGURE_CUDACOMMON() -OSG_CONFIGURE_CUDAUTIL() -OSG_CONFIGURE_CUDPP() +#OSG_CONFIGURE_CUDAUTIL() OSG_CONFIGURE_CUDAPARTSDK() MESSAGE(STATUS "NV Status: NV:${OSG_WITH_NVSDKCOMMON}") @@ -51,18 +53,3 @@ INSTALL(FILES "${_CMAKE_CURRENT_LIST_DIR}/CMake/OSGContribComputeBase.SetupHelpe DESTINATION share/OpenSG/cmake COMPONENT development_configuration) -INSTALL(FILES "${_CMAKE_CURRENT_LIST_DIR}/CMake/cuda/FindCUDA.cmake" - DESTINATION share/OpenSG/cmake - COMPONENT development_configuration) - -INSTALL(FILES "${_CMAKE_CURRENT_LIST_DIR}/CMake/cuda/FindCUDA/make2cmake.cmake" - DESTINATION share/OpenSG/cmake/FindCUDA - COMPONENT development_configuration) - -INSTALL(FILES "${_CMAKE_CURRENT_LIST_DIR}/CMake/cuda/FindCUDA/parse_cubin.cmake" - DESTINATION share/OpenSG/cmake/FindCUDA - COMPONENT development_configuration) - -INSTALL(FILES "${_CMAKE_CURRENT_LIST_DIR}/CMake/cuda/FindCUDA/run_nvcc.cmake" - DESTINATION share/OpenSG/cmake/FindCUDA - COMPONENT development_configuration) diff --git a/Source/Contrib/ComputeBase/Support/CudaCommon/CMakeLists.txt b/Source/Contrib/ComputeBase/Support/CudaCommon/CMakeLists.txt index 3b68edf5c..0ffbe8788 100644 --- a/Source/Contrib/ComputeBase/Support/CudaCommon/CMakeLists.txt +++ b/Source/Contrib/ComputeBase/Support/CudaCommon/CMakeLists.txt @@ -17,11 +17,11 @@ IF(OSGNVidiaSDKSrcDir) SET(${PROJECT_NAME}StaticTarget osgcudacommon) ENDIF(WIN32) - SET(OSG_CUDACOMMON_SRC_INPUT param.cpp - paramgl.cpp) +# SET(OSG_CUDACOMMON_SRC_INPUT param.cpp +# paramgl.cpp) - SET(OSG_CUDACOMMON_HDR_INPUT param.h - paramgl.h) + SET(OSG_CUDACOMMON_HDR_INPUT helper_cuda.h + helper_cuda_gl.h) SetupFiles(OSG_CUDACOMMON_SRC_INPUT OSG_CUDACOMMON_SRCS @@ -30,35 +30,29 @@ IF(OSGNVidiaSDKSrcDir) SetupFiles(OSG_CUDACOMMON_HDR_INPUT OSG_CUDACOMMON_HDR - "${OSGNVidiaSDKSrcDir}/C/common/inc" + "${OSGNVidiaSDKSrcDir}/common/inc" "${OSG_SUPP_CC_BBASE}/CudaCommon/src") IF(NOT WIN32) IF(NOT EXISTS ${_OSGSUPP_DST_DIR}/GL/glew.h) FILE(MAKE_DIRECTORY ${_OSGSUPP_DST_DIR}/GL) - FILE(WRITE ${_OSGSUPP_DST_DIR}/GL/glew.h "/* dummy on unix */\n") + FILE(WRITE ${_OSGSUPP_DST_DIR}/GL/glew.h "/* dummy on unix */\n#include ") ENDIF(NOT EXISTS ${_OSGSUPP_DST_DIR}/GL/glew.h) ENDIF(NOT WIN32) - INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/CudaCommon/src") - INCLUDE_DIRECTORIES("${CUDA_TOOLKIT_INCLUDE}") - INCLUDE_DIRECTORIES("${OSG_CUDA_UTIL_INCLUDEDIR}") + IF(WIN32) - INCLUDE_DIRECTORIES("${OSG_GLUT_INCLUDE_DIR}") - INCLUDE_DIRECTORIES("${OSG_GLEW_INCLUDE_DIR}") +# INCLUDE_DIRECTORIES("${OSG_GLUT_INCLUDE_DIR}") +# INCLUDE_DIRECTORIES("${OSG_GLEW_INCLUDE_DIR}") ENDIF(WIN32) - IF(UNIX) - SET(OSGCUDACOMLIB_DEF GL_GLEXT_PROTOTYPES=1) - ENDIF(UNIX) - IF(BUILD_STATIC_LIBS) ## device lib - ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_CUDACOMMON_SRCS}) +# ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_CUDACOMMON_SRCS}) - ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}StaticTarget}) +# ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}StaticTarget}) IF(WIN32) SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES @@ -67,8 +61,8 @@ IF(OSGNVidiaSDKSrcDir) SET(OSGCUDACOMLIB_DEF_STATIC ${OSGCUDACOMLIB_DEF}) - SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES - COMPILE_DEFINITIONS "${OSGCUDACOMLIB_DEF_STATIC}") +# SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES +# COMPILE_DEFINITIONS "${OSGCUDACOMLIB_DEF_STATIC}") IF(WIN32) @@ -78,10 +72,10 @@ IF(OSGNVidiaSDKSrcDir) LIBRARY DESTINATION lib COMPONENT libraries ARCHIVE DESTINATION lib COMPONENT libraries ) ELSE(WIN32) - INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget} - RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries - LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries - ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries) +# INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget} +# RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries +# LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries +# ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries) ENDIF(WIN32) ENDIF(BUILD_STATIC_LIBS) diff --git a/Source/Contrib/ComputeBase/Support/NVSdkCommon/CMakeLists.txt b/Source/Contrib/ComputeBase/Support/NVSdkCommon/CMakeLists.txt index 92dc12dc7..f86613399 100644 --- a/Source/Contrib/ComputeBase/Support/NVSdkCommon/CMakeLists.txt +++ b/Source/Contrib/ComputeBase/Support/NVSdkCommon/CMakeLists.txt @@ -40,20 +40,24 @@ IF(OSGNVidiaSDKSrcDir) ELSE() MESSAGE(STATUS "Without OpenCL SDK") - SET(OSG_NVSDKCOMMON_SRC_INPUT rendercheck_gl.cpp - cmd_arg_reader.cpp) +# SET(OSG_NVSDKCOMMON_SRC_INPUT rendercheck_gl.cpp +# cmd_arg_reader.cpp) - SET(OSG_NVSDKCOMMON_HDR_INPUT rendercheck_gl.h - exception.h - cmd_arg_reader.h - nvShaderUtils.h) + SET(OSG_NVSDKCOMMON_HDR_INPUT exception.h + helper_functions.h + helper_image.h + helper_math.h + helper_string.h + helper_timer.h + param.h + paramgl.h) - SET(OSG_NVSDKCOMMON_LNK_HDR ${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/NVSdkCommon/src/rendercheckGL.h) +# SET(OSG_NVSDKCOMMON_LNK_HDR ${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/NVSdkCommon/src/rendercheckGL.h) - SET(OSG_NVSDKCOMMON_SUBDIR C/common) + SET(OSG_NVSDKCOMMON_SUBDIR common) - CopyOrLink(${OSGNVidiaSDKSrcDir}/${OSG_NVSDKCOMMON_SUBDIR}/inc/rendercheck_gl.h - ${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/NVSdkCommon/src/rendercheckGL.h) +# CopyOrLink(${OSGNVidiaSDKSrcDir}/${OSG_NVSDKCOMMON_SUBDIR}/inc/rendercheck_gl.h +# ${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/NVSdkCommon/src/rendercheckGL.h) ENDIF() @@ -72,27 +76,21 @@ IF(OSGNVidiaSDKSrcDir) IF(NOT WIN32) IF(NOT EXISTS ${_OSGSUPP_DST_DIR}/GL/glew.h) FILE(MAKE_DIRECTORY ${_OSGSUPP_DST_DIR}/GL) - FILE(WRITE ${_OSGSUPP_DST_DIR}/GL/glew.h "/* dummy on unix */\n") + FILE(WRITE ${_OSGSUPP_DST_DIR}/GL/glew.h "/* dummy on unix */\n#include ") ENDIF(NOT EXISTS ${_OSGSUPP_DST_DIR}/GL/glew.h) ENDIF(NOT WIN32) INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/NVSdkCommon/src") -## INCLUDE_DIRECTORIES("${CUDA_TOOLKIT_INCLUDE}") -## INCLUDE_DIRECTORIES("${OSG_CUDA_UTIL_INCLUDEDIR}") IF(WIN32) # INCLUDE_DIRECTORIES("${OSG_GLUT_INCLUDE_DIR}") # INCLUDE_DIRECTORIES("${OSG_GLEW_INCLUDE_DIR}") ENDIF(WIN32) - IF(UNIX) - SET(OSGNVSDKCOMLIB_DEF GL_GLEXT_PROTOTYPES=1) - ENDIF(UNIX) +# ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_NVSDKCOMMON_SRCS}) - ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_NVSDKCOMMON_SRCS}) - - ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}StaticTarget}) +# ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}StaticTarget}) IF(WIN32) SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES @@ -101,8 +99,8 @@ IF(OSGNVidiaSDKSrcDir) SET(OSGNVSDKCOMLIB_DEF_STATIC ${OSGNVSDKCOMLIB_DEF}) - SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES - COMPILE_DEFINITIONS "${OSGNVSDKCOMLIB_DEF_STATIC}") +# SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES +# COMPILE_DEFINITIONS "${OSGNVSDKCOMLIB_DEF_STATIC}") IF(WIN32) @@ -112,10 +110,10 @@ IF(OSGNVidiaSDKSrcDir) LIBRARY DESTINATION lib COMPONENT libraries ARCHIVE DESTINATION lib COMPONENT libraries) ELSE(WIN32) - INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget} - RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries - LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries - ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries) +# INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget} +# RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries +# LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries +# ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT static_libraries) ENDIF(WIN32) diff --git a/Source/Contrib/ComputeBase/Support/cudpp/CMakeLists.txt b/Source/Contrib/ComputeBase/Support/cudpp/CMakeLists.txt deleted file mode 100644 index dbf282503..000000000 --- a/Source/Contrib/ComputeBase/Support/cudpp/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) - -INCLUDE(OSGContribComputeBase.SetupHelper) - -IF(OSGNVidiaCudPPSrcDir) - - IF(NOT OSG_CUDA_UTIL_BUILD) - MESSAGE(STATUS "cudcpp needs CudaUtil") - RETURN() - ENDIF(NOT OSG_CUDA_UTIL_BUILD) - - MESSAGE(STATUS "add cudpp") - - - PROJECT(OSGCudPP) - - SET(${PROJECT_NAME}SharedTarget osgcudpp) - - IF(WIN32) - SET(${PROJECT_NAME}StaticTarget libosgcudpp) - ELSE(WIN32) - SET(${PROJECT_NAME}StaticTarget osgcudpplib) - ENDIF(WIN32) - - SET(${PROJECT_NAME}_EXTRA_DEF ) - - INCLUDE(../cudpp/CudPPCommon.cmake) - - SET(OSG_CUDPP_BUILD TRUE CACHE INTERNAL "" FORCE) - SET(OSG_CUDPP_INCLUDEDIR "${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/cudpp/src" CACHE PATH "") - -ELSE(OSGNVidiaCudPPSrcDir) - SET(OSGNVidiaCudPPSrcDir "" CACHE PATH "") -ENDIF(OSGNVidiaCudPPSrcDir) diff --git a/Source/Contrib/ComputeBase/Support/cudpp/CudPPCommon.cmake b/Source/Contrib/ComputeBase/Support/cudpp/CudPPCommon.cmake deleted file mode 100644 index 3dbcfbe53..000000000 --- a/Source/Contrib/ComputeBase/Support/cudpp/CudPPCommon.cmake +++ /dev/null @@ -1,150 +0,0 @@ - SET(OSG_CUDPP_SRC_INPUT cudpp.cpp - cudpp_plan.cpp - cudpp_plan_manager.cpp - cudpp_maximal_launch.cpp) - - SET(OSG_CUDPP_APP_SRC_INPUT compact_app.cu - radixsort_app.cu - rand_app.cu - scan_app.cu - segmented_scan_app.cu - spmvmult_app.cu) - - SET(OSG_CUDPP_KERNEL_SRC_INPUT spmvmult_kernel.cu - compact_kernel.cu - radixsort_kernel.cu - rand_kernel.cu - scan_kernel.cu - vector_kernel.cu - segmented_scan_kernel.cu) - - SET(OSG_CUDPP_CTA_SRC_INPUT rand_cta.cu - radixsort_cta.cu - scan_cta.cu - segmented_scan_cta.cu) - - SET(OSG_CUDPP_HDR_INPUT cudpp.h) - - SET(OSG_CUDPP_INTERNAL_HDR_INPUT cudpp_plan_manager.h - cudpp_scan.h - cudpp_segscan.h - cudpp_compact.h - cudpp_spmvmult.h - cudpp_radixsort.h - cudpp_rand.h - cudpp_globals.h - cudpp_plan.h - cudpp_maximal_launch.h - cudpp_util.h - sharedmem.h) - - SetupFiles(OSG_CUDPP_SRC_INPUT - OSG_CUDPP_SRCS - "${OSGNVidiaCudPPSrcDir}/cudpp/src" - "${OSG_SUPP_CC_BBASE}/cudpp/src") - - SetupFiles(OSG_CUDPP_APP_SRC_INPUT - OSG_CUDPP_SRCS - "${OSGNVidiaCudPPSrcDir}/cudpp/src/app" - "${OSG_SUPP_CC_BBASE}/cudpp/src/app") - - SetupFiles(OSG_CUDPP_KERNEL_SRC_INPUT - OSG_CUDPP_KERNEL_SRCS - "${OSGNVidiaCudPPSrcDir}/cudpp/src/kernel" - "${OSG_SUPP_CC_BBASE}/cudpp/src/kernel") - - SetupFiles(OSG_CUDPP_CTA_SRC_INPUT - OSG_CUDPP_KERNEL_SRCS - "${OSGNVidiaCudPPSrcDir}/cudpp/src/cta" - "${OSG_SUPP_CC_BBASE}/cudpp/src/cta") - - SetupFiles(OSG_CUDPP_INTERNAL_HDR_INPUT - OSG_CUDPP_INTERNAL_HDR - "${OSGNVidiaCudPPSrcDir}/cudpp/src" - "${OSG_SUPP_CC_BBASE}/cudpp/src") - - SetupFiles(OSG_CUDPP_HDR_INPUT - OSG_CUDPP_HDR - "${OSGNVidiaCudPPSrcDir}/cudpp/include" - "${OSG_SUPP_CC_BBASE}/cudpp/src/cudpp") - - INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/cudpp/src") - INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/cudpp/src/cudpp") - INCLUDE_DIRECTORIES("${CUDA_TOOLKIT_INCLUDE}") - INCLUDE_DIRECTORIES(${OSG_CUDA_UTIL_INCLUDEDIR}) - - IF(UNIX) - SET(OSGCUDPPLIB_DEF GL_GLEXT_PROTOTYPES=1) - ENDIF(UNIX) - - IF(NOT WIN32) - SET(_OSG_INSTALL_CONFIGS ${CMAKE_BUILD_TYPE}) - ELSE() - SET(_OSG_INSTALL_CONFIGS Debug;Release) - ENDIF() - - IF(BUILD_SHARED_LIBS) - CUDA_ADD_LIBRARY(${${PROJECT_NAME}SharedTarget} SHARED ${OSG_CUDPP_SRCS}) - - ADD_DEPENDENCIES(ALL_CUDA_BUILD ${${PROJECT_NAME}SharedTarget}) - - IF(WIN32) - SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES - DEBUG_POSTFIX "D") - ENDIF(WIN32) - - SET(OSGCUDPPLIB_DEF_SHARED ${OSGCUDPPLIB_DEF};BUILD_DLL;${${PROJECT_NAME}_EXTRA_DEF}) - - SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES - COMPILE_DEFINITIONS "${OSGCUDPPLIB_DEF_SHARED}") - - IF(WIN32) - INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget} - CONFIGURATIONS ${_OSG_INSTALL_CONFIGS} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - ELSE(WIN32) - INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget} - RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} - LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} - ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX}) - ENDIF(WIN32) - - ENDIF(BUILD_SHARED_LIBS) - - IF(BUILD_STATIC_LIBS) - CUDA_ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_CUDPP_SRCS}) - - ADD_DEPENDENCIES(ALL_CUDA_BUILD ${${PROJECT_NAME}StaticTarget}) - - IF(WIN32) - SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES - DEBUG_POSTFIX "D") - ENDIF(WIN32) - - SET(OSGCUDPPLIB_DEF_STATIC ${OSGCUDPPLIB_DEF};CUDPP_STATIC_LIB;${${PROJECT_NAME}_EXTRA_DEF}) - - SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES - COMPILE_DEFINITIONS "${OSGCUDPPLIB_DEF_STATIC}") - - IF(WIN32) - INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget} - CONFIGURATIONS ${_OSG_INSTALL_CONFIGS} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - ELSE(WIN32) - INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget} - RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} - LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} - ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX}) - ENDIF(WIN32) - - ENDIF(BUILD_STATIC_LIBS) - - INSTALL(FILES ${OSG_CUDPP_HDR} - DESTINATION include/cuda/cudpp - PERMISSIONS OWNER_WRITE OWNER_READ - GROUP_READ - WORLD_READ) diff --git a/Source/Contrib/ComputeBase/Support/cudppE/CMakeLists.txt b/Source/Contrib/ComputeBase/Support/cudppE/CMakeLists.txt deleted file mode 100644 index 9d21e1c14..000000000 --- a/Source/Contrib/ComputeBase/Support/cudppE/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) - -INCLUDE(OSGContribComputeBase.SetupHelper) - -IF(OSGNVidiaCudPPSrcDir) - - IF(NOT OSG_CUDA_UTIL_BUILD) - MESSAGE(STATUS "cudcppE needs CudaUtil") - RETURN() - ENDIF(NOT OSG_CUDA_UTIL_BUILD) - - MESSAGE(STATUS "add cudppE") - - - PROJECT(OSGCudPPE) - - SET(${PROJECT_NAME}SharedTarget osgcudppE) - - IF(WIN32) - SET(${PROJECT_NAME}StaticTarget libosgcudppE) - ELSE(WIN32) - SET(${PROJECT_NAME}StaticTarget osgcudpplibE) - ENDIF(WIN32) - - SET(${PROJECT_NAME}_EXTRA_DEF __DEVICE_EMULATION__) - - INCLUDE(../cudpp/CudPPCommon.cmake) - -ELSE(OSGNVidiaCudPPSrcDir) - SET(OSGNVidiaCudPPSrcDir "" CACHE PATH "") -ENDIF(OSGNVidiaCudPPSrcDir) diff --git a/Source/System/Action/RenderAction/OSGRenderPartition.cpp b/Source/System/Action/RenderAction/OSGRenderPartition.cpp index a676caeab..4254b5969 100644 --- a/Source/System/Action/RenderAction/OSGRenderPartition.cpp +++ b/Source/System/Action/RenderAction/OSGRenderPartition.cpp @@ -1341,7 +1341,7 @@ void RenderPartition::dump(UInt32 uiIndent) fprintf(stderr, "RenderParition %p | %d\n", this, Int32(_ubState)); for(UInt32 i = 0; i < uiIndent; ++i) { fprintf(stderr, " "); } - fprintf(stderr, "with %"PRISize" groups\n", _vGroupStore.size()); + fprintf(stderr, "with %" PRISize " groups\n", _vGroupStore.size()); GroupStore::iterator gIt = _vGroupStore.begin(); GroupStore::iterator gEnd = _vGroupStore.end (); diff --git a/Source/System/Cluster/Server/OSGClusterServer.cpp b/Source/System/Cluster/Server/OSGClusterServer.cpp index 3c6a6c75b..4f842f460 100644 --- a/Source/System/Cluster/Server/OSGClusterServer.cpp +++ b/Source/System/Cluster/Server/OSGClusterServer.cpp @@ -430,7 +430,7 @@ bool ClusterServer::windowChanged(FieldContainer * const fcp, if(_window != NULL) { - fprintf(stderr, "%p %"PRISize" %td\n", + fprintf(stderr, "%p %" PRISize " %td\n", &(*_window), window->getMFServers()->size(), sIt - window->getMFServers()->begin()); diff --git a/Source/System/Cluster/Window/BalancedMultiWindow/OSGBalancedMultiWindow.cpp b/Source/System/Cluster/Window/BalancedMultiWindow/OSGBalancedMultiWindow.cpp index a0cecd45e..b8198def9 100644 --- a/Source/System/Cluster/Window/BalancedMultiWindow/OSGBalancedMultiWindow.cpp +++ b/Source/System/Cluster/Window/BalancedMultiWindow/OSGBalancedMultiWindow.cpp @@ -469,7 +469,7 @@ void BalancedMultiWindow::clientRender(RenderActionBase *action) } conn->resetSelection(); frameTime += getSystemTime(); - printf("Cli %4"PRISize" L:%2.6lf T:%10d D:%2.6lf P:%2.6lf N:%2.6lf B:%2.6lf F:%2.6lf\n", + printf("Cli %4" PRISize " L:%2.6lf T:%10d D:%2.6lf P:%2.6lf N:%2.6lf B:%2.6lf F:%2.6lf\n", getMFServers()->size(), _loadTime, _triCount, diff --git a/Source/System/Depreciated/State/OSGTextureChunk.cpp b/Source/System/Depreciated/State/OSGTextureChunk.cpp index 02bb18150..df08fb044 100644 --- a/Source/System/Depreciated/State/OSGTextureChunk.cpp +++ b/Source/System/Depreciated/State/OSGTextureChunk.cpp @@ -372,7 +372,7 @@ void TextureChunk::handleTextureShader(Window *win, GLenum bindtarget) else if(getMFShaderOffsetMatrix()->size() != 0) { FWARNING(("TextureChunk::handleTextureShader: shaderOffsetMatrix has" - " to have 4 entries, not %"PRIUSize"!\n", + " to have 4 entries, not %" PRIUSize "!\n", getMFShaderOffsetMatrix()->size() )); } diff --git a/Source/System/Dynamics/VRMLAnimation/OSGVRMLCoordinateInterpolator.cpp b/Source/System/Dynamics/VRMLAnimation/OSGVRMLCoordinateInterpolator.cpp index 267dbe2f9..c3868b299 100644 --- a/Source/System/Dynamics/VRMLAnimation/OSGVRMLCoordinateInterpolator.cpp +++ b/Source/System/Dynamics/VRMLAnimation/OSGVRMLCoordinateInterpolator.cpp @@ -132,7 +132,7 @@ void VRMLCoordinateInterpolator::changed(ConstFieldMaskArg whichField, else { fprintf(stderr, - "interpol resort : sizes don't match %"PRISize" | %d\n", + "interpol resort : sizes don't match %" PRISize " | %d\n", uiNumRes, _mfResortIndex.size32()); } } diff --git a/Source/System/Dynamics/VRMLAnimation/OSGVRMLNormalInterpolator.cpp b/Source/System/Dynamics/VRMLAnimation/OSGVRMLNormalInterpolator.cpp index dc092f5fa..5cb92a759 100644 --- a/Source/System/Dynamics/VRMLAnimation/OSGVRMLNormalInterpolator.cpp +++ b/Source/System/Dynamics/VRMLAnimation/OSGVRMLNormalInterpolator.cpp @@ -132,7 +132,7 @@ void VRMLNormalInterpolator::changed(ConstFieldMaskArg whichField, else { fprintf(stderr, - "interpol resort : sizes don't match %"PRISize" | %d\n", + "interpol resort : sizes don't match %" PRISize " | %d\n", uiNumRes, _mfResortIndex.size32()); } } diff --git a/Source/System/Dynamics/VRMLAnimation/OSGVRMLOrientationInterpolator.cpp b/Source/System/Dynamics/VRMLAnimation/OSGVRMLOrientationInterpolator.cpp index 110873125..0eb982233 100644 --- a/Source/System/Dynamics/VRMLAnimation/OSGVRMLOrientationInterpolator.cpp +++ b/Source/System/Dynamics/VRMLAnimation/OSGVRMLOrientationInterpolator.cpp @@ -132,7 +132,7 @@ void VRMLOrientationInterpolator::changed(ConstFieldMaskArg whichField, else { fprintf(stderr, - "interpol resort : sizes don't match %"PRISize" | %d\n", + "interpol resort : sizes don't match %" PRISize " | %d\n", uiNumRes, _mfResortIndex.size32()); } } diff --git a/Source/System/Dynamics/VRMLAnimation/OSGVRMLPositionInterpolator.cpp b/Source/System/Dynamics/VRMLAnimation/OSGVRMLPositionInterpolator.cpp index b88946b72..9fb9964d3 100644 --- a/Source/System/Dynamics/VRMLAnimation/OSGVRMLPositionInterpolator.cpp +++ b/Source/System/Dynamics/VRMLAnimation/OSGVRMLPositionInterpolator.cpp @@ -132,7 +132,7 @@ void VRMLPositionInterpolator::changed(ConstFieldMaskArg whichField, else { fprintf(stderr, - "interpol resort : sizes don't match %"PRISize" | %d\n", + "interpol resort : sizes don't match %" PRISize " | %d\n", uiNumRes, _mfResortIndex.size32()); } } diff --git a/Source/System/Dynamics/VRMLAnimation/OSGVRMLScalarInterpolator.cpp b/Source/System/Dynamics/VRMLAnimation/OSGVRMLScalarInterpolator.cpp index fe98c347c..690b5f695 100644 --- a/Source/System/Dynamics/VRMLAnimation/OSGVRMLScalarInterpolator.cpp +++ b/Source/System/Dynamics/VRMLAnimation/OSGVRMLScalarInterpolator.cpp @@ -132,7 +132,7 @@ void VRMLScalarInterpolator::changed(ConstFieldMaskArg whichField, else { fprintf(stderr, - "interpol resort : sizes don't match %"PRISize" | %d\n", + "interpol resort : sizes don't match %" PRISize " | %d\n", uiNumRes, _mfResortIndex.size32()); } } diff --git a/Source/System/FileIO/Collada/OSGColladaController.cpp b/Source/System/FileIO/Collada/OSGColladaController.cpp index eccabd2e5..0b5783d92 100644 --- a/Source/System/FileIO/Collada/OSGColladaController.cpp +++ b/Source/System/FileIO/Collada/OSGColladaController.cpp @@ -369,8 +369,8 @@ ColladaController::readSkin(domSkin *skin) } OSG_COLLADA_LOG(("ColladaController::readSkin: " - "jIndexProp.size() [%"PRIUSize"] " - "jWeightProp.size() [%"PRIUSize"]\n", + "jIndexProp.size() [%" PRIUSize "] " + "jWeightProp.size() [%" PRIUSize "]\n", jIndexProp->size(), jWeightProp->size())); diff --git a/Source/System/FileIO/Collada/OSGColladaGeometry.cpp b/Source/System/FileIO/Collada/OSGColladaGeometry.cpp index acaee3693..75f38e983 100644 --- a/Source/System/FileIO/Collada/OSGColladaGeometry.cpp +++ b/Source/System/FileIO/Collada/OSGColladaGeometry.cpp @@ -461,7 +461,7 @@ ColladaGeometry::readLineStrips(domMesh *mesh, domLinestrips *lineStrips) } OSG_COLLADA_LOG(("ColladaGeometry::readLineStrips: material symbol [%s] " - "vertices [%d] strips [%"PRIUSize"]\n", + "vertices [%d] strips [%" PRIUSize "]\n", (lineStrips->getMaterial() != NULL ? lineStrips->getMaterial() : ""), verts, @@ -570,7 +570,7 @@ ColladaGeometry::readPolygons(domMesh *mesh, domPolygons *polygons) } OSG_COLLADA_LOG(("ColladaGeometry::readPolygons: material symbol [%s] " - "vertices [%d] polygons [%"PRIUSize"]\n", + "vertices [%d] polygons [%" PRIUSize "]\n", (polygons->getMaterial() != NULL ? polygons->getMaterial() : ""), verts, _geoStore[geoIdx]._lengths->size())); @@ -815,7 +815,7 @@ ColladaGeometry::readTriFans(domMesh *mesh, domTrifans *triFans) } OSG_COLLADA_LOG(("ColladaGeometry::readTriFans: material symbol [%s] " - "vertices [%d] fans [%"PRIUSize"]\n", + "vertices [%d] fans [%" PRIUSize "]\n", (triFans->getMaterial() != NULL ? triFans->getMaterial() : ""), verts, @@ -882,7 +882,7 @@ ColladaGeometry::readTriStrips(domMesh *mesh, domTristrips *triStrips) } OSG_COLLADA_LOG(("ColladaGeometry::readTriStrips: material symbol [%s] " - "vertices [%d] strips [%"PRIUSize"]\n", + "vertices [%d] strips [%" PRIUSize "]\n", (triStrips->getMaterial() != NULL ? triStrips->getMaterial() : ""), verts, diff --git a/Source/System/FileIO/OBJ/OSGOBJSceneFileType.cpp b/Source/System/FileIO/OBJ/OSGOBJSceneFileType.cpp index 1f87d0f6c..7f896528e 100644 --- a/Source/System/FileIO/OBJ/OSGOBJSceneFileType.cpp +++ b/Source/System/FileIO/OBJ/OSGOBJSceneFileType.cpp @@ -146,6 +146,7 @@ NodeTransitPtr OBJSceneFileType::read( std::istream &is, GeoIntegralPropertyUnrecPtr lensPtr; GeoIntegralPropertyUnrecPtr typePtr; DataElem dataElem; + DataElem lastDataElem; Char8 strBuf[8192], *token, *nextToken; Int32 strBufSize = sizeof(strBuf)/sizeof(Char8); Int32 index, posIndex = 0, indexType; @@ -267,12 +268,20 @@ NodeTransitPtr OBJSceneFileType::read( std::istream &is, token = nextToken; } break; + case UNKNOWN_DE: default: - FWARNING (( "Unkown obj data elem: %s\n", elem.c_str())); + // don't warn about 3rd tex coord + if(lastDataElem != VERTEX_TEXTURECOORD_DE) + { + FWARNING (( "Unkown obj data elem: %s\n", + elem.c_str())); + } is.ignore(INT_MAX, '\n'); break; } + + lastDataElem = dataElem; } } diff --git a/Source/System/FileIO/OSB/OSGOSBRootElement.cpp b/Source/System/FileIO/OSB/OSGOSBRootElement.cpp index e1b998eda..4cb8eb5a2 100644 --- a/Source/System/FileIO/OSB/OSGOSBRootElement.cpp +++ b/Source/System/FileIO/OSB/OSGOSBRootElement.cpp @@ -179,7 +179,7 @@ OSBRootElement::read(const std::string &/*typeName*/) headerName.c_str())); OSG_OSB_LOG(("OSBRootElement::read: headerOptions: [%s]\n", headerOptions.c_str())); - OSG_OSB_LOG(("OSBRootElement::read: fileSize: [%"PRISize"]\n", + OSG_OSB_LOG(("OSBRootElement::read: fileSize: [%" PRISize "]\n", fileSize)); std::string fcTypeName; diff --git a/Source/System/FileIO/OpenFlight/OSGOFPrimaryRecords.cpp b/Source/System/FileIO/OpenFlight/OSGOFPrimaryRecords.cpp index d03fe5f15..b76e67454 100644 --- a/Source/System/FileIO/OpenFlight/OSGOFPrimaryRecords.cpp +++ b/Source/System/FileIO/OpenFlight/OSGOFPrimaryRecords.cpp @@ -697,7 +697,7 @@ NodeTransitPtr OFObjectRecord::convertFaceGroup( { FWARNING(("OFObjectRecord::convertFaceGroup: " "Found different vtypes - first [0x%x] " - "current [0x%x] face [%u/%"PRIUSize"] " + "current [0x%x] face [%u/%" PRIUSize "] " "vert [%u]\n", uiFirstVType, uiVType, i, vFaceGroup.size(), j)); diff --git a/Source/System/GraphOp/OSGGeometryMergeGraphOp.cpp b/Source/System/GraphOp/OSGGeometryMergeGraphOp.cpp index 42c78b3d6..fee19526d 100644 --- a/Source/System/GraphOp/OSGGeometryMergeGraphOp.cpp +++ b/Source/System/GraphOp/OSGGeometryMergeGraphOp.cpp @@ -219,7 +219,7 @@ Action::ResultE GeometryMergeGraphOp::traverseLeave( if(mlIt->size() <= 1) continue; - FINFO(("GeometryMergeGraphOp::traverseLeave: Merging [%"PRISize"] " + FINFO(("GeometryMergeGraphOp::traverseLeave: Merging [%" PRISize "] " "Geometries.\n", mlIt->size())); GeometryUnrecPtr geo1; diff --git a/Source/System/GraphOp/OSGVerifyGeoGraphOp.cpp b/Source/System/GraphOp/OSGVerifyGeoGraphOp.cpp index fabc817e8..7f53e2ba7 100644 --- a/Source/System/GraphOp/OSGVerifyGeoGraphOp.cpp +++ b/Source/System/GraphOp/OSGVerifyGeoGraphOp.cpp @@ -163,7 +163,7 @@ bool VerifyGeoGraphOp::travNodeEnter(Node *node) if(geo->getTypes()->size() != geo->getLengths()->size()) { FINFO(("VerifyGeoGraphOp::travNodeEnter: Types and lengths have " - "different sizes [%"PRISize"] vs [%"PRISize"]", + "different sizes [%" PRISize "] vs [%" PRISize "]", geo->getTypes()->size(), geo->getLengths()->size())); ++_errorCount; return false; diff --git a/Source/System/Image/FileIO/OSGDBImageFileType.cpp b/Source/System/Image/FileIO/OSGDBImageFileType.cpp index 0a0ca37cb..6367dbdd8 100644 --- a/Source/System/Image/FileIO/OSGDBImageFileType.cpp +++ b/Source/System/Image/FileIO/OSGDBImageFileType.cpp @@ -859,7 +859,7 @@ bool DBImageFileType::read( Image *pImage, } else { - fprintf(stderr, "size mismatch %"PRISize" %d\n", + fprintf(stderr, "size mismatch %" PRISize " %d\n", pImage->getSize(), oHeader.uiBytes); diff --git a/Source/System/Image/FileIO/OSGITFImageFileType.cpp b/Source/System/Image/FileIO/OSGITFImageFileType.cpp index 6b7dfa7f6..e84361b26 100644 --- a/Source/System/Image/FileIO/OSGITFImageFileType.cpp +++ b/Source/System/Image/FileIO/OSGITFImageFileType.cpp @@ -157,7 +157,7 @@ void TiledImageBlockAccessor::open(const Char8 *szFilename) if(_vImages.size() != _uiRows * _uiColumns || _vImages.size() == 0) { - fprintf(stderr, "Images missing %"PRISize" %d\n", + fprintf(stderr, "Images missing %" PRISize " %d\n", _vImages.size(), _uiRows * _uiColumns); diff --git a/Source/System/Image/OSGImageFunctions.cpp b/Source/System/Image/OSGImageFunctions.cpp index 8ffaca17b..ccc0b652b 100644 --- a/Source/System/Image/OSGImageFunctions.cpp +++ b/Source/System/Image/OSGImageFunctions.cpp @@ -265,7 +265,8 @@ bool createNormalVolume ( Image *inImage, pf = Image::OSG_RGBA_PF; break; default: - FFATAL(( "Invalid outputFormat length in createNormalVolume: %"PRISize"\n", + FFATAL(( "Invalid outputFormat length in createNormalVolume: %" + PRISize "\n", outputFormat.size() )); return false; } @@ -295,7 +296,7 @@ bool createNormalVolume ( Image *inImage, calcThetaPhi = true; break; } - FDEBUG (( "dataIndex[%"PRISize"]: %d\n", i, dataIndex[i] )); + FDEBUG (( "dataIndex[%" PRISize "]: %d\n", i, dataIndex[i] )); } else { FFATAL (( "Invalid outputFormat element %c, valid: %s\n", @@ -870,7 +871,8 @@ bool createNormalizationCubeMap(std::vector imageVec, if (imageVec.size() < 6) { - FFATAL(("Only %"PRISize" images given - need six\n", imageVec.size())); + FFATAL(("Only %" PRISize " images given - need six\n", + imageVec.size())); return false; } diff --git a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h index 5d6acca46..843ed41ad 100644 --- a/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h +++ b/Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h @@ -168,7 +168,8 @@ class TypedGeoVectorProperty : public GeoVectorProperty template ExternalType getValue(const SizeT index) const { - FDEBUG(("TypedGeoVectorProperty<>::getValue<>(%"PRIUSize")\n", index)); + FDEBUG(("TypedGeoVectorProperty<>::getValue<>(%" PRIUSize ")\n", + index)); ExternalType val; @@ -198,7 +199,7 @@ class TypedGeoVectorProperty : public GeoVectorProperty template void getValue(ExternalType &eval, const SizeT index) const { - FDEBUG(("TypedGeoVectorProperty<>::getValue<>(eval, %"PRIUSize")\n", index)); + FDEBUG(("TypedGeoVectorProperty<>::getValue<>(eval, %" PRIUSize ")\n", index)); if(GeoPropertyDesc::normalize) { @@ -230,7 +231,7 @@ class TypedGeoVectorProperty : public GeoVectorProperty template void setValue (ExternalType val, const SizeT index) { - FDEBUG(("TypedGeoVectorProperty<>::setValue<>(val, %"PRIUSize")\n", index)); + FDEBUG(("TypedGeoVectorProperty<>::setValue<>(val, %" PRIUSize ")\n", index)); StoredType ival; diff --git a/Source/System/NodeCores/Drawables/Geometry/Util/OSGGeoFunctions.cpp b/Source/System/NodeCores/Drawables/Geometry/Util/OSGGeoFunctions.cpp index 4369cbb62..2bc694399 100644 --- a/Source/System/NodeCores/Drawables/Geometry/Util/OSGGeoFunctions.cpp +++ b/Source/System/NodeCores/Drawables/Geometry/Util/OSGGeoFunctions.cpp @@ -1099,7 +1099,7 @@ Int32 setIndexFromVRMLData( Geometry *geoPtr, normalIT = VERTEX_COORD_IT; if(niN) { - FWARNING(("Not enough normal index (%"PRISize",%d)\n", + FWARNING(("Not enough normal index (%" PRISize ",%d)\n", normalIndex.size(), piN)); normalIndex.clear(); } @@ -1177,7 +1177,7 @@ else colorIT = VERTEX_COORD_IT; if(ciN) { - FWARNING(("Not enough color index (%"PRISize",%d)\n", + FWARNING(("Not enough color index (%" PRISize ",%d)\n", colorIndex.size(), piN)); colorIndex.clear(); } @@ -1242,7 +1242,7 @@ else textureIT = VERTEX_COORD_IT; if(ciN) { - FWARNING(("Not enough texCoord index (%"PRISize",%d)\n", + FWARNING(("Not enough texCoord index (%" PRISize ",%d)\n", texCoordIndex.size(), piN)); texCoordIndex.clear(); } @@ -1800,7 +1800,7 @@ Int32 setIndexFromIndexedX3DData ( Geometry *geoPtr, if(niN) { - FWARNING(("Not enough normal index (%"PRISize",%d)\n", + FWARNING(("Not enough normal index (%" PRISize ",%d)\n", normalIndex.size(), piN)); normalIndex.clear(); } @@ -1874,7 +1874,7 @@ else colorIT = VERTEX_COORD_IT; if(ciN) { - FWARNING(("Not enough color index (%"PRISize",%d)\n", + FWARNING(("Not enough color index (%" PRISize ",%d)\n", colorIndex.size(), piN)); colorIndex.clear(); } @@ -1937,7 +1937,7 @@ else textureIT = VERTEX_COORD_IT; if(tiN) { - FWARNING(("Not enough texCoord index (%"PRISize",%d)\n", + FWARNING(("Not enough texCoord index (%" PRISize ",%d)\n", texCoordIndex.size(), piN)); texCoordIndex.clear(); } diff --git a/Source/System/NodeCores/Drawables/Particles/OSGParticles.cpp b/Source/System/NodeCores/Drawables/Particles/OSGParticles.cpp index 225cca69a..1c8ce0ecc 100644 --- a/Source/System/NodeCores/Drawables/Particles/OSGParticles.cpp +++ b/Source/System/NodeCores/Drawables/Particles/OSGParticles.cpp @@ -2933,7 +2933,7 @@ void Particles::drawPrimitives(DrawEnv *pEnv) ) { FWARNING(("Particles::draw: inconsistent attributes " - "(p:%"PRISize" s:%"PRISize" c:%d)!\n", + "(p:%" PRISize " s:%" PRISize " c:%d)!\n", pos->size(), size->size(), (col != NULL)? int(col->size()) : -1)); return; diff --git a/Source/System/NodeCores/Groups/Effects/DisplayFilter/OSGDisplayFilterStageData.cpp b/Source/System/NodeCores/Groups/Effects/DisplayFilter/OSGDisplayFilterStageData.cpp index 66a8360fa..1aa2a8212 100644 --- a/Source/System/NodeCores/Groups/Effects/DisplayFilter/OSGDisplayFilterStageData.cpp +++ b/Source/System/NodeCores/Groups/Effects/DisplayFilter/OSGDisplayFilterStageData.cpp @@ -131,7 +131,7 @@ void DisplayFilterStageData::updateData(FieldContainer *pStageCore, if(pCore == NULL) return; - fprintf(stderr, "dfs data updateData %d | 0x%016"PRIx64"\n", + fprintf(stderr, "dfs data updateData %d | 0x%016" PRIx64 "\n", origin, whichField); diff --git a/Source/System/State/Auxiliary/OSGTextureSelectChunk.cpp b/Source/System/State/Auxiliary/OSGTextureSelectChunk.cpp index 46d4fcbf0..b6f57ee0e 100644 --- a/Source/System/State/Auxiliary/OSGTextureSelectChunk.cpp +++ b/Source/System/State/Auxiliary/OSGTextureSelectChunk.cpp @@ -162,7 +162,7 @@ void TextureSelectChunk::activate(DrawEnv *pEnv, UInt32 idx) if(_sfChoice.getValue() >= _mfTextures.size()) { FWARNING( - ("TextureSelect::activate choice beyond size %d %"PRISize"!\n", + ("TextureSelect::activate choice beyond size %d %" PRISize "!\n", _sfChoice.getValue(), _mfTextures.size ())); @@ -188,7 +188,7 @@ void TextureSelectChunk::changeFrom(DrawEnv *pEnv, if(_sfChoice.getValue() >= _mfTextures.size()) { FWARNING( - ("TextureSelect::changeFrom choice beyond size %d %"PRISize"!\n", + ("TextureSelect::changeFrom choice beyond size %d %" PRISize "!\n", _sfChoice.getValue(), _mfTextures.size ())); @@ -205,7 +205,7 @@ void TextureSelectChunk::deactivate(DrawEnv *pEnv, UInt32 idx) if(_sfChoice.getValue() >= _mfTextures.size()) { FWARNING( - ("TextureSelect::deactivate choice beyond size %d %"PRISize"!\n", + ("TextureSelect::deactivate choice beyond size %d %" PRISize "!\n", _sfChoice.getValue(), _mfTextures.size ())); diff --git a/Source/System/State/OpenGL/OSGTextureEnvChunk.cpp b/Source/System/State/OpenGL/OSGTextureEnvChunk.cpp index fbc587a2c..2320192f3 100644 --- a/Source/System/State/OpenGL/OSGTextureEnvChunk.cpp +++ b/Source/System/State/OpenGL/OSGTextureEnvChunk.cpp @@ -200,7 +200,7 @@ void TextureEnvChunk::handleTextureShader(Window *win, GLenum bindtarget) else if(getMFShaderOffsetMatrix()->size() != 0) { FWARNING(("TextureEnvChunk::handleTextureShader: shaderOffsetMatrix " - "has to have 4 entries, not %"PRISize"!\n", + "has to have 4 entries, not %" PRISize "!\n", getMFShaderOffsetMatrix()->size() )); } diff --git a/Source/System/State/Shader/Base/OSGShaderCacheTree.h b/Source/System/State/Shader/Base/OSGShaderCacheTree.h index 900f20f57..69121a897 100644 --- a/Source/System/State/Shader/Base/OSGShaderCacheTree.h +++ b/Source/System/State/Shader/Base/OSGShaderCacheTree.h @@ -272,7 +272,8 @@ class ShaderCacheTreeV0 typedef std::vector IdStore; static const UInt32 LevelSize = osgPow_s<2u, LevelBits>::result; -#if !defined(WIN32) && !defined(__APPLE__) +#if !defined(WIN32) && !defined(__APPLE__) && \ + !defined(__GXX_EXPERIMENTAL_CXX0X__) static const Real32 LevelFactor = 1.f / (LevelBits); #else static const Real32 LevelFactor; @@ -440,7 +441,8 @@ class ShaderCacheTreeV1 typedef std::vector IdStore; static const UInt32 LevelSize = osgPow_s<2u, LevelBits>::result; -#if !defined(WIN32) && !defined(__APPLE__) +#if !defined(WIN32) && !defined(__APPLE__) && \ + !defined(__GXX_EXPERIMENTAL_CXX0X__) static const Real32 LevelFactor = 1.f / (LevelBits); #else static const Real32 LevelFactor; @@ -563,7 +565,8 @@ class ShaderCacheTreeV2 typedef std::vector IdStore; static const UInt32 LevelSize = osgPow_s<2u, LevelBits>::result; -#if !defined(WIN32) && !defined(__APPLE__) +#if !defined(WIN32) && !defined(__APPLE__) && \ + !defined(__GXX_EXPERIMENTAL_CXX0X__) static const Real32 LevelFactor = 1.f / (LevelBits); #else static const Real32 LevelFactor; @@ -689,7 +692,8 @@ class ShaderCacheTreeV3 typedef std::vector IdStore; static const UInt32 LevelSize = osgPow_s<2u, LevelBits>::result; -#if !defined(WIN32) && !defined(__APPLE__) +#if !defined(WIN32) && !defined(__APPLE__) && \ + !defined(__GXX_EXPERIMENTAL_CXX0X__) static const Real32 LevelFactor = 1.f / (LevelBits); #else static const Real32 LevelFactor; diff --git a/Source/System/State/Shader/Base/OSGShaderCacheTree.inl b/Source/System/State/Shader/Base/OSGShaderCacheTree.inl index 0f52933a3..509e92514 100644 --- a/Source/System/State/Shader/Base/OSGShaderCacheTree.inl +++ b/Source/System/State/Shader/Base/OSGShaderCacheTree.inl @@ -256,7 +256,8 @@ ShaderMapCache::~ShaderMapCache(void) /*---------------------------------------------------------------------------*/ -#if defined(WIN32) || defined(__APPLE__) +#if defined(WIN32) || defined(__APPLE__) || \ + defined(__GXX_EXPERIMENTAL_CXX0X__) template const Real32 ShaderCacheTreeV0::LevelFactor = 1.f / (LevelBits); @@ -1095,7 +1096,8 @@ Object2T *VariantPtr const Real32 ShaderCacheTreeV1::LevelFactor = 1.f / (LevelBits); @@ -1786,7 +1788,8 @@ void ShaderCacheTreeV1::destroy(ElemDestFunc destFunc) /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ -#if defined(WIN32) || defined(__APPLE__) +#if defined(WIN32) || defined(__APPLE__) || \ + defined(__GXX_EXPERIMENTAL_CXX0X__) template const Real32 ShaderCacheTreeV2::LevelFactor = 1.f / (LevelBits); @@ -2717,7 +2720,8 @@ void ShaderCacheTreeV2::destroy(ElemDestFunc destFunc) /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ -#if defined(WIN32) || defined(__APPLE__) +#if defined(WIN32) || defined(__APPLE__) || \ + defined(__GXX_EXPERIMENTAL_CXX0X__) template const Real32 ShaderCacheTreeV3::LevelFactor = 1.f / (LevelBits); diff --git a/Source/System/Window/Background/OSGPolygonBackground.cpp b/Source/System/Window/Background/OSGPolygonBackground.cpp index a4caa2fc5..1f2d613e1 100644 --- a/Source/System/Window/Background/OSGPolygonBackground.cpp +++ b/Source/System/Window/Background/OSGPolygonBackground.cpp @@ -113,7 +113,7 @@ void PolygonBackground::clear(DrawEnv *pEnv) getMFPositions()->size() != getMFTexCoords()->size()) { FWARNING(("PolygonBackground::clear: positions and texcoords have " - "different/ invalid sizes (%"PRISize" vs. %"PRISize")!\n", + "different/ invalid sizes (%" PRISize " vs. %" PRISize ")!\n", getMFPositions()->size(), getMFTexCoords()->size())); return; } diff --git a/Source/System/Window/Base/OSGWindow.cpp b/Source/System/Window/Base/OSGWindow.cpp index 12a11a2e2..227130cce 100644 --- a/Source/System/Window/Base/OSGWindow.cpp +++ b/Source/System/Window/Base/OSGWindow.cpp @@ -51,7 +51,8 @@ #if !defined(WIN32) && !defined(__APPLE__) && !defined(OSG_EMBEDDED) # if defined(OSG_USE_OGL3_PROTOS) || defined(OSG_USE_OGL4_PROTOS) -# include +//# include +# include # else # include # endif @@ -666,7 +667,7 @@ UInt32 OSG::Window::validateGLObject(UInt32 osgId, _mfGlObjectLastRefresh.resize(osgId + 1, 0); } - FDEBUG(("Window 0x%p (event %d,ri:%"PRISize",rf:%"PRISize"): " + FDEBUG(("Window 0x%p (event %d,ri:%" PRISize ",rf:%" PRISize "): " "Validating object %d: last reinit:%d, last validate:" "%d last refresh: %d => %s\n", this, getGlObjectEventCounter(), @@ -1584,7 +1585,7 @@ void OSG::Window::doFrameExit(void) } FDEBUG(("Window::doFrameExit: Destroying GLObject %d (%d) - GL id %" - PRIUSize"\n", + PRIUSize "\n", i, n, getGLObjectId(i))); UInt32 rc = obj->getRefCounter(); @@ -1994,9 +1995,9 @@ void OSG::Window::render(RenderActionBase *action) _mfDrawTasks.clear(); } - + doRenderAllViewports(action); - + swap (); doFrameExit(); // after frame cleanup: delete dead GL objects deactivate (); diff --git a/Source/System/Window/FrameBufferObjects/OSGFBOViewport.cpp b/Source/System/Window/FrameBufferObjects/OSGFBOViewport.cpp index b2a55a7fe..934ce6baa 100644 --- a/Source/System/Window/FrameBufferObjects/OSGFBOViewport.cpp +++ b/Source/System/Window/FrameBufferObjects/OSGFBOViewport.cpp @@ -55,7 +55,7 @@ #include "OSGWindow.h" #include "OSGFrameBufferAttachment.h" -OSG_USING_NAMESPACE +OSG_BEGIN_NAMESPACE // Documentation for this class is emited in the // OSGFBOViewportBase.cpp file. @@ -184,3 +184,6 @@ void FBOViewport::render(DrawActionBase *action) } } #endif + +OSG_END_NAMESPACE + diff --git a/Source/System/Window/FrameBufferObjects/OSGFrameBufferAttachment.cpp b/Source/System/Window/FrameBufferObjects/OSGFrameBufferAttachment.cpp index 771244320..8ddc77d0c 100644 --- a/Source/System/Window/FrameBufferObjects/OSGFrameBufferAttachment.cpp +++ b/Source/System/Window/FrameBufferObjects/OSGFrameBufferAttachment.cpp @@ -48,7 +48,7 @@ #include "OSGFrameBufferAttachment.h" -OSG_USING_NAMESPACE +OSG_BEGIN_NAMESPACE // Documentation for this class is emited in the // OSGFrameBufferAttachmentBase.cpp file. @@ -118,3 +118,5 @@ void FrameBufferAttachment::dump( UInt32 , SLOG << "Dump FrameBufferAttachment NI" << std::endl; } +OSG_END_NAMESPACE + diff --git a/Source/System/Window/FrameBufferObjects/OSGTextureBuffer.cpp b/Source/System/Window/FrameBufferObjects/OSGTextureBuffer.cpp index e5f70d697..cc393e079 100644 --- a/Source/System/Window/FrameBufferObjects/OSGTextureBuffer.cpp +++ b/Source/System/Window/FrameBufferObjects/OSGTextureBuffer.cpp @@ -53,8 +53,7 @@ #include "OSGDrawEnv.h" #include "OSGTextureObjChunk.h" -OSG_USING_NAMESPACE - +OSG_BEGIN_NAMESPACE UInt32 TextureBuffer::_uiFramebuffer_object_extension = Window::invalidExtensionID; @@ -382,4 +381,4 @@ void TextureBuffer::dump( UInt32 , SLOG << "Dump TextureBuffer NI" << std::endl; } - +OSG_END_NAMESPACE diff --git a/Source/System/Window/Passive/OSGPassiveWindow.cpp b/Source/System/Window/Passive/OSGPassiveWindow.cpp index 48d754f44..0c8f72a5a 100644 --- a/Source/System/Window/Passive/OSGPassiveWindow.cpp +++ b/Source/System/Window/Passive/OSGPassiveWindow.cpp @@ -51,7 +51,8 @@ #ifdef OSG_USE_GLX # if defined(OSG_USE_OGL3_PROTOS) || defined(OSG_USE_OGL4_PROTOS) -# include +//# include +# include # else # include # endif diff --git a/Source/Test/SystemLib/OSGTestFC.cpp b/Source/Test/SystemLib/OSGTestFC.cpp index cae6da671..b60704def 100644 --- a/Source/Test/SystemLib/OSGTestFC.cpp +++ b/Source/Test/SystemLib/OSGTestFC.cpp @@ -187,7 +187,7 @@ void TestFC::dump( UInt32 uiIndent, _pAspectStore->dump(); #endif - fprintf(stderr, "%p %p | 0x%016"PRIx64"\n", + fprintf(stderr, "%p %p | 0x%016" PRIx64 "\n", _pContainerChanges, &_bvChanged, _bvChanged); diff --git a/Source/Test/SystemLib/testFieldContainer.cpp b/Source/Test/SystemLib/testFieldContainer.cpp index d7eed2d71..2043d7c90 100644 --- a/Source/Test/SystemLib/testFieldContainer.cpp +++ b/Source/Test/SystemLib/testFieldContainer.cpp @@ -59,7 +59,7 @@ void applyToAspectAndClear(OSG::UInt32 uiAspect) void testSharing(void) { fprintf(stderr, "sharing\n"); - fprintf(stderr, "%"PRIUSize"\n", sizeof(OSG::TestFC)); + fprintf(stderr, "%" PRIUSize "\n", sizeof(OSG::TestFC)); OSG::TestFCUnrecPtr pTestFC = OSG::TestFC::create(); @@ -143,7 +143,7 @@ void testSharing(void) void testSharing1(void) { fprintf(stderr, "sharing\n"); - fprintf(stderr, "%"PRIUSize"\n", sizeof(OSG::TestFC)); + fprintf(stderr, "%" PRIUSize "\n", sizeof(OSG::TestFC)); OSG::TestFCUnrecPtr pTestFC = OSG::TestFC::create(); @@ -198,7 +198,7 @@ void testSharing1(void) void testSharing2(void) { fprintf(stderr, "sharing\n"); - fprintf(stderr, "%"PRIUSize"\n", sizeof(OSG::TestFC)); + fprintf(stderr, "%" PRIUSize "\n", sizeof(OSG::TestFC)); OSG::TestFCUnrecPtr pTestFC = OSG::TestFC::create(); @@ -371,7 +371,7 @@ void testRefCount(void) void testChangeList(void) { fprintf(stderr, "testChangeList\n"); - fprintf(stderr, "%"PRIUSize"\n", sizeof(OSG::TestFC)); + fprintf(stderr, "%" PRIUSize "\n", sizeof(OSG::TestFC)); OSG::TestFCUnrecPtr pTestFC = OSG::TestFC::create(); diff --git a/Source/WindowSystem/QT4/OSGWindowQT4Def.h b/Source/WindowSystem/QT4/OSGWindowQT4Def.h index 690d8b70f..47d861717 100644 --- a/Source/WindowSystem/QT4/OSGWindowQT4Def.h +++ b/Source/WindowSystem/QT4/OSGWindowQT4Def.h @@ -42,6 +42,8 @@ #pragma once #endif +#include + #include #include diff --git a/Source/WindowSystem/QT4/testPassiveQT4.cpp b/Source/WindowSystem/QT4/testPassiveQT4.cpp index b87b98cd4..c426ffd36 100644 --- a/Source/WindowSystem/QT4/testPassiveQT4.cpp +++ b/Source/WindowSystem/QT4/testPassiveQT4.cpp @@ -11,6 +11,8 @@ // This code is based on the QT opengl/gear example. +#include + #include #include diff --git a/Source/WindowSystem/QT4/testWindowQT4SSM_qt.cpp b/Source/WindowSystem/QT4/testWindowQT4SSM_qt.cpp index 6d748c076..ffb80c939 100644 --- a/Source/WindowSystem/QT4/testWindowQT4SSM_qt.cpp +++ b/Source/WindowSystem/QT4/testWindowQT4SSM_qt.cpp @@ -1,5 +1,6 @@ #include "OSGConfig.h" +#include #include diff --git a/Source/WindowSystem/QT4/testWindowQT4_qt.cpp b/Source/WindowSystem/QT4/testWindowQT4_qt.cpp index c9e7fe00d..3d076afe1 100644 --- a/Source/WindowSystem/QT4/testWindowQT4_qt.cpp +++ b/Source/WindowSystem/QT4/testWindowQT4_qt.cpp @@ -8,6 +8,8 @@ #pragma set woff 1375 #endif +#include + #include #include #include diff --git a/Support/CMakeLists.txt b/Support/CMakeLists.txt index 3f7add55e..294d3f7f0 100644 --- a/Support/CMakeLists.txt +++ b/Support/CMakeLists.txt @@ -64,6 +64,9 @@ IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux") SET(LINUX 1) ENDIF() +SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" + CACHE STRING "OpenSGSupport Build Types" FORCE ) + IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." @@ -144,9 +147,6 @@ FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_SUPPORT}) ENDFOREACH(EXTERNAL) -SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" - CACHE STRING "OpenSGSupport Build Types" FORCE ) - FILE(WRITE "${CMAKE_BINARY_DIR}/OSGSupportConfig.cmake" "SET(OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\")\n\n") FILE(APPEND "${CMAKE_BINARY_DIR}/OSGSupportConfig.cmake" -- 2.11.4.GIT