Skip to content

Commit

Permalink
fix: allow pkg-config file to be correctly configured when CMAKE_INST…
Browse files Browse the repository at this point in the history
…ALL_{INCLUDE,LIB}DIR is absolute.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP committed Dec 7, 2022
1 parent 38ef569 commit 94fb3c6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Extra/libmodule.pc.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=@libdir_pc@
includedir=@includedir_pc@

Name: lib@PKG_TARGET@
Description: @PKG_DESC@
Expand Down
6 changes: 6 additions & 0 deletions Lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required (VERSION 3.3.2)

include(GNUInstallDirs)
include(JoinPaths)

option(STATIC_MODULE "build ${PROJECT_NAME} as static library" OFF)
if(STATIC_MODULE)
set(LIBRARY_TYPE STATIC)
Expand Down Expand Up @@ -33,6 +36,9 @@ macro(fill_pc_vars target desc)
endif()
endmacro()

join_paths(libdir_pc "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(includedir_pc "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")

include(Lib/core/CMakeLists.txt)

# Some pretty printings
Expand Down
11 changes: 10 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
- [x] Fix build on bsd
- [x] Fix libmodule_thpool.pc (-l-pthread)
- [x] Move core/utils.c under utils_internal library
- [ ] Store callback to be called when an event is retrieved directly inside event source?
Ctx main loop would just become:
```
ev_src_t *p = poll_recv(&c->ppriv, i);
if (p) {
p->process(p, msg);
}
```
It would also be much easier to add context private/specific events (like the fuse fd in FS, or a token bucket timer)

### Logging

Expand All @@ -24,7 +33,7 @@

### Ctx

- [ ] Add a ctx tokenbucket API that will basically force ctx events to be below requested rate/burst?
- [ ] Add a ctx tokenbucket API that will basically force ctx events to be below requested rate/burst? (https://github.com/osrg/openvswitch/blob/master/lib/token-bucket.c) super easy without any timer, everything computed in place (or use a ctx private timer src?)

#### DOC

Expand Down
27 changes: 27 additions & 0 deletions cmake/JoinPaths.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This module provides function for joining paths
# known from from most languages
#
# Original license:
# SPDX-License-Identifier: (MIT OR CC0-1.0)
# Explicit permission given to distribute this module under
# the terms of the project as described in /LICENSE.rst.
# Copyright 2020 Jan Tojnar
# https://github.com/jtojnar/cmake-snips
#
# Modelled after Python’s os.path.join
# https://docs.python.org/3.7/library/os.path.html#os.path.join
# Windows not supported
# Thanks to https://github.com/jtojnar/fmt author.
function(join_paths joined_path first_path_segment)
set(temp_path "${first_path_segment}")
foreach(current_segment IN LISTS ARGN)
if(NOT ("${current_segment}" STREQUAL ""))
if(IS_ABSOLUTE "${current_segment}")
set(temp_path "${current_segment}")
else()
set(temp_path "${temp_path}/${current_segment}")
endif()
endif()
endforeach()
set(${joined_path} "${temp_path}" PARENT_SCOPE)
endfunction()

0 comments on commit 94fb3c6

Please sign in to comment.