refactor: simplify CI configuration and enhance CMake installation rules
Some checks failed
CI / build (pull_request) Failing after 12s
Some checks failed
CI / build (pull_request) Failing after 12s
This commit is contained in:
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -16,9 +16,7 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Cache and install APT packages
|
- name: Cache and install APT packages
|
||||||
uses: awalsh128/cache-apt-pkgs-action@v1
|
run: sudo apt update && sudo apt install cmake build-essential
|
||||||
with:
|
|
||||||
packages: cmake build-essential
|
|
||||||
|
|
||||||
- name: Configure project
|
- name: Configure project
|
||||||
run: make configure
|
run: make configure
|
||||||
@@ -36,6 +34,3 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ls -la ${{ runner.temp }}/install/lib/
|
ls -la ${{ runner.temp }}/install/lib/
|
||||||
ls -la ${{ runner.temp }}/install/include/
|
ls -la ${{ runner.temp }}/install/include/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
# Library Configuration
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
|
||||||
|
# Library Configuration
|
||||||
add_library(dynamic_array INTERFACE)
|
add_library(dynamic_array INTERFACE)
|
||||||
target_include_directories(dynamic_array INTERFACE
|
target_include_directories(dynamic_array INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
set_target_properties(dynamic_array PROPERTIES PUBLIC_HEADER dynamic_array.h)
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
||||||
|
|
||||||
|
# Install the library to a specific directory (e.g., 'lib') relative to the install prefix
|
||||||
|
install(TARGETS dynamic_array
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # Installs shared libs to <prefix>/lib
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # Installs static libs to <prefix>/lib
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # Installs associated executables to <prefix>/bin
|
||||||
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # Installs headers to <prefix>/include
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Install the exported target and public header
|
|
||||||
install(TARGETS dynamic_array)
|
|
||||||
install(FILES dynamic_array.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
||||||
|
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
|
|
||||||
add_executable(test_dynamic_array test_dynamic_array.c)
|
add_executable(test_dynamic_array test_dynamic_array.c)
|
||||||
target_link_libraries(test_dynamic_array PRIVATE dynamic_array unity::framework)
|
target_link_libraries(test_dynamic_array PRIVATE dynamic_array unity::framework)
|
||||||
|
|
||||||
|
|
||||||
add_test(NAME test_dynamic_array COMMAND test_dynamic_array)
|
add_test(NAME test_dynamic_array COMMAND test_dynamic_array)
|
||||||
Reference in New Issue
Block a user