Skip to content

Commit e283526

Browse files
committed
integrate verbm
1 parent ab78a1f commit e283526

File tree

15 files changed

+82
-416
lines changed

15 files changed

+82
-416
lines changed

.clangd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Diagnostics:
2+
UnusedIncludes: Strict

.github/ISSUE_TEMPLATE/sweep-template.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/bump.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: bump
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
bump:
12+
runs-on: ubuntu-latest
13+
if: ${{ ! startsWith(github.event.head_commit.message, 'Version bumped') }}
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
ref: main
20+
fetch-depth: 0 # we need all history to get tags and analyze commits
21+
22+
- run: |
23+
git config user.name "Maxim Voloshin"
24+
git config user.email "[email protected]"
25+
26+
- name: Install verbm
27+
run: pipx install verbm
28+
29+
- name: Bump version
30+
run: verbm up auto --commit --tag --push

.github/workflows/cmake.yml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,27 @@ on:
77
branches: [main]
88
workflow_dispatch: {}
99

10-
env:
11-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
12-
BUILD_TYPE: Release
13-
1410
jobs:
1511
build:
16-
# The CMake configure and build commands are platform agnostic and should work equally
17-
# well on Windows or Mac. You can convert this to a matrix build if you need
18-
# cross-platform coverage.
19-
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
2012
runs-on: ubuntu-22.04
2113

2214
steps:
23-
- name: Checkout repository
24-
uses: actions/checkout@v2
25-
26-
# - name: Get version
27-
# run: echo "VERSION=$(python ./version.py get -f vcpkg.json)" >> $GITHUB_ENV
15+
- name: Checkout
16+
uses: actions/checkout@v4
2817

2918
- name: Configure CMake
30-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
31-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
3219
run: >
33-
cmake -B ${{ github.workspace }}/build
34-
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
35-
36-
- name: Install generator
37-
run: |
38-
wget -O gen.zip https://github.com/chocolacula/easy_reflection_cpp/releases/download/3.0.0/er_gen-ubuntu22-x64.zip
39-
unzip gen.zip -d output
40-
chmod +x output/er_gen
20+
mkdir build && cd build &&
21+
cmake ..
22+
-DCMAKE_BUILD_TYPE:STRING=Release
23+
-DENABLE_GENERATOR:STRING=ON
24+
-DLLVM_TARGETS_TO_BUILD:STRING=X86
4125
4226
- name: Build
43-
run: cmake --build ./build -j $(grep -c 'processor' /proc/cpuinfo) -t tests
27+
run: >
28+
cmake --build ./build -j 2
29+
-t er_gen tests
4430
4531
- name: Test
46-
working-directory: ${{ github.workspace }}/build
32+
working-directory: ./build
4733
run: ctest --rerun-failed --output-on-failure

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
.idea
22
.vs
33
.cache
4-
.DS_Store
4+
55
output
66
cmake-build*
77
build
88

99
example/generated
1010
tests/generated
1111
benchmarks/generated
12+
13+
.DS_Store

CMakeLists.txt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ set_policies()
66

77
set(CMAKE_TOOLCHAIN_FILE vcpkg/scripts/buildsystems/vcpkg.cmake)
88

9-
# Get version from vcpkg.json manifest
10-
file(READ "${CMAKE_SOURCE_DIR}/vcpkg.json" VCPKG_MANIFEST_JSON)
11-
12-
string(JSON
13-
VCPKG_MANIFEST_PROJECT_VERSION
14-
ERROR_VARIABLE VCPKG_VERSION_ERROR
15-
GET ${VCPKG_MANIFEST_JSON} "version")
16-
17-
if(VCPKG_VERSION_ERROR)
18-
message(WARNING ${VCPKG_VERSION_ERROR})
19-
set(VCPKG_MANIFEST_PROJECT_VERSION "0.0.0")
20-
endif()
21-
229
# Enable vcpkg features
2310
option(ENABLE_TESTS "Enable tests" ON)
2411
option(ENABLE_GENERATOR "Enable generator" OFF)
@@ -35,13 +22,12 @@ if(ENABLE_BENCHMARKS)
3522
endif()
3623

