CMakeLists(LSTM-ER-master/cnn/cnn)
1 # ########## cnn library ########## 2 # Sources: 3 set(cnn_library_SRCS 4 cnn.cc 5 conv.cc 6 deep-lstm.cc 7 dict.cc 8 dim.cc 9 exec.cc 10 expr.cc 11 grad-check.cc 12 graph.cc 13 gru.cc 14 init.cc 15 lstm.cc 16 model.cc 17 nodes.cc 18 nodes-common.cc 19 param-nodes.cc 20 rnn.cc 21 rnn-state-machine.cc 22 saxe-init.cc 23 shadow-params.cc 24 tensor.cc 25 training.cc 26 treelstm.cc 27 ) 28 29 # Headers: 30 set(cnn_library_HDRS 31 aligned-mem-pool.h 32 c2w.h 33 cnn.h 34 conv.h 35 cuda.h 36 dict.h 37 dim.h 38 exec.h 39 expr.h 40 functors.h 41 gpu-kernels.h 42 gpu-ops.h 43 graph.h 44 gru.h 45 init.h 46 lstm.h 47 model.h 48 nodes.h 49 param-nodes.h 50 random.h 51 rnn-state-machine.h 52 rnn.h 53 saxe-init.h 54 shadow-params.h 55 tensor.h 56 timing.h 57 training.h 58 treelstm.h 59 ) 60 61 if(WITH_CUDA_BACKEND) 62 list(APPEND cnn_library_SRCS 63 cuda.cc) 64 endif(WITH_CUDA_BACKEND) 65 66 file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cc) 67 68 #foreach(test_src ${TEST_SRCS}) 69 #Extract the filename without an extension (NAME_WE) 70 # get_filename_component(testName ${test_src} NAME_WE) 71 72 #Add compile target 73 # add_executable(${testName} ${test_src}) 74 75 #link to Boost libraries AND your targets and dependencies 76 # target_link_libraries(${testName} cnn ${LIBS}) 77 78 # set_target_properties(${testName} PROPERTIES 79 # RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests.bin) 80 81 #Finally add it to test execution - 82 #Notice the WORKING_DIRECTORY and COMMAND 83 # add_test(NAME ${testName} 84 # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests.bin 85 # COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests.bin/${testName} ) 86 #endforeach(test_src) 87 88 # actual target: 89 add_library(cnn ${cnn_library_SRCS} ${cnn_library_HDRS} ${LIBS}) 90 #add_library(cnn SHARED ${cnn_library_SRCS} ${cnn_library_HDRS} ${LIBS}) 91 if(WITH_CUDA_BACKEND) 92 set(CUDA_SEPARABLE_COMPILATION ON) 93 list(APPEND CUDA_NVCC_FLAGS "-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_52,code=compute_52;-std=c++11;-O2;-DVERBOSE") 94 SET(CUDA_PROPAGATE_HOST_FLAGS OFF) 95 cuda_add_library(cnncuda STATIC gpu-ops.cu) 96 endif(WITH_CUDA_BACKEND) 97 98 install(FILES ${cnn_library_HDRS} DESTINATION include/cnn) 99 install(TARGETS cnn DESTINATION lib) 100 101 # target_compile_features(cnn PRIVATE cxx_range_for)
1-27: 将cnn_library_SRCS设置为由各个.cc文件名组成的list,各个文件名由分号分隔。
29-59: 将cnn_library_HDRS设置为由各个.h文件名组成的list,各个文件名由分号分隔。
后边的看不懂,也找不到资料看,暂时发现这一段来源于clab的lstm-parser。