Skip to content

Commit

Permalink
Merge pull request #26 from yobeonline/install
Browse files Browse the repository at this point in the history
chaing install targets so that io1-money is installed and not io1.
  • Loading branch information
yobeonline authored Feb 10, 2024
2 parents acbe4cc + 767a39f commit caec244
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 7 deletions.
File renamed without changes.
3 changes: 1 addition & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ jobs:
- uses: actions/checkout@v4

- name: Lint
run: |
clang-tidy-15 lint/lint.cpp --export-fixes=clang-fixes.yaml --header-filter=io1/* -- -Iinclude -std=c++20
run: clang-tidy-15 include/io1/money.hpp --export-fixes=clang-fixes.yaml -- -std=c++20

- name: Process clang-tidy warnings
uses: asarium/clang-tidy-action@v1
Expand Down
29 changes: 28 additions & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,31 @@ jobs:
- name: Publish test report
uses: mikepenz/action-junit-report@v3
with:
report_paths: 'build/junit_*.xml'
report_paths: 'build/test/junit_*.xml'

- name: Install
run: cmake --install build --prefix install --config ${{ matrix.config }}

- name: Configure with install
shell: cmake -P {0}
run: |
if ("${{ matrix.compiler }}" STREQUAL "gcc")
set(ENV{CC} "gcc-13")
set(ENV{CXX} "g++-13")
else()
set(ENV{CC} "clang-15")
set(ENV{CXX} "clang++-15")
endif()
execute_process(
COMMAND cmake
-S test
-B install_build
-D CMAKE_BUILD_TYPE=${{ matrix.config }}
-D "io1-money_DIR=../install/share/io1-money/cmake"
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build with install
run: cmake --build install_build --config ${{ matrix.config }} --parallel
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ write_basic_package_version_file(

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/config.cmake.in" "${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/io1/cmake)
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake)

install(
EXPORT ${PROJECT_NAME}
NAMESPACE io1::
DESTINATION ${CMAKE_INSTALL_DATADIR}/io1/cmake)
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake)

install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
DESTINATION ${CMAKE_INSTALL_DATADIR}/io1/cmake)
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake)

if(IO1_WITH_TESTS)
include(CTest)
Expand Down
1 change: 0 additions & 1 deletion lint/lint.cpp

This file was deleted.

8 changes: 8 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.25)

project(test_io1-money_install LANGUAGES CXX)

find_package(io1-money REQUIRED)

add_library(${PROJECT_NAME} test_install.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE io1::money)
6 changes: 6 additions & 0 deletions test/test_install.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "io1/money.hpp"

io1::money add_twice(io1::money const & lhs, io1::money const & rhs) noexcept
{
return lhs + 2 * rhs;
}

0 comments on commit caec244

Please sign in to comment.