From 3c5e0c0e2a6a398312edaf7297473677b052280e Mon Sep 17 00:00:00 2001 From: Vlad Niculae Date: Wed, 17 Apr 2019 16:39:24 +0100 Subject: [PATCH] generate CMake config and targets --- CMakeLists.txt | 7 ++++++- dynet/CMakeLists.txt | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1b0061ce..cfc239394 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,7 @@ if (MKL OR MKL_ROOT) endif() # There are about 30 files compiled for GPU. We merge them into less -# for faster compilation. Set to 0 to mean no merging, or k to merge into k files. +# for faster compilation. Set to 0 to mean no merging, or k to merge into k files. if(NOT DEFINED GPU_NUMFILES) if(MSVC) set(GPU_NUMFILES 1) # MSVC does serial compilation of CUDA, so minimize overhead @@ -217,3 +217,8 @@ if(ENABLE_BOOST) add_subdirectory(tests) enable_testing() endif() + +export(TARGETS dynet NAMESPACE Dynet:: FILE DynetTargets.cmake) +export(PACKAGE Dynet) +file(WRITE ${CMAKE_BINARY_DIR}/DynetConfig.cmake + include(\"\${CMAKE_CURRENT_LIST_DIR}/DynetTargets.cmake\")) diff --git a/dynet/CMakeLists.txt b/dynet/CMakeLists.txt index cb3fab7e2..e21ecb25c 100644 --- a/dynet/CMakeLists.txt +++ b/dynet/CMakeLists.txt @@ -163,7 +163,7 @@ weight-decay.h if(ENABLE_BOOST) list(APPEND dynet_library_HDRS mp.h) endif() - + set(dynet_gpu_mergeable_SRCS nodes-activations nodes-affinetransform @@ -302,6 +302,9 @@ else() target_link_libraries(dynet ${LIBS}) endif(WITH_CUDA_BACKEND) +set_property(TARGET dynet APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES + $) + install(FILES ${dynet_library_HDRS} DESTINATION include/dynet) install(TARGETS dynet DESTINATION lib) if(WITH_CUDA_BACKEND) @@ -309,3 +312,4 @@ if(WITH_CUDA_BACKEND) endif(WITH_CUDA_BACKEND) # target_compile_features(dynet PRIVATE cxx_range_for) +