3724
# Setup project
38-
project(easy_reflection VERSION ${VCPKG_MANIFEST_PROJECT_VERSION})
25+
project(easy_reflection VERSION 0.1.0)
3926

4027
set(CMAKE_CXX_STANDARD 17)
4128
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
4229
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
4330

44-
include(Dart)
4531
enable_testing()
4632

4733
add_subdirectory(library)

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It parses C++ source code for special attributes. In the most straightforward si
88
The main idea is to use kinda dynamic typing for some type agnostic operations, like copying or getting the name of a type.
99
It makes it possible to determine a variable type and do the right job - print, serialize/deserialize.
1010

11-
If you are curious about the details of how it works you can find them in [DEV article](https://dev.to/chocolacula/how-to-write-reflection-for-c-4527).
11+
It's generally a proof of concept, created with the idea that it could be used for many years. If you are curious about the details of how it works, you can find them in [DEV article](https://dev.to/chocolacula/how-to-write-reflection-for-c-4527).
1212

1313
## Features
1414

@@ -83,5 +83,3 @@ JetBrains for Open Source Support
8383
<a href="https://jb.gg/OpenSourceSupport">
8484
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" alt="JetBrains Logo" style="width:128px;height:128px;">
8585
</a>
86-
87-

example/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include "data/colors.h"
88
#include "er/reflection/reflection.h"
99
#include "er/serialization/json.h"
10-
#include "er/serialization/yaml.h"
11-
#include "er/variable/box.h"
1210
#include "generated/reflection.h"
1311
#include "print.h"
1412

generator/CMakeLists.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ set(SOURCES
2525

2626
add_executable(${PROJECT_NAME} ${SOURCES})
2727

28-
target_compile_definitions(${PROJECT_NAME} PRIVATE VERSION="${PROJECT_VERSION}")
29-
3028
find_path(TCLAP_INCLUDE_DIRS "tclap/Arg.h")
3129
include_directories(${TCLAP_INCLUDE_DIRS})
3230

@@ -44,18 +42,18 @@ endif()
4442
update_submodule(llvm-project)
4543
apply_patch(../attribute.patch llvm-project)
4644

47-
set(LLVM_ENABLE_RTTI ON)
48-
set(LLVM_INCLUDE_BENCHMARKS OFF)
49-
set(LLVM_ENABLE_PROJECTS "clang")
45+
set(LLVM_ENABLE_RTTI ON CACHE INTERNAL "enable runtime type information")
46+
set(LLVM_INCLUDE_BENCHMARKS OFF CACHE INTERNAL "avoid building benchmarks")
47+
set(LLVM_ENABLE_PROJECTS "clang" CACHE INTERNAL "build llvm with clang")
5048

5149
add_subdirectory(llvm-project/llvm EXCLUDE_FROM_ALL)
5250

5351
include_directories(
54-
llvm-project/llvm/include
55-
${CMAKE_CURRENT_BINARY_DIR}/llvm-project/llvm/include
56-
${CMAKE_CURRENT_BINARY_DIR}/llvm-project/utils/bazel/llvm-project-overlay/llvm/include
57-
llvm-project/clang/include
58-
${CMAKE_CURRENT_BINARY_DIR}/llvm-project/llvm/tools/clang/include)
52+
llvm-project/llvm/include
53+
${CMAKE_CURRENT_BINARY_DIR}/llvm-project/llvm/include
54+
${CMAKE_CURRENT_BINARY_DIR}/llvm-project/utils/bazel/llvm-project-overlay/llvm/include
55+
llvm-project/clang/include
56+
${CMAKE_CURRENT_BINARY_DIR}/llvm-project/llvm/tools/clang/include)
5957

6058
target_link_libraries(${PROJECT_NAME} PRIVATE
6159
clangAST

generator/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@
2020
#include "inja/inja.hpp"
2121
#include "inja/template.hpp"
2222

23+
namespace {
24+
const char* const kVersion = "0.1.0";
25+
} // namespace
26+
2327
int main(int argc, const char** argv) {
24-
TCLAP::CmdLine cmd("Easy Reflection code generator", ' ', VERSION);
28+
TCLAP::CmdLine cmd("Easy Reflection code generator", ' ', kVersion);
2529

2630
Files file_manager;
2731

0 commit comments

Comments
 (0)