Skip to content

[Pull Request] Merge dev. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: 🛠️ Build cppp-platform

on:
release:
types: [published]

jobs:

build-dist:

runs-on: ubuntu-latest

steps:

#--------------------------------------------collect--------------------------------------------
- uses: actions/checkout@v3

- name: 🏷️ Get infomations
run: |
tag="${GITHUB_REF#refs/tags/}"
echo "tag=$tag" >> $GITHUB_ENV
echo "pkgname=cppp-platform-$tag" >> $GITHUB_ENV
echo "srcdir=$(pwd)" >> $GITHUB_ENV

- name: 📁 Collect dependencies
run: |
sudo apt-get update
sudo apt-get install p7zip-full zip xz-utils -y
sudo apt-get install cmake gcc python3 -y

#--------------------------------------------build--------------------------------------------
- name: 🧳 Prepare for source distribution building
run: |
mkdir -p ./dist
./setup.sh

- name: 🛠️ Build source distribution
run: |
./cpppdist.py

- name: 📦 Make packages
run: |
tar cvf ${{ env.pkgname }}.tar ${{ env.pkgname }}
zip -r -9 dist/${{ env.pkgname }}.zip ${{ env.pkgname }}
7z a dist/${{ env.pkgname }}.7z ${{ env.pkgname }}
xz -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.xz
gzip -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.gz

cd dist
for i in $(ls) ; do md5sum $i > $i.md5 ; done
cd ..

#--------------------------------------------publish--------------------------------------------

