SET ( EXECUTABLES oggSplit oggDump oggJoin oggCut oggLength oggCat oggSlideshow
      oggTranscode oggThumb oggSilence )

SET ( LIBRARY_SRC effector.cpp crossfader.cpp crossfader.cpp
				  mediaUnit.cpp mediaRepository.cpp fileRepository.cpp
                  rawMediaPacket.cpp mediaDecoder.cpp mediaEncoder.cpp
                  mediaConverter.cpp oggDecoder.cpp oggStreamDecoder.cpp
                  oggPage.cpp oggPacket.cpp ringbuffer.cpp
                  oggRingbuffer.cpp crc.cpp granulePosInterpreter.cpp
                  mediaOutputDecoder.cpp mediaInputEncoder.cpp
                  streamSerializer.cpp oggBOSExtractorFactory.cpp
                  oggStreamEncoder.cpp oggEncoder.cpp streamExtractor.cpp
                  streamParameter.cpp streamMux.cpp bufferRepository.cpp
                  oggComment.cpp
                  theoraPosInterpreter.cpp theoraStreamParameter.cpp
                  theoraExtractor.cpp
                  vorbisPosInterpreter.cpp vorbisStreamParameter.cpp
                  vorbisExtractor.cpp
                  cmdlineextractor.cpp basePlane.cpp rgbPlane.cpp
                  blendElement.cpp
                  katePosInterpreter.cpp kateStreamParameter.cpp
                  kateExtractor.cpp
                  effector.cpp crossfader.cpp plainPicture.cpp
                  lowpassEffect.cpp kenburnseffect.cpp
              pictureResize.cpp pictureBlend.cpp pictureLoader.cpp
                  hookHandler.cpp videoHook.cpp audioHook.cpp
                  vorbisDecoder.cpp vorbisEncoder.cpp audioPacket.cpp
                  audioConverter.cpp theoraDecoder.cpp theoraEncoder.cpp
          helper.cpp log.cpp
    )

SET ( RESAMPLE_SRC libresample/filterkit.c libresample/resample.c
      libresample/resamplesubs.c )


# These are the
SET ( CODER_LIBRARY_SRC theoraDecoder.cpp theoraEncoder.cpp
                        vorbisDecoder.cpp vorbisEncoder.cpp
                        audioPacket.cpp audioConverter.cpp
    )

SET ( HEADER 
exception.h
effector.h 
crossfader.h 
crossfader.h
mediaUnit.h 
mediaRepository.h 
fileRepository.h
rawMediaPacket.h 
mediaDecoder.h 
mediaEncoder.h
mediaConverter.h 
oggDecoder.h 
oggStreamDecoder.h
oggPage.h 
oggPacket.h 
ringbuffer.h
oggRingbuffer.h 
crc.h 
granulePosInterpreter.h
mediaOutputDecoder.h 
mediaInputEncoder.h
streamSerializer.h 
oggBOSExtractorFactory.h
oggStreamEncoder.h 
oggEncoder.h 
streamExtractor.h
streamParameter.h 
streamMux.h 
bufferRepository.h
oggComment.h
theoraPosInterpreter.h 
theoraStreamParameter.h
theoraExtractor.h
vorbisPosInterpreter.h 
vorbisStreamParameter.h
vorbisExtractor.h
cmdlineextractor.h 
basePlane.h 
rgbPlane.h
blendElement.h
katePosInterpreter.h 
kateStreamParameter.h
kateExtractor.h
effector.h 
crossfader.h 
plainPicture.h
lowpassEffect.h 
kenburnseffect.h
pictureResize.h 
pictureBlend.h 
pictureLoader.h
hookHandler.h 
videoHook.h 
audioHook.h
vorbisDecoder.h 
vorbisEncoder.h 
audioPacket.h
audioConverter.h 
theoraDecoder.h 
theoraEncoder.h
helper.h 
log.h
refObject.h
definition.h
oggHeader.h
theoraHeader.h
vorbisHeader.h
kateHeader.h
oggTypes.h
streamConfig.h
th_helper.h
wishList.h
)

# ADD_DEFINITIONS ( -DDEBUG )

INCLUDE_DIRECTORIES ( ${THEORADEC_INCLUDE_DIRS} ${THEORAENC_INCLUDE_DIRS}
                      ${VORBIS_INCLUDE_DIRS} ${VORBISENC_INCLUDE_DIRS}
                      ${OGG_INCLUDE_DIRS} ${GD_INCLUDE_DIRS} )

IF ( $ENV{MAKE_PACKAGE} )
  ADD_LIBRARY ( oggvideotools STATIC ${LIBRARY_SRC} ${RESAMPLE_SRC} )
ELSE ( $ENV{MAKE_PACKAGE} )
  ADD_LIBRARY ( oggvideotools SHARED ${LIBRARY_SRC} ${RESAMPLE_SRC} )
ENDIF ( $ENV{MAKE_PACKAGE} )
  TARGET_LINK_LIBRARIES ( oggvideotools ${ALL_LIBS})

IF ( $ENV{MAKE_PACKAGE} )
  MESSAGE ( " Creating static Executables ${ALL_STATIC_LIBS}" )
  FOREACH ( exec ${EXECUTABLES} )
    ADD_EXECUTABLE ( ${exec} ${exec}.cpp )
    TARGET_LINK_LIBRARIES ( ${exec} oggvideotools ${ALL_STATIC_LIBS} )
  ENDFOREACH ( exec ${EXECUTABLES} )

  IF ( WIN32 )
    MESSAGE ( "Installing additional library ${GD_EXTERNAL}" )
    INSTALL ( FILES ${GD_EXTERNAL} DESTINATION bin )
	INSTALL ( FILES ${CMAKE_SOURCE_DIR}/win32/GD-COPYING.TXT DESTINATION doc )
  ENDIF ( WIN32 )

ELSE ( $ENV{MAKE_PACKAGE} )

  MESSAGE ( "Libraries are: ${ALL_LIBS}" )
  FOREACH ( exec ${EXECUTABLES} )
    ADD_EXECUTABLE ( ${exec} ${exec}.cpp )
    TARGET_LINK_LIBRARIES ( ${exec} oggvideotools )
#    ADD_EXECUTABLE ( ${exec}_static ${exec}.cpp ${LIBRARY_SRC} ${RESAMPLE_SRC} )
#    TARGET_LINK_LIBRARIES ( ${exec}_static ${ALL_LIBS} ) 
  ENDFOREACH ( exec ${EXECUTABLES} )
   
ENDIF ( $ENV{MAKE_PACKAGE} )

INSTALL ( TARGETS ${EXECUTABLES} DESTINATION bin )
INSTALL ( TARGETS oggvideotools DESTINATION lib )
INSTALL ( FILES ${HEADER} DESTINATION include/oggvt )

