CMAKE_MINIMUM_REQUIRED(VERSION 2.8) macro(ADD_EXAMPLE FOLDER TARGET) include_directories(${PROJECT_SOURCE_DIR}/examples/cpp-utils) if(EXISTS ${PROJECT_SOURCE_DIR}/examples/${FOLDER}/train_${TARGET}.cc) add_executable(${TARGET} ${FOLDER}/train_${TARGET}.cc) elseif(EXISTS ${PROJECT_SOURCE_DIR}/examples/${FOLDER}/${TARGET}.cc) add_executable(${TARGET} ${FOLDER}/${TARGET}.cc) else() message( SEND_ERROR "Neither ${FOLDER}/train_${TARGET}.cc or ${FOLDER}/${TARGET}.cc does exist!" ) endif() target_link_libraries(${TARGET} dynet ${LIBS}) if (WITH_CUDA_BACKEND) CUDA_ADD_CUBLAS_TO_TARGET(${TARGET}) endif (WITH_CUDA_BACKEND) if(UNIX AND NOT APPLE) target_link_libraries(${TARGET} rt) endif() endmacro(ADD_EXAMPLE) ADD_EXAMPLE(autobatch rnn-autobatch) ADD_EXAMPLE(autobatch xor-autobatch) ADD_EXAMPLE(batching rnnlm-batch) ADD_EXAMPLE(batching xor-batch) ADD_EXAMPLE(document-classification imdb) ADD_EXAMPLE(fflm fflm) ADD_EXAMPLE(mnist mnist) ADD_EXAMPLE(noise-contrastive-estimation rnnlm-batch-nce) ADD_EXAMPLE(poisson-regression poisson-regression) ADD_EXAMPLE(read-write read-write) ADD_EXAMPLE(rnnlm rnnlm) # This is commented out because it was out of date and needs to be updated to work with recent DyNet # ADD_EXAMPLE(segmental-rnn segrnn-sup) ADD_EXAMPLE(sentence-embedding embed-cl) ADD_EXAMPLE(sequence-to-sequence attention) ADD_EXAMPLE(sequence-to-sequence encdec) ADD_EXAMPLE(softmax-builders rnnlm-cfsm) ADD_EXAMPLE(tagger tag-bilstm) # This is commented out because it was out of date and needs to be updated to work with recent DyNet # ADD_EXAMPLE(textcat textcat) ADD_EXAMPLE(variational-autoencoder rnnlm-aevb) ADD_EXAMPLE(word-embedding tok-embed) ADD_EXAMPLE(xor xor) ADD_EXAMPLE(devices/xor-multidevice xor-multidevice) if(ENABLE_BOOST) if(NOT MSVC) ADD_EXAMPLE(multiprocessing rnnlm-mp) ADD_EXAMPLE(multiprocessing xor-mp) ADD_EXAMPLE(multiprocessing xor-simple-mp) endif() ADD_EXAMPLE(transformer transformer-train) ADD_EXAMPLE(transformer transformer-decode) endif()