Skip to content

Commit

Permalink
fix installing via cmake (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arniiiii authored Oct 14, 2024
1 parent 9675f2b commit a72a053
Show file tree
Hide file tree
Showing 25 changed files with 478 additions and 186 deletions.
58 changes: 58 additions & 0 deletions .cmake-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
format:
tab_size: 2
line_width: 100
dangle_parens: true

parse:
additional_commands:
cpmaddpackage:
pargs:
nargs: '*'
flags: []
spelling: CPMAddPackage
kwargs: &cpmaddpackagekwargs
NAME: 1
FORCE: 1
VERSION: 1
GIT_TAG: 1
DOWNLOAD_ONLY: 1
GITHUB_REPOSITORY: 1
GITLAB_REPOSITORY: 1
GIT_REPOSITORY: 1
SVN_REPOSITORY: 1
SVN_REVISION: 1
SOURCE_DIR: 1
DOWNLOAD_COMMAND: 1
FIND_PACKAGE_ARGUMENTS: 1
NO_CACHE: 1
GIT_SHALLOW: 1
URL: 1
URL_HASH: 1
URL_MD5: 1
DOWNLOAD_NAME: 1
DOWNLOAD_NO_EXTRACT: 1
HTTP_USERNAME: 1
HTTP_PASSWORD: 1
OPTIONS: +
cpmfindpackage:
pargs:
nargs: '*'
flags: []
spelling: CPMFindPackage
kwargs: *cpmaddpackagekwargs
packageproject:
pargs:
nargs: '*'
flags: []
spelling: packageProject
kwargs:
NAME: 1
VERSION: 1
NAMESPACE: 1
INCLUDE_DIR: 1
INCLUDE_DESTINATION: 1
BINARY_DIR: 1
COMPATIBILITY: 1
VERSION_HEADER: 1
DEPENDENCIES: +

9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build*/
.cache/
.git/
.github/
compile_commands.json
.dockerignore
Dockerfile
install_dir/

60 changes: 60 additions & 0 deletions .github/workflows/ubuntu_test_installed_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: ubuntu_test_installed_version.yml


on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

env:
CTEST_OUTPUT_ON_FAILURE: 1
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: install library
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release --log-level=DEBUG -DCMAKE_INSTALL_PREFIX=./install_dir
cmake --build ./build -j$(nproc)
cmake --install ./build --prefix ./install_dir
rm -rf build
- name: configure with installed version via cmake
run: CMAKE_PREFIX_PATH="./install_dir" cmake -S. -Bbuild2 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION=1 --log-level=DEBUG

- name: build with installed version via cmake
run: cmake --build build2 --config Debug -j$(nproc) --verbose

- name: test
run: |
cd build2
ctest --build-config Debug -j$(nproc)
- name: clear
run: rm -rf build2

- name: configure with installed version via pkgconfig
run: CMAKE_PREFIX_PATH="./install_dir" cmake -S. -Bbuild3 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION_PKGCONFIG=1 -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=1 --log-level=DEBUG

- name: build with installed version via pkgconfig
run: cmake --build build3 --config Debug -j$(nproc) --verbose

- name: test
run: |
cd build3
ctest --build-config Debug -j$(nproc)
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build/
build*/
cmake_build*/
install_dir/
.vscode/
.vs/

Expand Down
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ package(default_visibility = ["//visibility:public"])
cc_library(
name = "magic_enum",
hdrs = glob(["include/magic_enum/*.hpp"]),
includes = ["include/magic_enum"],
includes = ["include"],
)
Loading

0 comments on commit a72a053

Please sign in to comment.