1 include(CheckSymbolExists)
2 add_definitions("-D_POSIX_C_SOURCE=200809L") # for getopt(), sigaction(), and strdup()
4 include_directories(${CMAKE_SOURCE_DIR}/src/)
6 # Build a test app that sends a single picture
7 option(BUILD_PICOPROJ "Build a test app that sends a single picture" TRUE)
9 add_executable(picoproj picoproj.c)
10 target_link_libraries(picoproj am7xxx)
11 install(TARGETS picoproj
12 DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
15 # Build a more complete example
16 option(BUILD_AM7XXX-PLAY "Build a more complete example: am7xxx-play" TRUE)
18 find_package(FFmpeg REQUIRED)
19 set(CMAKE_REQUIRED_LIBRARIES ${FFMPEG_LIBRARIES})
20 set(CMAKE_REQUIRED_INCLUDES ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
21 check_symbol_exists(avformat_open_input
22 "libavformat/avformat.h"
23 HAVE_AVFORMAT_OPEN_INPUT)
24 if(NOT HAVE_AVFORMAT_OPEN_INPUT)
26 "Function avformat_open_input missing. Please use a newer FFmpeg release.")
29 include_directories(${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS})
30 include_directories(${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
31 include_directories(${FFMPEG_LIBSWSCALE_INCLUDE_DIRS})
33 set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_SOURCE)
34 check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
36 add_definitions("-DHAVE_SIGACTION")
39 check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R)
41 add_definitions("-DHAVE_STRTOK_R")
43 set(CMAKE_REQUIRED_DEFINITIONS)
45 # xcb is used to retrieve the full screen dimensions when using x11grab
49 add_definitions("${LIBXCB_DEFINITIONS} -DHAVE_XCB")
50 include_directories(${LIBXCB_INCLUDE_DIRS})
51 set(OPTIONAL_LIBRARIES ${LIBXCB_LIBRARIES})
54 add_executable(am7xxx-play am7xxx-play.c)
56 target_link_libraries(am7xxx-play am7xxx
58 ${FFMPEG_LIBSWSCALE_LIBRARIES}
59 ${OPTIONAL_LIBRARIES})
60 install(TARGETS am7xxx-play
61 DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
64 # Build a simple usb-modeswitch clone for am7xxx devices
65 option(BUILD_am7xxx-modeswitch "Build a simple usbmode-switch clone for am7xxx devices" TRUE)
66 if(BUILD_am7xxx-modeswitch)
68 find_package(libusb-1.0 REQUIRED)
69 include_directories(${LIBUSB_1_INCLUDE_DIRS})
71 add_executable(am7xxx-modeswitch am7xxx-modeswitch.c)
72 target_link_libraries(am7xxx-modeswitch ${LIBUSB_1_LIBRARIES})
73 install(TARGETS am7xxx-modeswitch
74 DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")