Skip to content

Commit

Permalink
generate CMake config and targets
Browse files Browse the repository at this point in the history
  • Loading branch information
vene committed Apr 17, 2019
1 parent e5a1116 commit 3c5e0c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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\"))
6 changes: 5 additions & 1 deletion dynet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -302,10 +302,14 @@ else()
target_link_libraries(dynet ${LIBS})
endif(WITH_CUDA_BACKEND)

set_property(TARGET dynet APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>)

install(FILES ${dynet_library_HDRS} DESTINATION include/dynet)
install(TARGETS dynet DESTINATION lib)
if(WITH_CUDA_BACKEND)
install(TARGETS dynet DESTINATION lib)
endif(WITH_CUDA_BACKEND)

# target_compile_features(dynet PRIVATE cxx_range_for)

0 comments on commit 3c5e0c0

Please sign in to comment.