Skip to content

Commit ddb5440

Browse files
kenhysfacebook-github-bot
authored andcommittedApr 28, 2020
cmake: generate fasttext.pc for pkg-config (facebookresearch#916)
Summary: Closes: facebookresearch#915 Pull Request resolved: facebookresearch#916 Reviewed By: EdouardGrave, tscmoo Differential Revision: D17737706 Pulled By: Celebio fbshipit-source-id: 8ee38ee0430e08260d498f446c4475ee4ad62629
1 parent 64a946b commit ddb5440

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ set(SOURCE_FILES
4949
src/utils.cc
5050
src/vector.cc)
5151

52+
53+
if (NOT MSVC)
54+
include(GNUInstallDirs)
55+
configure_file("fasttext.pc.in" "fasttext.pc" @ONLY)
56+
install(FILES "${CMAKE_BINARY_DIR}/fasttext.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
57+
endif()
58+
5259
add_library(fasttext-shared SHARED ${SOURCE_FILES} ${HEADER_FILES})
5360
add_library(fasttext-static STATIC ${SOURCE_FILES} ${HEADER_FILES})
5461
add_library(fasttext-static_pic STATIC ${SOURCE_FILES} ${HEADER_FILES})

‎fasttext.pc.in

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=@CMAKE_INSTALL_FULL_LIBEXECDIR@
3+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
4+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
5+
6+
Name: @PROJECT_NAME@
7+
Description: Efficient learning of word representations and sentence classification
8+
Version: @PROJECT_VERSION@
9+
Libs: -L${libdir} -lfasttext
10+
Cflags: -I${includedir}

0 commit comments

Comments
 (0)