Skip to content

Commit

Permalink
Provide package config
Browse files Browse the repository at this point in the history
This helps the development of other programs using luv.

`make BUILD_MODULE=0 install` will install libluv.a and libluv.pc
  • Loading branch information
zhaozg committed Jul 2, 2019
1 parent 447600d commit df03f2a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -201,6 +201,14 @@ if (CMAKE_INSTALL_PREFIX)
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
)
if (NOT BUILD_MODULE)
if(UNIX)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(includedir ${INSTALL_INC_DIR})
set(libdir ${INSTALL_LIB_DIR})
configure_file(libluv.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libluv.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libluv.pc
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig)
endif()
install(
FILES src/luv.h src/util.h src/lhandle.h src/lreq.h
DESTINATION "${INSTALL_INC_DIR}"
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -43,6 +43,9 @@ luv: build/Makefile
cmake --build build --config Debug
ln -sf build/luv.so

install: luv
make -C build install

clean:
rm -rf build luv.so

Expand Down
12 changes: 12 additions & 0 deletions libluv.pc.in
@@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=${prefix}
libdir=@libdir@
includedir=@includedir@

Name: libluv
Version: @LUV_VERSION@
Description: Bare and full libuv bindings for Lua/LuaJIT.
URL: https://github.com/luvit/luv

Libs: -L${libdir} -lluv @LIBS@
Cflags: -I${includedir}

0 comments on commit df03f2a

Please sign in to comment.