Skip to content

Commit 4ca5e5c

Browse files
authored
Linux GCC CI (#60)
Basic Linux GCC CI Minor updates to README Minor updates to AfterInstall example Minor updates to CustomTarget hybrid example
1 parent c1d0fca commit 4ca5e5c

File tree

7 files changed

+123
-15
lines changed

7 files changed

+123
-15
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Linux GCC CMake build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Release
12+
BUILD_FOLDER: _build_gcc_dev_all
13+
14+
jobs:
15+
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
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
submodules: true
26+
27+
- name: System Packages
28+
run: |
29+
sudo apt-get install ninja-build doxygen graphviz gcovr lcov cppcheck clang-tidy
30+
31+
- name: Check environment
32+
run: |
33+
cmake --version
34+
gcc --version
35+
clang --version
36+
ninja --version
37+
doxygen --version
38+
gcovr --version
39+
lcov --version
40+
cppcheck --version
41+
clang-tidy --version
42+
43+
- name: Configure CMake
44+
run: |
45+
cmake --list-presets
46+
cmake --preset=gcc_dev_all
47+
48+
- name: Static Analysis
49+
working-directory: ${{github.workspace}}/${{env.BUILD_FOLDER}}
50+
run: cmake --build . --target cppcheck_static_analysis
51+
52+
- name: Build
53+
# Linux has 2 cores
54+
run: |
55+
cmake --build --list-presets
56+
cmake --build --preset=gcc_dev_all --parallel 2
57+
58+
- name: Test
59+
run: |
60+
ctest --preset=gcc_dev_all --parallel 2
61+
62+
- name: Install
63+
working-directory: ${{github.workspace}}/${{env.BUILD_FOLDER}}
64+
run: |
65+
sudo cmake --install .
66+
67+
- name: Hybrid Simple Example
68+
working-directory: ${{github.workspace}}/${{env.BUILD_FOLDER}}
69+
run: |
70+
cmake --build . --target run_hybrid_simple_example_linux
71+
72+
- name: Hybrid Foolib Example
73+
working-directory: ${{github.workspace}}/${{env.BUILD_FOLDER}}
74+
run: |
75+
cmake --build . --target run_hybrid_foolib_example_linux
76+
77+
- name: Hybrid External Lib Example
78+
working-directory: ${{github.workspace}}/${{env.BUILD_FOLDER}}
79+
run: |
80+
cmake --build . --target run_hybrid_externallib_example_linux
81+
82+
- name: Hybrid Custom Target Example
83+
working-directory: ${{github.workspace}}/${{env.BUILD_FOLDER}}
84+
run: |
85+
cmake --build . --target run_hybrid_customtarget_example_linux
86+
87+
- name: AfterInstall Example
88+
working-directory: ${{github.workspace}}/example/gcc/AfterInstall
89+
run: |
90+
cmake -B build -G Ninja
91+
cmake --build build --parallel 2
92+
cd build
93+
./build

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ Build C, C++ and ASM files in C++
66

77
**_BuildCC_** aims to be an alternative to **Makefiles** while using the feature rich C++ language.
88

9+
## Pre-requisites
10+
11+
- C++17 Compiler with
12+
- `C++17 filesystem` library support
13+
- `C++11 thread` library support
14+
- Third Party Libraries (See License below)
15+
- Flatbuffers
16+
- Taskflow
17+
- CLI11
18+
- fmt
19+
- spdlog
20+
921
# General Information
1022

1123
- A `compile` + `link` procedure is called a **Target**
@@ -29,7 +41,7 @@ See also [Software Architecture](#software-architecture)
2941

3042
## Features
3143

32-
- Complete flexibility for custom / brand new toolchains
44+
- Complete flexibility for custom workflows and toolchains
3345
- C++ language feature benefits and **debuggable build binaries**
3446
- Optimized rebuilds through serialization. See [target.fbs schema](buildcc/lib/target/fbs/target.fbs)
3547
- Can optimize for rebuilds by comparing the previous stored build with current build.

buildcc/lib/target/cmake/mock_target.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ target_include_directories(mock_target PUBLIC
55
${CMAKE_CURRENT_BINARY_DIR}/generated
66
)
77

8-
target_sources(mock_target PUBLIC
8+
target_sources(mock_target PRIVATE
99
${CMAKE_CURRENT_SOURCE_DIR}/src/target/target.cpp
1010
${CMAKE_CURRENT_SOURCE_DIR}/src/target/source.cpp
1111
${CMAKE_CURRENT_SOURCE_DIR}/src/target/include_dir.cpp

example/gcc/AfterInstall/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,35 @@ project(simple)
1010

1111
# Package dependencies
1212
# fmt is imported by spdlog by default
13+
find_package(fmt_package NAMES "fmt" REQUIRED)
1314
find_package(spdlog_package NAMES "spdlog" REQUIRED)
14-
find_package(flatbuffers_package NAMES "flatbuffers" REQUIRED)
15+
find_package(flatbuffers_package NAMES "Flatbuffers" "flatbuffers" REQUIRED)
16+
find_package(taskflow_package NAMES "Taskflow" "taskflow" REQUIRED)
17+
find_package(CLI11_package NAMES "CLI11" REQUIRED)
18+
1519
find_package(env_package NAMES "env" REQUIRED)
1620
find_package(toolchain_package NAMES "toolchain" REQUIRED)
1721
find_package(toolchain_specialized_package NAMES "toolchain_specialized" REQUIRED)
18-
find_package(taskflow_package NAMES "taskflow" REQUIRED)
1922
find_package(target_package NAMES "target" REQUIRED)
2023
find_package(target_gcc_package NAMES "target_gcc" REQUIRED)
2124
find_package(target_msvc_package NAMES "target_msvc" REQUIRED)
2225
find_package(plugins NAMES "plugins" REQUIRED)
2326

24-
find_package(CLI11_package NAMES "CLI11" REQUIRED)
2527
find_package(buildcc_package NAMES "buildcc" REQUIRED)
2628

29+
message("Find package: ${fmt_package_DIR}")
2730
message("Find package: ${spdlog_package_DIR}")
2831
message("Find package: ${flatbuffers_package_DIR}")
32+
message("Find package: ${taskflow_package_DIR}")
33+
message("Find package: ${CLI11_package_DIR}")
34+
2935
message("Find package: ${env_package_DIR}")
3036
message("Find package: ${toolchain_specialized_package_DIR}")
3137
message("Find package: ${toolchain_package_DIR}")
32-
message("Find package: ${taskflow_package_DIR}")
3338
message("Find package: ${target_package_DIR}")
3439
message("Find package: ${target_gcc_package_DIR}")
3540
message("Find package: ${target_msvc_package_DIR}")
3641
message("Find package: ${plugins_DIR}")
37-
message("Find package: ${CLI11_package_DIR}")
3842
message("Find package: ${buildcc_package_DIR}")
3943

4044
# build executable

example/hybrid/custom_target/build.main.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ class ExecutableTarget_clang : public base::Target {
6363
int main(int argc, char **argv) {
6464
// 1. Get arguments
6565
Args args;
66-
Args::Toolchain clang_w64_windows_gnu;
67-
args.AddCustomToolchain("clang_w64_windows_gnu", "MSYS MINGW clang compiler",
68-
clang_w64_windows_gnu);
66+
Args::Toolchain clang_gnu;
67+
args.AddCustomToolchain("clang_gnu", "Clang GNU compiler", clang_gnu);
6968
args.Parse(argc, argv);
7069

7170
// 2. Initialize your environment
@@ -86,11 +85,11 @@ int main(int argc, char **argv) {
8685
reg.Build(args.GetMsvcToolchain(), m_foolib, mfoolib_build_cb);
8786

8887
// * NOTE, This is how we add our custom toolchain
89-
base::Toolchain clang("clang_w64_windows_gnu", "llvm-as", "clang", "clang++",
90-
"llvm-ar", "ld");
88+
base::Toolchain clang("clang_gnu", "llvm-as", "clang", "clang++", "llvm-ar",
89+
"ld");
9190
// * NOTE, Custom clang target added above
9291
ExecutableTarget_clang c_foolib("CFoolib.exe", clang, "");
93-
reg.Build(clang_w64_windows_gnu, c_foolib, cfoolib_build_cb);
92+
reg.Build(clang_gnu, c_foolib, cfoolib_build_cb);
9493

9594
// 5.
9695
reg.RunBuild();

example/hybrid/custom_target/build_linux.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ build = false
1616
test = false
1717

1818
# Custom toolchain added here
19-
[toolchain.clang_w64_windows_gnu]
19+
[toolchain.clang_gnu]
2020
build = true
2121
test = true

example/hybrid/custom_target/build_win.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ build = true
1616
test = true
1717

1818
# Custom toolchain added here
19-
[toolchain.clang_w64_windows_gnu]
19+
[toolchain.clang_gnu]
2020
build = true
2121
test = true

0 commit comments

Comments
 (0)