CMakeLists.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. cmake_minimum_required(VERSION 2.6)
  2. PROJECT(subtitleripper)
  3. SET(CMAKE_C_FLAGS $ENV{CFLAGS})
  4. SET ( PNG
  5. "ON"
  6. CACHE BOOL "Enable PNG support")
  7. SET ( PPM
  8. "ON"
  9. CACHE BOOL "Enable PPM support")
  10. SET ( ZLIB
  11. "ON"
  12. CACHE BOOL "Enable ZLIB support")
  13. SET(BIN_INSTALL_DIR bin)
  14. SET(DATA_INSTALL_DIR share)
  15. SET(subtitle2pgm_sources subtitle2pgm.c spudec.c)
  16. SET(subtitle2vobsub_sources subtitle2vobsub.c vobsub.c)
  17. SET(srttool_sources srttool.c)
  18. SET(vobsub2pgm_sources vobsub2pgm.c vobsub.c spudec.c)
  19. # LIBRARIES (MATH LIBPPM-NETPBM LIBPNG LIBZ)
  20. LINK_LIBRARIES(m)
  21. IF ( ${PPM} STREQUAL "ON" )
  22. ADD_DEFINITIONS( -D_HAVE_LIB_PPM_ )
  23. LINK_LIBRARIES(netpbm)
  24. INCLUDE_DIRECTORIES( /usr/include/netpbm )
  25. ENDIF ( ${PPM} STREQUAL "ON" )
  26. IF ( ${PNG} STREQUAL "ON" )
  27. ADD_DEFINITIONS( -D_HAVE_PNG_ -DPNG_SKIP_SETJMP_CHECK )
  28. LINK_LIBRARIES(png)
  29. ENDIF ( ${PNG} STREQUAL "ON" )
  30. IF ( ${ZLIB} STREQUAL "ON" )
  31. ADD_DEFINITIONS( -D_HAVE_ZLIB_ )
  32. LINK_LIBRARIES(z)
  33. ENDIF ( ${ZLIB} STREQUAL "ON" )
  34. ADD_EXECUTABLE(subtitle2pgm ${subtitle2pgm_sources})
  35. ADD_EXECUTABLE(subtitle2vobsub ${subtitle2vobsub_sources})
  36. ADD_EXECUTABLE(srttool ${srttool_sources})
  37. ADD_EXECUTABLE(vobsub2pgm ${vobsub2pgm_sources})
  38. ADD_DEFINITIONS( -DHAVE_GETLINE )
  39. EXECUTE_PROCESS(
  40. INPUT_FILE pgm2txt
  41. OUTPUT_FILE pgm2txt.new
  42. COMMAND sed s|^PATH_TO_LANGUAGE_FILTER.*|PATH_TO_LANGUAGE_FILTER=@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/subtitleripper/|
  43. )
  44. EXECUTE_PROCESS(
  45. COMMAND mv pgm2txt.new pgm2txt
  46. )
  47. INSTALL(FILES "gocrfilter_en.sed" "gocrfilter_fr.sed" "gocrfilter_nl.sed" "gocrfilter_none.sed" DESTINATION ${DATA_INSTALL_DIR}/subtitleripper )
  48. INSTALL(PROGRAMS "pgm2txt" DESTINATION ${BIN_INSTALL_DIR})
  49. INSTALL(TARGETS subtitle2pgm DESTINATION ${BIN_INSTALL_DIR})
  50. INSTALL(TARGETS subtitle2vobsub DESTINATION ${BIN_INSTALL_DIR})
  51. INSTALL(TARGETS srttool DESTINATION ${BIN_INSTALL_DIR})
  52. INSTALL(TARGETS vobsub2pgm DESTINATION ${BIN_INSTALL_DIR})