# Find Newton # # This module defines # NEWTON_FOUND # NEWTON_INCLUDE_DIRS # NEWTON_LIBRARIES # # Copyright (C) 2003-2009 Team Pantheon. http://www.team-pantheon.de # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # # JVN: NEWTON_ROOT environment variable added to find Newton even on Windows systems. # On a new cmake run, we do not need to be verbose IF(NEWTON_INCLUDE_DIRS AND NEWTON_LIBRARIES) SET(NEWTON_FIND_QUIETLY TRUE) ENDIF() include(FindPkgMacros) findpkg_begin(NEWTON) create_search_paths(NEWTON) # If CEF_ROOT was defined in the environment, use it. Else, search in default dependency dir. IF(NOT NEWTON_ROOT) IF("$ENV{NEWTON_ROOT}" STREQUAL "") SET(NEWTON_ROOT ${NEWTON_PREFIX_PATH}) ELSE() SET(NEWTON_ROOT $ENV{NEWTON_ROOT}) ENDIF() ENDIF() # Search for header files and libraries FIND_PATH(NEWTON_INCLUDE_DIR Newton.h PATHS ${NEWTON_INC_SEARCH_PATH}) FIND_PATH(NEWTON_MATH_INCLUDE_DIR dVector.h PATHS ${NEWTON_INC_SEARCH_PATH} PATH_SUFFIXES dMath) FIND_PATH(NEWTON_JOINT_INCLUDE_DIR CustomJoint.h PATHS ${NEWTON_INC_SEARCH_PATH} PATH_SUFFIXES dCustomJoints) SET(NEWTON_INCLUDE_DIRS ${NEWTON_INCLUDE_DIR} ${NEWTON_MATH_INCLUDE_DIR} ${NEWTON_JOINT_INCLUDE_DIR}) # Search for libraries files (release mode) FIND_LIBRARY(NEWTON_LIBRARY_RELEASE Newton PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_MATH_LIBRARY_RELEASE dMath PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_JOINT_LIBRARY_RELEASE dCustomJoints ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_CONTAINER_LIBRARY_RELEASE dContainers ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_PTHREAD_LIBRARY_RELEASE pthread PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_DLIBRARY_RELEASE dNewton PATHS ${NEWTON_LIB_SEARCH_PATH}) # Search for libraries files (debug mode)) FIND_LIBRARY(NEWTON_LIBRARY_DEBUG Newton_d Newtond Newton PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_MATH_LIBRARY_DEBUG dMath_d dMathd dMath PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_JOINT_LIBRARY_DEBUG dCustomJoints_d dCustomJointsd dCustomJoints PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_CONTAINER_LIBRARY_DEBUG dContainers_d dContainersd dContainers PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_PTHREAD_LIBRARY_DEBUG pthread_d pthreadd pthread PATHS ${NEWTON_LIB_SEARCH_PATH}) FIND_LIBRARY(NEWTON_DLIBRARY_DEBUG dNewton_d dNewtond dNewton PATHS ${NEWTON_LIB_SEARCH_PATH}) # Configure libraries for debug/release if (NEWTON_LIBRARY_RELEASE AND NEWTON_LIBRARY_DEBUG) SET(NEWTON_LIBRARY debug ${NEWTON_LIBRARY_DEBUG} optimized ${NEWTON_LIBRARY_RELEASE}) SET(NEWTON_MATH_LIBRARY debug ${NEWTON_MATH_LIBRARY_DEBUG} optimized ${NEWTON_MATH_LIBRARY_RELEASE}) SET(NEWTON_JOINT_LIBRARY debug ${NEWTON_JOINT_LIBRARY_DEBUG} optimized ${NEWTON_JOINT_LIBRARY_RELEASE}) SET(NEWTON_CONTAINER_LIBRARY debug ${NEWTON_CONTAINER_LIBRARY_DEBUG} optimized ${NEWTON_CONTAINER_LIBRARY_RELEASE}) SET(NEWTON_PTHREAD_LIBRARY debug ${NEWTON_PTHREAD_LIBRARY_DEBUG} optimized ${NEWTON_PTHREAD_LIBRARY_RELEASE}) SET(NEWTON_DLIBRARY debug ${NEWTON_DLIBRARY_DEBUG} optimized ${NEWTON_DLIBRARY_RELEASE}) elseif(NEWTON_LIBRARY_DEBUG) SET(NEWTON_LIBRARY debug ${NEWTON_LIBRARY_DEBUG} optimized ${NEWTON_LIBRARY_DEBUG}) SET(NEWTON_MATH_LIBRARY debug ${NEWTON_MATH_LIBRARY_DEBUG} optimized ${NEWTON_MATH_LIBRARY_DEBUG}) SET(NEWTON_JOINT_LIBRARY debug ${NEWTON_JOINT_LIBRARY_DEBUG} optimized ${NEWTON_JOINT_LIBRARY_DEBUG}) SET(NEWTON_CONTAINER_LIBRARY debug ${NEWTON_CONTAINER_LIBRARY_DEBUG} optimized ${NEWTON_CONTAINER_LIBRARY_DEBUG}) SET(NEWTON_PTHREAD_LIBRARY debug ${NEWTON_PTHREAD_LIBRARY_DEBUG} optimized ${NEWTON_PTHREAD_LIBRARY_DEBUG}) SET(NEWTON_DLIBRARY debug ${NEWTON_DLIBRARY_DEBUG} optimized ${NEWTON_DLIBRARY_DEBUG}) else() SET(NEWTON_LIBRARY debug ${NEWTON_LIBRARY_RELEASE} optimized ${NEWTON_LIBRARY_RELEASE}) SET(NEWTON_MATH_LIBRARY debug ${NEWTON_MATH_LIBRARY_RELEASE} optimized ${NEWTON_MATH_LIBRARY_RELEASE}) SET(NEWTON_JOINT_LIBRARY debug ${NEWTON_JOINT_LIBRARY_RELEASE} optimized ${NEWTON_JOINT_LIBRARY_RELEASE}) SET(NEWTON_CONTAINER_LIBRARY debug ${NEWTON_CONTAINER_LIBRARY_RELEASE} optimized ${NEWTON_CONTAINER_LIBRARY_RELEASE}) SET(NEWTON_PTHREAD_LIBRARY debug ${NEWTON_PTHREAD_LIBRARY_RELEASE} optimized ${NEWTON_PTHREAD_LIBRARY_RELEASE}) SET(NEWTON_DLIBRARY debug ${NEWTON_DLIBRARY_RELEASE} optimized ${NEWTON_DLIBRARY_RELEASE}) endif() SET(NEWTON_LIBRARIES ${NEWTON_JOINT_LIBRARY} ${NEWTON_CONTAINER_LIBRARY} ${NEWTON_DLIBRARY} ${NEWTON_LIBRARY} ${NEWTON_MATH_LIBRARY} CACHE STRING "Newton libraries files") if(WIN32 AND NOT ANDROID) SET(NEWTON_LIBRARIES ${NEWTON_LIBRARIES} ${NEWTON_PTHREAD_LIBRARY}) endif() # Hide those variables in GUI SET(NEWTON_LIBRARY_DEBUG ${NEWTON_LIBRARY_DEBUG} CACHE STRING "Library name of Newton library") SET(NEWTON_MATH_LIBRARY_DEBUG ${NEWTON_MATH_LIBRARY_DEBUG} CACHE STRING "Library name of Math library") SET(NEWTON_JOINT_LIBRARY_DEBUG ${NEWTON_JOINT_LIBRARY_DEBUG} CACHE STRING "Library name of Joint library") SET(NEWTON_CONTAINER_LIBRARY_DEBUG ${NEWTON_CONTAINER_LIBRARY_DEBUG} CACHE STRING "Library name of Container library") SET(NEWTON_PTHREAD_LIBRARY_DEBUG ${NEWTON_PTHREAD_LIBRARY_DEBUG} CACHE STRING "Library name of Pthread library") SET(NEWTON_DLIBRARY_DEBUG ${NEWTON_DLIBRARY_DEBUG} CACHE STRING "Library name of dNewton library") SET(NEWTON_LIBRARY_RELEASE ${NEWTON_LIBRARY_RELEASE} CACHE STRING "Library name of Newton library") SET(NEWTON_MATH_LIBRARY_RELEASE ${NEWTON_MATH_LIBRARY_RELEASE} CACHE STRING "Library name of Math library") SET(NEWTON_JOINT_LIBRARY_RELEASE ${NEWTON_JOINT_LIBRARY_RELEASE} CACHE STRING "Library name of Joint library") SET(NEWTON_CONTAINER_LIBRARY_RELEASE ${NEWTON_CONTAINER_LIBRARY_RELEASE} CACHE STRING "Library name of Container library") SET(NEWTON_PTHREAD_LIBRARY_RELEASE ${NEWTON_PTHREAD_LIBRARY_RELEASE} CACHE STRING "Library name of Pthread library") SET(NEWTON_DLIBRARY_RELEASE ${NEWTON_DLIBRARY_RELEASE} CACHE STRING "Library name of dNewton library") SET(NEWTON_LIBRARY ${NEWTON_LIBRARY} CACHE STRING "Library name of Newton library") SET(NEWTON_MATH_LIBRARY ${NEWTON_MATH_LIBRARY} CACHE STRING "Library name of Math library") SET(NEWTON_JOINT_LIBRARY ${NEWTON_JOINT_LIBRARY} CACHE STRING "Library name of Joint library") SET(NEWTON_CONTAINER_LIBRARY ${NEWTON_CONTAINER_LIBRARY} CACHE STRING "Library name of Container library") SET(NEWTON_PTHREAD_LIBRARY ${NEWTON_PTHREAD_LIBRARY} CACHE STRING "Library name of Pthread library") SET(NEWTON_DLIBRARY ${NEWTON_DLIBRARY} CACHE STRING "Library name of dNewton library") IF(NEWTON_INCLUDE_DIR AND NEWTON_LIBRARIES) SET(NEWTON_FOUND TRUE) ENDIF() IF(NEWTON_FOUND) IF(NOT NEWTON_FIND_QUIETLY) MESSAGE(STATUS " libraries: ${NEWTON_LIBRARIES}") MESSAGE(STATUS " includes: ${NEWTON_INCLUDE_DIRS}") MESSAGE(STATUS " version: ${NEWTON_VERSION}") ENDIF() ELSE() IF(NOT NEWTON_LIBRARIES) MESSAGE(STATUS, "Newton libraries could not be found.") ENDIF() IF(NOT NEWTON_INCLUDE_DIRS) MESSAGE(STATUS "Newton include files could not be found.") ENDIF() ENDIF()