Skip to content

Commit 966edd1

Browse files
authored
Merge pull request #1 from cppp-project/dev
[Pull Request] Merge dev.
2 parents a21a0cc + 22a8105 commit 966edd1

30 files changed

+1351
-1302
lines changed

.github/workflows/build.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: 🛠️ Build cppp-platform
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
build-dist:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
15+
#--------------------------------------------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
24+
25+
- name: 📁 Collect dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install p7zip-full zip xz-utils -y
29+
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/*
60+
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+
97+
#--------------------------------------------build--------------------------------------------
98+
- name: 🧳 Prepare for binary distribution building
99+
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 ..
110+
111+
- name: 📦 Make packages
112+
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+
119+
cd dist
120+
for i in $(ls) ; do md5sum $i > $i.md5 ; done
121+
cd ..
122+
123+
#--------------------------------------------publish--------------------------------------------
124+
125+
- name: ⬆️ Create release and upload assets
126+
uses: softprops/action-gh-release@v1
127+
with:
128+
tag_name: ${{ env.tag }}
129+
files: ./dist/*

.gitignore

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
1-
# libplatform .gitignore
2-
# Build output dir
1+
# CMake build files
32
build/
4-
# Editor config
5-
.vscode/
6-
# Makefile install data
7-
install.list
3+
CMakeFiles
4+
*.so
5+
*.so.*.*.*
6+
*.a
7+
*.dylib
8+
*.stackdump
9+
*.lib
10+
*.pdb
11+
*.dll
12+
*.exe
13+
cmake_install.cmake
14+
CMakeCache.txt
15+
CTestTestfile.cmake
16+
DartConfiguration.tcl
17+
Makefile
18+
uninstall.cmake
19+
CTestCostData.txt
20+
*.inst
21+
Testing
22+
*.log
23+
*.dSYM
24+
25+
# Patterns for all subdirectories: all kinds of automatic backup files.
26+
*.orig
27+
*.rej
28+
*~
29+
*.kate-swp
30+
*.swp
31+
.#*
32+
\#*#
33+
.vscode
34+
.cache
35+
36+
# Autopull modules
37+
build-aux
38+
39+
# Dist directory and temps
40+
cppp-platform-v*
41+
__pycache__

CMakeLists.txt

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,55 @@
1-
# CMakeLists for libplatform
2-
cmake_minimum_required(VERSION 3.0)
3-
4-
# Project
5-
project(libplatform)
6-
7-
# Source path
8-
set(LP_SOURCE ${CMAKE_SOURCE_DIR})
9-
set(LP_SRCDIR ${LP_SOURCE}/src)
10-
set(LP_FILE_TITLE ${LP_SRCDIR}/title.h)
11-
set(LP_FILE_END ${LP_SRCDIR}/end.h)
12-
set(LP_FILES ${LP_FILE_TITLE} ${LP_SRCDIR}/lparchs.h ${LP_SRCDIR}/lpcomps.h ${LP_SRCDIR}/lpplat.h ${LP_SRCDIR}/lpstds.h ${LP_FILE_END})
13-
14-
# Build path
15-
set(LP_BUILD_OUTPUT ${CMAKE_BINARY_DIR})
16-
set(LP_OUT_INCLUDE_DIR ${LP_BUILD_OUTPUT}/include)
17-
set(LP_OUT_RUNTIME_DIR ${LP_BUILD_OUTPUT}/bin)
18-
set(LP_OUT_LIBRARY_DIR ${LP_BUILD_OUTPUT}/lib)
19-
20-
# Make include
21-
file(REMOVE ${LP_OUT_INCLUDE_DIR}/platform_predef.h)
22-
foreach(FILE ${LP_FILES})
23-
message("Adding ${FILE}...")
24-
file(READ ${FILE} _DATA )
25-
write_file(${LP_OUT_INCLUDE_DIR}/platform_predef.h ${_DATA} APPEND)
26-
endforeach()
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)
18+
project(cppp-platform VERSION 1.3.0)
19+
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")
36+
37+
# 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)
42+
43+
# Genetate header
44+
configure_file("${srcdir}/include/cppp/cppp-platform.h.in" "${output_includedir}/cppp/cppp-platform.h")
45+
46+
# Generate header file for install
47+
cppp_nls_autotranslate("${output_includedir}/cppp/cppp-platform.h" "${srcdir}/lang")
48+
49+
# Install
50+
# Includes
51+
# PERMISSIONS 0644
52+
install(FILES "${output_includedir}/cppp/cppp-platform.h"
53+
DESTINATION "${install_includedir}"
54+
RENAME "cppp/cppp-platform.h"
55+
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ )

LICENSE renamed to COPYING

File renamed without changes.

CPPPPKG

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name" : "cppp-platform",
3+
"version" : "1.3.0",
4+
"list_file_path": "FILELIST",
5+
"description": "Portable platform check library for C++ Plus.",
6+
"authors": [
7+
"The C++ Plus Project",
8+
"ChenPi11"
9+
],
10+
"webpage": "https://github.com/cppp-project/cppp-platform",
11+
"subpackages": {
12+
"build-aux": { "path": "build-aux", "ignore": true }
13+
},
14+
"license": [
15+
"Unlicense"
16+
]
17+
}

ChangeLog

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2023-08-09 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
2+
3+
Add C++ Plus package infomation.
4+
Update docs.
5+
Add GitHub CI.
6+
Prepare for release v1.3.0.
7+
8+
2023-08-08 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
9+
10+
Add CMake buildsystem support.
11+
Add submodule 'build-aux'.
12+
Add NLS Language Map.
13+
14+
2023-08-07 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
15+
16+
Update docs.
17+
Change project structure.
18+
Remove Autoconf buildsystem support.
19+
Add ChangeLog.
20+
Rename the project to 'cppp-platform'.
21+
22+
2023-06-01 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
23+
24+
Add prepare-release.
25+
Update build rules.
26+
- Add autoconf build script.
27+
- Remove MS-DOS support.
28+
- Remove CMake build rules.
29+
- Fix bugs.
30+
- Update docs.
31+
- Remove Python build script.
32+
33+
2023-04-09 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
34+
35+
Add so many things.
36+
- 更新了GNU Make规则
37+
- 完善了README.md文档,添加了多种生成方式的说明和使用手册的链接
38+
- 添加了使用手册文档
39+
- 完善了Windows下make.cmd的生成方式
40+
- 将lparchs中__arch_xxx__和__arch__的值改为数字,方便预处理判断
41+
- 优化了lparchs宏的实现逻辑,避免某些编译器出错
42+
- 将lpcomps中的__has_acc__改为__has_acc_compiler__,统一命名
43+
- 删除lpstds的__has_c89__,因为它是世界上C语言的第一个标准,标准C语言都支持
44+
- 添加了Python版本的生成规则
45+
- 添加了MS-DOS下的生成方式
46+
47+
2023-04-05 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
48+
49+
Add CMake and cmd build.
50+
- 添加了CMake生成方式和cmd.exe生成方式
51+
- 完善了项目结构
52+
- 完善了Makefile
53+
- 删除Python生成方式:make.py
54+
- 修复了一些bug
55+
- 将所有文件结尾由CR LF改为LF,make.cmd除外
56+
- 完善了README.md文档,添加生成方式和用法的说明
57+
- 修改了输出文件名,libplatform.h改名为platform_predef.h
58+
- 更新.gitignore
59+
60+
2023-03-26 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
61+
62+
1.0.1 Add Haiku OS support.
63+
64+
2023-02-18 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
65+
66+
Update title.h
67+
68+
2023-02-18 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
69+
70+
1.0.0
71+
72+
2023-02-18 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
73+
74+
Initial commit.

FILELIST

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
README.md
2+
cpppdist.py
3+
doc/compilers.md
4+
doc/architectures.md
5+
doc/languagestandards.md
6+
doc/doc.md
7+
doc/platforms.md
8+
FILELIST
9+
include/cppp/cppp-platform.h.in
10+
src/platforms.h
11+
src/languagestandards.h
12+
src/architectures.h
13+
src/compilers.h
14+
CMakeLists.txt
15+
CPPPPKG
16+
lang/zh_CN.langmap
17+
lang/en_US.langmap
18+
ChangeLog
19+
COPYING

0 commit comments

Comments
 (0)