diff options
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/FindUSB.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/GrMiscUtils.cmake | 25 | ||||
-rw-r--r-- | cmake/Modules/GrVersion.cmake | 11 |
3 files changed, 53 insertions, 11 deletions
diff --git a/cmake/Modules/FindUSB.cmake b/cmake/Modules/FindUSB.cmake new file mode 100644 index 000000000..97f3db675 --- /dev/null +++ b/cmake/Modules/FindUSB.cmake @@ -0,0 +1,28 @@ +if(NOT LIBUSB_FOUND) + pkg_check_modules (LIBUSB_PKG libusb-1.0) + find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h + PATHS + ${LIBUSB_PKG_INCLUDE_DIRS} + /usr/include/libusb-1.0 + /usr/include + /usr/local/include + ) + + find_library(LIBUSB_LIBRARIES NAMES usb-1.0 + PATHS + ${LIBUSB_PKG_LIBRARY_DIRS} + /usr/lib + /usr/local/lib + ) + +if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found") + message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}") +else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") + message(STATUS "libusb-1.0 not found.") +endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + +mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) + +endif(NOT LIBUSB_FOUND) diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake index 27003cf59..7b0c00272 100644 --- a/cmake/Modules/GrMiscUtils.cmake +++ b/cmake/Modules/GrMiscUtils.cmake @@ -208,3 +208,28 @@ function(GR_GEN_TARGET_DEPS name var) set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) endif() endfunction(GR_GEN_TARGET_DEPS) + + +######################################################################## +# Control availability of vmcircbuf methods. +# For now, only allows disabling of shm methods, which cause uncatchable +# segmentation faults on Cygwin with gcc 4.x (x <= 5) +# Usage: +# GR_VMCIRCBUF() +# +# Will set TRY_SHM_VMCIRCBUF to 1 by default except on Windows machines. +# Can manually set with -DTRY_SHM_VMCIRCBUF=0|1 +######################################################################## +function(GR_VMCIRCBUF) + if(WIN32) + OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" OFF) + else(WIN32) + OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" ON) + endif(WIN32) + + message(STATUS "TRY_SHM_VMCIRCBUF set to ${TRY_SHM_VMCIRCBUF}.") + + if(TRY_SHM_VMCIRCBUF) + add_definitions( -DTRY_SHM_VMCIRCBUF ) + endif(TRY_SHM_VMCIRCBUF) +endfunction(GR_VMCIRCBUF) diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake index 7aa13f556..f82246525 100644 --- a/cmake/Modules/GrVersion.cmake +++ b/cmake/Modules/GrVersion.cmake @@ -22,17 +22,6 @@ if(DEFINED __INCLUDED_GR_VERSION_CMAKE) endif() set(__INCLUDED_GR_VERSION_CMAKE TRUE) -######################################################################## -# Extract variables from version.sh -######################################################################## -include(GrPython) -message(STATUS "Extracting version information from version.sh...") -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "print open('${CMAKE_SOURCE_DIR}/version.sh').read().replace('=', ';').replace('\\n', ';')" - OUTPUT_VARIABLE VERSION_INFO OUTPUT_STRIP_TRAILING_WHITESPACE -) -include(CMakeParseArgumentsCopy) -CMAKE_PARSE_ARGUMENTS(VERSION_INFO "" "MAJOR_VERSION;API_COMPAT;MINOR_VERSION;MAINT_VERSION" "" ${VERSION_INFO}) - #eventually, replace version.sh and fill in the variables below set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION}) set(API_COMPAT ${VERSION_INFO_API_COMPAT}) |