1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
INCLUDE_DIRECTORIES(
.
../obdinfo/
)
FILE(GLOB GENERATOR_INCLUDES
generators/*/CMakeInclude.cmake)
FOREACH(GENERATOR_INCLUDE ${GENERATOR_INCLUDES})
INCLUDE(${GENERATOR_INCLUDE})
ENDFOREACH(GENERATOR_INCLUDE ${GENERATOR_INCLUDES})
INCLUDE(CheckSymbolExists)
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(posix_openpt HAVE_POSIX_OPENPT)
IF(HAVE_POSIX_OPENPT)
ADD_DEFINITIONS(-DHAVE_POSIX_OPENPT)
ENDIF(HAVE_POSIX_OPENPT)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
IF(HAVE_GETTIMEOFDAY)
ADD_DEFINITIONS(-DAVE_GETTIMEOFDAY)
ENDIF(HAVE_GETTIMEOFDAY)
SET(OBD_SIM_DISABLE_BLUEZ false CACHE BOOL "Disable bluetooth support in obdsim")
IF(NOT OBD_SIM_DISABLE_BLUEZ)
CHECK_SYMBOL_EXISTS(BTPROTO_RFCOMM
bluetooth/bluetooth.h
HAVE_BLUETOOTH)
IF(HAVE_BLUETOOTH)
MESSAGE(STATUS "Enabling bluetooth obdsim port")
ADD_DEFINITIONS(-DHAVE_BLUETOOTH)
ENDIF(HAVE_BLUETOOTH)
ENDIF(NOT OBD_SIM_DISABLE_BLUEZ)
SET(OBDSIM_POSIXSRCS
posixsimport.cc
posixsimport.h
)
SET(OBDSIM_WINDOWSSRCS
windowssimport.cc
windowssimport.h
)
SET(OBDSIM_BLUETOOTHSRCS
bluetoothsimport.cc
bluetoothsimport.h
)
SET(OBDSIM_SRCS
datasource.h
obdsim.cc
obdsim.h
simport.cc
simport.h
mainloop.cc
mainloop.h
)
# For now, assume the choices are "windows" or "posix"
IF("${CMAKE_SYSTEM}" MATCHES "Windows")
SET(OBDSIM_SRCS ${OBDSIM_SRCS} ${OBDSIM_WINDOWSSRCS})
SET(OBDSIM_LIBS ${OBDSIM_LIBS} wsock32)
ELSE("${CMAKE_SYSTEM}" MATCHES "Windows")
SET(OBDSIM_SRCS ${OBDSIM_SRCS} ${OBDSIM_POSIXSRCS})
SET(OBDSIM_LIBS ${OBDSIM_LIBS} pthread dl)
ENDIF("${CMAKE_SYSTEM}" MATCHES "Windows")
IF(HAVE_BLUETOOTH)
SET(OBDSIM_SRCS ${OBDSIM_SRCS} ${OBDSIM_BLUETOOTHSRCS})
SET(OBDSIM_LIBS ${OBDSIM_LIBS} bluetooth)
ENDIF(HAVE_BLUETOOTH)
SET(OBDSIM_LIBS
${OBDSIM_LIBS}
${GENERATOR_LIBS}
ckobdinfo ckobdconfigfile
)
ADD_EXECUTABLE(obdsim ${OBDSIM_SRCS})
TARGET_LINK_LIBRARIES(obdsim ${OBDSIM_LIBS})
INSTALL(TARGETS obdsim
RUNTIME DESTINATION bin)
INSTALL(FILES ${OBDGPSLogger_SOURCE_DIR}/man/man1/obdsim.1
DESTINATION share/man/man1)
|