several tipps for compiling on linux

cmake script to find physx 3.3

# physics (physx)
if(USE_PHYSX)
  if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    set(PHYSX_LIB_SUFFIX "CHECKED")
  endif()
  set( PHYSX_ROOT "/usr/local" CACHE PATH "physx root" )
  set( LIB_SUFFIX 64 )
  IF(NOT EXISTS ${PHYSX_ROOT})
    message(FATAL_ERROR "physx root directory does not exist: ${PHYSX_ROOT}")
  endif ()

  FIND_PATH(
    PHYSX_INCLUDE_DIR PxPhysicsAPI.h
    PATHS "/usr/local" ${PHYSX_ROOT}
    PATH_SUFFIXES "" "Include"
    DOC "physx include directory")
  set (INCLUDES ${INCLUDES}
    ${PHYSX_INCLUDE_DIR}
  )

  set(PHYSX_LIBRARIES_TO_FIND LowLevel LowLevelCloth SceneQuery SimulationController PhysX3 PhysX3Common PhysX3Cooking PhysX3Extensions PhysXProfileSDK PxTask)
  foreach(LIB_TO_FIND ${PHYSX_LIBRARIES_TO_FIND})
    FIND_LIBRARY(
      PHYSX_LIBRARY_${LIB_TO_FIND}
      NAMES "${LIB_TO_FIND}${PHYSX_LIB_SUFFIX}"
      HINTS ${PHYSX_INCLUDE_DIR}/..
      PATH_SUFFIXES "lib${LIB_SUFFIX}" "Lib/linux${LIB_SUFFIX}")
    set (LIBS_PHYSX ${LIBS_PHYSX}
      ${PHYSX_LIBRARY_${LIB_TO_FIND}}
    )
  endforeach()
endif(USE_PHYSX)

set LIB_SUFFIX to the bit u need (32/64).
set PHYSX_ROOT to the directory containing the dirs “Lib” and “Include”.
set PHYSX_LIB_SUFFIX for CHECKED, PROFILE or “”
PHYSX_INCLUDE_DIR holds the include dir.
LIBS_PHYSX holds all libs needed.

U need to link way to more libraries than really need, to compile a simple program.
LowLevel LowLevelCloth SceneQuery SimulationController PhysX3 PhysX3Common PhysX3Cooking PhysX3Extensions PhysXProfileSDK PxTask

Took me some time to find out that the documentation is wrong about needing only “libPhysX3 and libPhysX3Common”

Had another problem with the macro _DEBUG which is MS stuff but is needed by physx.

#ifndef NDEBUG
#   if !defined _DEBUG && defined USE_PHYSX
#       define _DEBUG 1 // for physx
#   endif
#else

Hope that helps some non MS people :)

Have fun
Markus