1 include_directories ("${PROJECT_BINARY_DIR}/" "${PROJECT_SOURCE_DIR}/src/pfs") 2 if( NOT HAS_GETOPT ) 3 include_directories ("${GETOPT_INCLUDE}") 4 endif( NOT HAS_GETOPT ) 5 6 link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 8 set( SHELL_CMDS pfsin pfsout pfsindcraw ) 9 #set( SHELL_CMDS ) 10 foreach(SHCMD ${SHELL_CMDS}) 11 # Replace the tag with the path to bash 12 add_custom_command( OUTPUT ${SHCMD} 13 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SHCMD}.in 14 COMMAND sed -e "'s;@BASH_PATH@;${BASH_EXECUTABLE};g'" ${CMAKE_CURRENT_SOURCE_DIR}/${SHCMD}.in >${CMAKE_CURRENT_BINARY_DIR}/${SHCMD} ) 15 add_custom_target(${SHCMD}_sh ALL DEPENDS ${SHCMD}) 16 endforeach(SHCMD) 17 18 #file(READ ${CMAKE_CURRENT_SOURCE_DIR}/pfsin.in file_content) 19 #string(REGEX REPLACE "@BASH_PATH@" "${BASH_EXECUTABLE}" file_content "${file_content}") 20 #file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pfsin" "${file_content}") 21 22 #file(READ ${CMAKE_CURRENT_SOURCE_DIR}/pfsout.in file_content) 23 #string(REGEX REPLACE "(@BASH_PATH@)" "${BASH_EXECUTABLE}" file_content "${file_content}") 24 #file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pfsout" "${file_content}") 25 26 #file(READ ${CMAKE_CURRENT_SOURCE_DIR}/pfsindcraw.in file_content) 27 #string(REGEX REPLACE "(@BASH_PATH@)" "${BASH_EXECUTABLE}" file_content "${file_content}") 28 #file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pfsindcraw" "${file_content}") 29 30 31 install (FILES "${CMAKE_CURRENT_BINARY_DIR}/pfsin" "${CMAKE_CURRENT_BINARY_DIR}/pfsout" 32 "${CMAKE_CURRENT_BINARY_DIR}/pfsindcraw" 33 PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_WRITE WORLD_READ GROUP_READ OWNER_READ 34 DESTINATION bin) 35 36 install (FILES pfsin.1 DESTINATION ${MAN_DIR}) 37 install (FILES pfsindcraw.1 DESTINATION ${MAN_DIR}) 38 install (FILES pfsout.1 DESTINATION ${MAN_DIR}) 39 40 add_executable(pfsinyuv pfsinyuv.cpp "${GETOPT_OBJECT}") 41 target_link_libraries(pfsinyuv pfs) 42 install (TARGETS pfsinyuv DESTINATION bin) 43 install (FILES pfsinyuv.1 DESTINATION ${MAN_DIR}) 44 45 add_executable(pfsoutyuv pfsoutyuv.cpp "${GETOPT_OBJECT}") 46 target_link_libraries(pfsoutyuv pfs) 47 install (TARGETS pfsoutyuv DESTINATION bin) 48 install (FILES pfsoutyuv.1 DESTINATION ${MAN_DIR}) 49 50 add_executable(pfsinrgbe pfsinrgbe.cpp rgbeio.cpp rgbeio.h "${GETOPT_OBJECT}") 51 target_link_libraries(pfsinrgbe pfs) 52 install (TARGETS pfsinrgbe DESTINATION bin) 53 install (FILES pfsinrgbe.1 DESTINATION ${MAN_DIR}) 54 55 add_executable(pfsoutrgbe pfsoutrgbe.cpp rgbeio.cpp rgbeio.h "${GETOPT_OBJECT}") 56 target_link_libraries(pfsoutrgbe pfs) 57 install (TARGETS pfsoutrgbe DESTINATION bin) 58 install (FILES pfsoutrgbe.1 DESTINATION ${MAN_DIR}) 59 60 add_executable(pfsinpfm pfsinpfm.cpp "${GETOPT_OBJECT}") 61 target_link_libraries(pfsinpfm pfs) 62 install (TARGETS pfsinpfm DESTINATION bin) 63 install (FILES pfsinpfm.1 DESTINATION ${MAN_DIR}) 64 65 add_executable(pfsoutpfm pfsoutpfm.cpp "${GETOPT_OBJECT}") 66 target_link_libraries(pfsoutpfm pfs) 67 install (TARGETS pfsoutpfm DESTINATION bin) 68 install (FILES pfsoutpfm.1 DESTINATION ${MAN_DIR}) 69 70 if( OPENEXR_FOUND ) 71 include_directories("${OPENEXR_INCLUDE_DIR}") 72 73 add_executable(pfsinexr pfsinexr.cpp "${GETOPT_OBJECT}") 74 target_link_libraries(pfsinexr pfs ${OPENEXR_LIBRARIES}) 75 install (TARGETS pfsinexr DESTINATION bin) 76 install (FILES pfsinexr.1 DESTINATION ${MAN_DIR}) 77 78 add_executable(pfsoutexr pfsoutexr.cpp "${GETOPT_OBJECT}") 79 target_link_libraries(pfsoutexr pfs ${OPENEXR_LIBRARIES}) 80 install (TARGETS pfsoutexr DESTINATION bin) 81 install (FILES pfsoutexr.1 DESTINATION ${MAN_DIR}) 82 endif( OPENEXR_FOUND ) 83 84 if( ImageMagick_FOUND ) 85 include_directories(${ImageMagick_INCLUDE_DIRS}) 86 add_executable(pfsinimgmagick pfsinimgmagick.cpp "${GETOPT_OBJECT}") 87 target_link_libraries(pfsinimgmagick pfs ${ImageMagick_LIBRARIES}) 88 install (TARGETS pfsinimgmagick DESTINATION bin) 89 install (FILES pfsinimgmagick.1 DESTINATION ${MAN_DIR}) 90 set_target_properties(pfsinimgmagick PROPERTIES COMPILE_FLAGS "-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16") 91 92 add_executable(pfsoutimgmagick pfsoutimgmagick.cpp "${GETOPT_OBJECT}") 93 target_link_libraries(pfsoutimgmagick pfs ${ImageMagick_LIBRARIES}) 94 install (TARGETS pfsoutimgmagick DESTINATION bin) 95 install (FILES pfsoutimgmagick.1 DESTINATION ${MAN_DIR}) 96 set_target_properties(pfsoutimgmagick PROPERTIES COMPILE_FLAGS "-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16") 97 98 endif( ImageMagick_FOUND ) 99 100 if( NETPBM_FOUND ) 101 102 include_directories(${NETPBM_INCLUDE_DIR}) 103 104 add_executable(pfsinppm pfsinppm.cpp ppmio.cpp "${GETOPT_OBJECT}") 105 target_link_libraries(pfsinppm pfs ${NETPBM_LIBRARIES}) 106 install (TARGETS pfsinppm DESTINATION bin) 107 install (FILES pfsinppm.1 DESTINATION ${MAN_DIR}) 108 109 add_executable(pfsoutppm pfsoutppm.cpp ppmio.cpp "${GETOPT_OBJECT}") 110 target_link_libraries(pfsoutppm pfs ${NETPBM_LIBRARIES}) 111 install (TARGETS pfsoutppm DESTINATION bin) 112 install (FILES pfsoutppm.1 DESTINATION ${MAN_DIR}) 113 114 endif( NETPBM_FOUND ) 115 116 if( TIFF_FOUND ) 117 118 include_directories(${TIFF_INCLUDE_DIR}) 119 120 add_executable(pfsintiff pfsintiff.cpp hdrtiffio.cpp "${GETOPT_OBJECT}") 121 target_link_libraries(pfsintiff pfs ${TIFF_LIBRARY}) 122 install (TARGETS pfsintiff DESTINATION bin) 123 install (FILES pfsintiff.1 DESTINATION ${MAN_DIR}) 124 125 add_executable(pfsouttiff pfsouttiff.cpp hdrtiffio.cpp "${GETOPT_OBJECT}") 126 target_link_libraries(pfsouttiff pfs ${TIFF_LIBRARY}) 127 install (TARGETS pfsouttiff DESTINATION bin) 128 install (FILES pfsoutppm.1 DESTINATION ${MAN_DIR} RENAME pfsouttiff.1) 129 130 endif( TIFF_FOUND ) 131 132