Skip to content

Commit

Permalink
improve cmake install dirs (#1721)
Browse files Browse the repository at this point in the history
* Use cmake's GNUInstallDirs to get the lib, bin and include directory
  names instead of always using 'lib', 'bin', and 'include'.  This 
  results in two changes to the installation:

  - lib directory becomes 'lib64' on platforms where this is the
    convention

  - the lib, bin and include may be overwritten using the cmake 
    variables CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_LIBDIR and
    CMAKE_INSTALL_INCLUDEDIR respectively

* Update github workflows to handle the lib install dir lib64:

  - use Dyninst_ROOT instead of Dyninst_DIR as it searches for the
    directory used

  - for non-cmake uses search for lib* to find either lib or lib64
  • Loading branch information
kupsch committed Apr 9, 2024
1 parent cfa91d0 commit e70b100
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/consumers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Make symlinks
run: |
ln -s /dyninst/install/include /usr/include/dyninst
ln -s /dyninst/install/lib /usr/lib64/dyninst
ln -s /dyninst/install/lib* /usr/lib64/dyninst
- name: Build systemtap
run: |
cd systemtap
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Build testsuite
run: |
cd testsuite; mkdir build; cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst
cmake .. -DDyninst_ROOT=/dyninst/install
cmake --build . --parallel 2
- name: Checkout Examples
Expand All @@ -80,7 +80,7 @@ jobs:
- name: Build examples
run: |
cd examples; mkdir build; cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst
cmake .. -DDyninst_ROOT=/dyninst/install
cmake --build . --parallel 2
- name: Checkout External Tests
Expand All @@ -92,7 +92,7 @@ jobs:
- name: Build external tests
run: |
cd external-tests; mkdir build; cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst
cmake .. -DDyninst_ROOT=/dyninst/install
cmake --build . --parallel 2
- name: Run tests
run: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/system-libs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@ jobs:
cd external-tests
mkdir build
cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst
cmake .. -DDyninst_ROOT=/dyninst/install
cmake --build .
cp parseAPI/simpleParser /
- name: Run parser
run: |
set -e
cd /
export LD_LIBRARY_PATH=/dyninst/install/lib:$LD_LIBRARY_PATH
LIB_DIRS=( /dyninst/install/lib* $LD_LIBRARY_PATH )
FIRST_DIR=${LIB_DIRS[0]}
unset LIB_DIRS[0]
# join first dir with subsequent dirs prepended with :
export LD_LIBRARY_PATH="${FIRST_DIR}${LIB_DIRS[*]/#/:}"
for dir in /usr/lib /usr/lib64; do \
for file in $(find $dir -type f -name "*.so.*"); do \
echo $file; \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Build unit tests
run: |
cd unit-tests; mkdir build; cd build
cmake .. -DDyninst_DIR=/dyninst/install/lib/cmake/Dyninst -DDYNINST_SOURCE_TREE=/dyninst/src
cmake .. -DDyninst_ROOT=/dyninst/install -DDYNINST_SOURCE_TREE=/dyninst/src
cmake --build . --parallel 2
- name: Run unit tests
Expand Down
7 changes: 4 additions & 3 deletions cmake/DyninstLibrarySettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ else()
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
endif()

set(DYNINST_INSTALL_BINDIR "bin")
set(DYNINST_INSTALL_LIBDIR "lib")
set(DYNINST_INSTALL_INCLUDEDIR "include")
include(GNUInstallDirs)
set(DYNINST_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}")
set(DYNINST_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
set(DYNINST_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(DYNINST_INSTALL_CMAKEDIR "${DYNINST_INSTALL_LIBDIR}/cmake/Dyninst")

# -- Set up the RPATH ---
Expand Down
2 changes: 1 addition & 1 deletion parseThat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ target_link_libraries(parseThat PRIVATE dyninstAPI)
target_include_directories(parseThat BEFORE
PRIVATE "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/common/h>")

install(TARGETS parseThat RUNTIME DESTINATION bin)
install(TARGETS parseThat RUNTIME DESTINATION "${DYNINST_INSTALL_BINDIR}")

0 comments on commit e70b100

Please sign in to comment.