- name: ⬆️ Create release and upload assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.tag }}
files: ./dist/*

build:

needs: build-dist

strategy:
fail-fast: false
matrix:
arch: [
any-any-any
]

runs-on: ubuntu-latest

steps:

#--------------------------------------------collect--------------------------------------------
- name: 🏷️ Get infomations
run: |
tag="${GITHUB_REF#refs/tags/}"
echo "tag=$tag" >> $GITHUB_ENV
echo "pkgname=cppp-platform-$tag" >> $GITHUB_ENV
echo "srcdir=$(pwd)" >> $GITHUB_ENV

- name: 📁 Collect dependencies
run: |
sudo apt-get update
sudo apt-get install p7zip-full zip xz-utils wget -y
sudo apt-get install cmake -y
sudo apt-get install gcc g++ -y

- name: 📁 Get source distribution tarball
run: |
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
tar zxvf ${{ env.pkgname }}.tar.gz
mv ${{ env.pkgname }}/* .

#--------------------------------------------build--------------------------------------------
- name: 🧳 Prepare for binary distribution building
run: |
mkdir -p dist

- name: 🛠️ Build binary distribution
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }}
cmake --build . --config=Release
cmake --install .
cd ..

- name: 📦 Make packages
run: |
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}.tar ${{ env.pkgname }}-${{ matrix.arch }}
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}.zip ${{ env.pkgname }}-${{ matrix.arch }}
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}.7z ${{ env.pkgname }}-${{ matrix.arch }}
xz -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.xz
gzip -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.gz

cd dist
for i in $(ls) ; do md5sum $i > $i.md5 ; done
cd ..

#--------------------------------------------publish--------------------------------------------

- name: ⬆️ Create release and upload assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.tag }}
files: ./dist/*
46 changes: 40 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
# libplatform .gitignore
# Build output dir
# CMake build files
build/
# Editor config
.vscode/
# Makefile install data
install.list
CMakeFiles
*.so
*.so.*.*.*
*.a
*.dylib
*.stackdump
*.lib
*.pdb
*.dll
*.exe
cmake_install.cmake
CMakeCache.txt
CTestTestfile.cmake
DartConfiguration.tcl
Makefile
uninstall.cmake
CTestCostData.txt
*.inst
Testing
*.log
*.dSYM

# Patterns for all subdirectories: all kinds of automatic backup files.
*.orig
*.rej
*~
*.kate-swp
*.swp
.#*
\#*#
.vscode
.cache

# Autopull modules
build-aux

# Dist directory and temps
cppp-platform-v*
__pycache__
81 changes: 55 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,55 @@
# CMakeLists for libplatform
cmake_minimum_required(VERSION 3.0)

# Project
project(libplatform)

# Source path
set(LP_SOURCE ${CMAKE_SOURCE_DIR})
set(LP_SRCDIR ${LP_SOURCE}/src)
set(LP_FILE_TITLE ${LP_SRCDIR}/title.h)
set(LP_FILE_END ${LP_SRCDIR}/end.h)
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})

# Build path
set(LP_BUILD_OUTPUT ${CMAKE_BINARY_DIR})
set(LP_OUT_INCLUDE_DIR ${LP_BUILD_OUTPUT}/include)
set(LP_OUT_RUNTIME_DIR ${LP_BUILD_OUTPUT}/bin)
set(LP_OUT_LIBRARY_DIR ${LP_BUILD_OUTPUT}/lib)

# Make include
file(REMOVE ${LP_OUT_INCLUDE_DIR}/platform_predef.h)
foreach(FILE ${LP_FILES})
message("Adding ${FILE}...")
file(READ ${FILE} _DATA )
write_file(${LP_OUT_INCLUDE_DIR}/platform_predef.h ${_DATA} APPEND)
endforeach()
# Copyright (C) 2023 The C++ Plus Project.
# This file is part of the cppp-platform library.
#
# The cppp-platform library is free software; you can redistribute it
# and/or modify it under the terms of the The Unlicense as published
# by the unlicense.org
#
# The cppp-platform library is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the The
# Unlicense for more details.
#
# You should have received a copy of the The Unlicense along with the
# cppp-platform library; see the file COPYING.
# If not, see <http://unlicense.org/>.

cmake_minimum_required(VERSION 3.12)
project(cppp-platform VERSION 1.3.0)

# Set C++ standard
set(CMAKE_CXX_STANDARD 11)

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build-aux")
set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/build-aux")
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../build-aux")
set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/../build-aux")
else()
message(FATAL_ERROR "CMake build-aux directory is not exists, try to execute 'setup.cmd' or './setup.sh' to get it.")
endif()
set(AUX_DIR "${BUILD_AUX}/cmake")

message(STATUS "Using '${BUILD_AUX}' for C++ Plus build-aux directory.")
add_subdirectory("${BUILD_AUX}")

include("${AUX_DIR}/cppp.cmake")

# Read source files
file(READ "${srcdir}/src/architectures.h" ARCHITECTURES)
file(READ "${srcdir}/src/compilers.h" COMPILERS)
file(READ "${srcdir}/src/languagestandards.h" LANGUAGESTANDARDS)
file(READ "${srcdir}/src/platforms.h" PLATFORMS)

# Genetate header
configure_file("${srcdir}/include/cppp/cppp-platform.h.in" "${output_includedir}/cppp/cppp-platform.h")

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

# Install
# Includes
# PERMISSIONS 0644
install(FILES "${output_includedir}/cppp/cppp-platform.h"
DESTINATION "${install_includedir}"
RENAME "cppp/cppp-platform.h"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ )
File renamed without changes.
17 changes: 17 additions & 0 deletions CPPPPKG
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name" : "cppp-platform",
"version" : "1.3.0",
"list_file_path": "FILELIST",
"description": "Portable platform check library for C++ Plus.",
"authors": [
"The C++ Plus Project",
"ChenPi11"
],
"webpage": "https://github.com/cppp-project/cppp-platform",
"subpackages": {
"build-aux": { "path": "build-aux", "ignore": true }
},
"license": [
"Unlicense"
]
}
74 changes: 74 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
2023-08-09 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Add C++ Plus package infomation.
Update docs.
Add GitHub CI.
Prepare for release v1.3.0.

2023-08-08 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Add CMake buildsystem support.
Add submodule 'build-aux'.
Add NLS Language Map.

2023-08-07 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Update docs.
Change project structure.
Remove Autoconf buildsystem support.
Add ChangeLog.
Rename the project to 'cppp-platform'.

2023-06-01 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Add prepare-release.
Update build rules.
- Add autoconf build script.
- Remove MS-DOS support.
- Remove CMake build rules.
- Fix bugs.
- Update docs.
- Remove Python build script.

2023-04-09 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Add so many things.
- 更新了GNU Make规则
- 完善了README.md文档,添加了多种生成方式的说明和使用手册的链接
- 添加了使用手册文档
- 完善了Windows下make.cmd的生成方式
- 将lparchs中__arch_xxx__和__arch__的值改为数字,方便预处理判断
- 优化了lparchs宏的实现逻辑,避免某些编译器出错
- 将lpcomps中的__has_acc__改为__has_acc_compiler__,统一命名
- 删除lpstds的__has_c89__,因为它是世界上C语言的第一个标准,标准C语言都支持
- 添加了Python版本的生成规则
- 添加了MS-DOS下的生成方式

2023-04-05 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Add CMake and cmd build.
- 添加了CMake生成方式和cmd.exe生成方式
- 完善了项目结构
- 完善了Makefile
- 删除Python生成方式:make.py
- 修复了一些bug
- 将所有文件结尾由CR LF改为LF,make.cmd除外
- 完善了README.md文档,添加生成方式和用法的说明
- 修改了输出文件名,libplatform.h改名为platform_predef.h
- 更新.gitignore

2023-03-26 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

1.0.1 Add Haiku OS support.

2023-02-18 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Update title.h

2023-02-18 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

1.0.0

2023-02-18 ChenPi11 <wushengwuxi-msctinoulk@outlook.com>

Initial commit.
19 changes: 19 additions & 0 deletions FILELIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
README.md
cpppdist.py
doc/compilers.md
doc/architectures.md
doc/languagestandards.md
doc/doc.md
doc/platforms.md
FILELIST
include/cppp/cppp-platform.h.in
src/platforms.h
src/languagestandards.h
src/architectures.h
src/compilers.h
CMakeLists.txt
CPPPPKG
lang/zh_CN.langmap
lang/en_US.langmap
ChangeLog
COPYING
Loading