Skip to content

Commit f017ba2

Browse files
authored
Merge pull request #2 from cppp-project/dev
Merge dev.
2 parents 966edd1 + 8440bb4 commit f017ba2

23 files changed

+335
-859
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,124 +6,42 @@ on:
66

77
jobs:
88

9-
build-dist:
9+
build:
1010

1111
runs-on: ubuntu-latest
1212

1313
steps:
1414

1515
#--------------------------------------------collect--------------------------------------------
16-
- uses: actions/checkout@v3
17-
18-
- name: 🏷️ Get infomations
19-
run: |
20-
tag="${GITHUB_REF#refs/tags/}"
21-
echo "tag=$tag" >> $GITHUB_ENV
22-
echo "pkgname=cppp-platform-$tag" >> $GITHUB_ENV
23-
echo "srcdir=$(pwd)" >> $GITHUB_ENV
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.13"
2421

2522
- name: 📁 Collect dependencies
2623
run: |
2724
sudo apt-get update
2825
sudo apt-get install p7zip-full zip xz-utils -y
2926
sudo apt-get install cmake gcc python3 -y
30-
31-
#--------------------------------------------build--------------------------------------------
32-
- name: 🧳 Prepare for source distribution building
33-
run: |
34-
mkdir -p ./dist
35-
./setup.sh
36-
37-
- name: 🛠️ Build source distribution
38-
run: |
39-
./cpppdist.py
40-
41-
- name: 📦 Make packages
42-
run: |
43-
tar cvf ${{ env.pkgname }}.tar ${{ env.pkgname }}
44-
zip -r -9 dist/${{ env.pkgname }}.zip ${{ env.pkgname }}
45-
7z a dist/${{ env.pkgname }}.7z ${{ env.pkgname }}
46-
xz -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.xz
47-
gzip -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.gz
48-
49-
cd dist
50-
for i in $(ls) ; do md5sum $i > $i.md5 ; done
51-
cd ..
52-
53-
#--------------------------------------------publish--------------------------------------------
54-
55-
- name: ⬆️ Create release and upload assets
56-
uses: softprops/action-gh-release@v1
57-
with:
58-
tag_name: ${{ env.tag }}
59-
files: ./dist/*
27+
python -m pip install --upgrade pip
28+
python -m pip install rubisco
6029
61-
build:
62-
63-
needs: build-dist
64-
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
arch: [
69-
any-any-any
70-
]
71-
72-
runs-on: ubuntu-latest
73-
74-
steps:
75-
76-
#--------------------------------------------collect--------------------------------------------
77-
- name: 🏷️ Get infomations
78-
run: |
79-
tag="${GITHUB_REF#refs/tags/}"
80-
echo "tag=$tag" >> $GITHUB_ENV
81-
echo "pkgname=cppp-platform-$tag" >> $GITHUB_ENV
82-
echo "srcdir=$(pwd)" >> $GITHUB_ENV
83-
84-
- name: 📁 Collect dependencies
85-
run: |
86-
sudo apt-get update
87-
sudo apt-get install p7zip-full zip xz-utils wget -y
88-
sudo apt-get install cmake -y
89-
sudo apt-get install gcc g++ -y
90-
91-
- name: 📁 Get source distribution tarball
92-
run: |
93-
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
94-
tar zxvf ${{ env.pkgname }}.tar.gz
95-
mv ${{ env.pkgname }}/* .
96-
9730
#--------------------------------------------build--------------------------------------------
98-
- name: 🧳 Prepare for binary distribution building
31+
- name: 🛠️ Build distribution
9932
run: |
100-
mkdir -p dist
101-
102-
- name: 🛠️ Build binary distribution
103-
run: |
104-
mkdir build
105-
cd build
106-
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }}
107-
cmake --build . --config=Release
108-
cmake --install .
109-
cd ..
33+
rubisco build
11034
11135
- name: 📦 Make packages
11236
run: |
113-
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}.tar ${{ env.pkgname }}-${{ matrix.arch }}
114-
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}.zip ${{ env.pkgname }}-${{ matrix.arch }}
115-
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}.7z ${{ env.pkgname }}-${{ matrix.arch }}
116-
xz -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.xz
117-
gzip -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.gz
118-
11937
cd dist
120-
for i in $(ls) ; do md5sum $i > $i.md5 ; done
38+
for i in $(ls) ; do sha256sum $i > $i.sha256 ; done
12139
cd ..
12240
12341
#--------------------------------------------publish--------------------------------------------
12442

12543
- name: ⬆️ Create release and upload assets
126-
uses: softprops/action-gh-release@v1
44+
uses: softprops/action-gh-release@v2
45+
if: startsWith(github.ref, 'refs/tags/')
12746
with:
128-
tag_name: ${{ env.tag }}
129-
files: ./dist/*
47+
files: ./dist/*

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CMake build files
22
build/
3+
dist/
4+
install/
35
CMakeFiles
46
*.so
57
*.so.*.*.*
@@ -33,9 +35,6 @@ Testing
3335
.vscode
3436
.cache
3537

36-
# Autopull modules
37-
build-aux
38-
3938
# Dist directory and temps
40-
cppp-platform-v*
39+
cppp-platform-*
4140
__pycache__

.rubisco/build.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 🛠️ Build cppp-platfrom
2+
3+
steps:
4+
- name: 📦 Make source distribution directory
5+
mkdir: ${{ project.name }}-${{ project.version }}
6+
- mkdir: dist
7+
8+
- name: 📦 Copy files to source distribution directory
9+
copy: ${{ cwd }}
10+
to: ${{ project.name }}-${{ project.version }}
11+
excludes:
12+
[
13+
".git*",
14+
"build",
15+
"dist",
16+
"*.7z",
17+
"*.gz",
18+
"*.xz",
19+
"*.zip",
20+
".vscode",
21+
".rubisco/extensions",
22+
"${{ project.name }}-*",
23+
]
24+
25+
- name: 📦 Packing the source distribution
26+
compress: ${{ project.name }}-${{ project.version }}
27+
to: dist/${{ project.name }}-${{ project.version }}
28+
format: [zip, tar.xz]
29+
30+
- name: 🛠️ Build the project.
31+
mkdir: build
32+
- cwd: build
33+
run: ["cmake", "..", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=install"]
34+
- cwd: build
35+
run: ["cmake", "--build", ".", "--config", "Release"]
36+
- cwd: build
37+
run: ["cmake", "--install", ".", "--config", "Release"]
38+
39+
- name: 📦 Packing the binary distribution.
40+
compress: build/install
41+
start: build
42+
to: dist/${{ project.name }}-${{ project.version }}-unknown-unknown-unknown
43+
format: [zip, tar.xz]

CMakeLists.txt

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,28 @@
1-
# Copyright (C) 2023 The C++ Plus Project.
2-
# This file is part of the cppp-platform library.
3-
#
4-
# The cppp-platform library is free software; you can redistribute it
5-
# and/or modify it under the terms of the The Unlicense as published
6-
# by the unlicense.org
7-
#
8-
# The cppp-platform library is distributed in the hope that it will be
9-
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10-
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the The
11-
# Unlicense for more details.
12-
#
13-
# You should have received a copy of the The Unlicense along with the
14-
# cppp-platform library; see the file COPYING.
15-
# If not, see <http://unlicense.org/>.
16-
17-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.10)
182
project(cppp-platform VERSION 1.3.0)
193

20-
# Set C++ standard
21-
set(CMAKE_CXX_STANDARD 11)
22-
23-
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build-aux")
24-
set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/build-aux")
25-
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../build-aux")
26-
set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/../build-aux")
27-
else()
28-
message(FATAL_ERROR "CMake build-aux directory is not exists, try to execute 'setup.cmd' or './setup.sh' to get it.")
29-
endif()
30-
set(AUX_DIR "${BUILD_AUX}/cmake")
31-
32-
message(STATUS "Using '${BUILD_AUX}' for C++ Plus build-aux directory.")
33-
add_subdirectory("${BUILD_AUX}")
34-
35-
include("${AUX_DIR}/cppp.cmake")
4+
option(BUILD_EXAMPLE "Build example" OFF)
365

376
# Read source files
38-
file(READ "${srcdir}/src/architectures.h" ARCHITECTURES)
39-
file(READ "${srcdir}/src/compilers.h" COMPILERS)
40-
file(READ "${srcdir}/src/languagestandards.h" LANGUAGESTANDARDS)
41-
file(READ "${srcdir}/src/platforms.h" PLATFORMS)
7+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/architectures.h" ARCHITECTURES)
8+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/compilers.h" COMPILERS)
9+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/languagestandards.h" LANGUAGESTANDARDS)
10+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/platforms.h" PLATFORMS)
4211

4312
# Genetate header
44-
configure_file("${srcdir}/include/cppp/cppp-platform.h.in" "${output_includedir}/cppp/cppp-platform.h")
13+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/cppp/cppp-platform.h.in" "${CMAKE_BINARY_DIR}/include/cppp/cppp-platform.h")
14+
15+
# Build example
16+
if(BUILD_EXAMPLE)
17+
add_executable(example "${CMAKE_CURRENT_SOURCE_DIR}/src/example.c")
18+
target_include_directories(example PRIVATE "${CMAKE_BINARY_DIR}/include")
19+
endif()
4520

46-
# Generate header file for install
47-
cppp_nls_autotranslate("${output_includedir}/cppp/cppp-platform.h" "${srcdir}/lang")
4821

4922
# Install
5023
# Includes
5124
# PERMISSIONS 0644
52-
install(FILES "${output_includedir}/cppp/cppp-platform.h"
53-
DESTINATION "${install_includedir}"
25+
install(FILES "${CMAKE_BINARY_DIR}/include/cppp/cppp-platform.h"
26+
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
5427
RENAME "cppp/cppp-platform.h"
5528
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ )

CPPPPKG

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

ChangeLog

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

FILELIST

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

COPYING renamed to LICENSE

File renamed without changes.

0 commit comments

Comments
 (0)