Skip to content

Commit a72a053

Browse files
authored
fix installing via cmake (#374)
1 parent 9675f2b commit a72a053

25 files changed

Lines changed: 478 additions & 186 deletions

.cmake-format

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
format:
2+
tab_size: 2
3+
line_width: 100
4+
dangle_parens: true
5+
6+
parse:
7+
additional_commands:
8+
cpmaddpackage:
9+
pargs:
10+
nargs: '*'
11+
flags: []
12+
spelling: CPMAddPackage
13+
kwargs: &cpmaddpackagekwargs
14+
NAME: 1
15+
FORCE: 1
16+
VERSION: 1
17+
GIT_TAG: 1
18+
DOWNLOAD_ONLY: 1
19+
GITHUB_REPOSITORY: 1
20+
GITLAB_REPOSITORY: 1
21+
GIT_REPOSITORY: 1
22+
SVN_REPOSITORY: 1
23+
SVN_REVISION: 1
24+
SOURCE_DIR: 1
25+
DOWNLOAD_COMMAND: 1
26+
FIND_PACKAGE_ARGUMENTS: 1
27+
NO_CACHE: 1
28+
GIT_SHALLOW: 1
29+
URL: 1
30+
URL_HASH: 1
31+
URL_MD5: 1
32+
DOWNLOAD_NAME: 1
33+
DOWNLOAD_NO_EXTRACT: 1
34+
HTTP_USERNAME: 1
35+
HTTP_PASSWORD: 1
36+
OPTIONS: +
37+
cpmfindpackage:
38+
pargs:
39+
nargs: '*'
40+
flags: []
41+
spelling: CPMFindPackage
42+
kwargs: *cpmaddpackagekwargs
43+
packageproject:
44+
pargs:
45+
nargs: '*'
46+
flags: []
47+
spelling: packageProject
48+
kwargs:
49+
NAME: 1
50+
VERSION: 1
51+
NAMESPACE: 1
52+
INCLUDE_DIR: 1
53+
INCLUDE_DESTINATION: 1
54+
BINARY_DIR: 1
55+
COMPATIBILITY: 1
56+
VERSION_HEADER: 1
57+
DEPENDENCIES: +
58+

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
build*/
2+
.cache/
3+
.git/
4+
.github/
5+
compile_commands.json
6+
.dockerignore
7+
Dockerfile
8+
install_dir/
9+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ubuntu_test_installed_version.yml
2+
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
branches:
11+
- master
12+
- main
13+
14+
env:
15+
CTEST_OUTPUT_ON_FAILURE: 1
16+
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- uses: actions/cache@v3
26+
with:
27+
path: "**/cpm_modules"
28+
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
29+
30+
- name: install library
31+
run: |
32+
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release --log-level=DEBUG -DCMAKE_INSTALL_PREFIX=./install_dir
33+
cmake --build ./build -j$(nproc)
34+
cmake --install ./build --prefix ./install_dir
35+
rm -rf build
36+
37+
- name: configure with installed version via cmake
38+
run: CMAKE_PREFIX_PATH="./install_dir" cmake -S. -Bbuild2 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION=1 --log-level=DEBUG
39+
40+
- name: build with installed version via cmake
41+
run: cmake --build build2 --config Debug -j$(nproc) --verbose
42+
43+
- name: test
44+
run: |
45+
cd build2
46+
ctest --build-config Debug -j$(nproc)
47+
48+
- name: clear
49+
run: rm -rf build2
50+
51+
- name: configure with installed version via pkgconfig
52+
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
53+
54+
- name: build with installed version via pkgconfig
55+
run: cmake --build build3 --config Debug -j$(nproc) --verbose
56+
57+
- name: test
58+
run: |
59+
cd build3
60+
ctest --build-config Debug -j$(nproc)

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
build/
1+
build*/
2+
cmake_build*/
3+
install_dir/
24
.vscode/
35
.vs/
46

BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ package(default_visibility = ["//visibility:public"])
77
cc_library(
88
name = "magic_enum",
99
hdrs = glob(["include/magic_enum/*.hpp"]),
10-
includes = ["include/magic_enum"],
10+
includes = ["include"],
1111
)

0 commit comments

Comments
 (0)