From 9f7bfcc2772643641a6489e74284dc0e65d8859f Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Thu, 24 Aug 2023 09:51:25 +0800 Subject: [PATCH 1/8] =?UTF-8?q?Optimize=20the=20way=20to=20import=20build-?= =?UTF-8?q?aux.=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20CMakeLists.?= =?UTF-8?q?txt=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20ChangeLog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 13 +++++++------ ChangeLog | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abb91fc..109519b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,19 +20,20 @@ project(cppp-platform VERSION 1.3.0) # Set C++ standard set(CMAKE_CXX_STANDARD 11) +# ---------------------------------------------------------------------------------- +# Import build-aux subdirectory. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build-aux") set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/build-aux") + add_subdirectory("${BUILD_AUX}") + message(STATUS "Using '${BUILD_AUX}' for C++ Plus build-aux directory.") 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") +get_filename_component(BUILD_AUX "${BUILD_AUX}" ABSOLUTE) +include("${BUILD_AUX}/cmake/cppp.cmake") +# ---------------------------------------------------------------------------------- # Read source files file(READ "${srcdir}/src/architectures.h" ARCHITECTURES) diff --git a/ChangeLog b/ChangeLog index 1f00ce4..d0d88ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2023-08-24 ChenPi11 + + Optimize the way to import build-aux. + 2023-08-09 ChenPi11 Add C++ Plus package infomation. From 7529b6bdd921b648c68ad54d929958b5b5e49817 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Sat, 30 Nov 2024 11:10:32 +0800 Subject: [PATCH 2/8] Remove langmap files and `build-aux` requirement. --- CMakeLists.txt | 35 +++--------- include/cppp/cppp-platform.h.in | 24 ++------- lang/en_US.langmap | 96 --------------------------------- lang/zh_CN.langmap | 90 ------------------------------- 4 files changed, 11 insertions(+), 234 deletions(-) delete mode 100644 lang/en_US.langmap delete mode 100644 lang/zh_CN.langmap diff --git a/CMakeLists.txt b/CMakeLists.txt index 109519b..1630cef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2023 The C++ Plus Project. +# Copyright (C) 2024 The C++ Plus Project. # This file is part of the cppp-platform library. # # The cppp-platform library is free software; you can redistribute it @@ -14,38 +14,17 @@ # cppp-platform library; see the file COPYING. # If not, see . -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.10) project(cppp-platform VERSION 1.3.0) -# Set C++ standard -set(CMAKE_CXX_STANDARD 11) - -# ---------------------------------------------------------------------------------- -# Import build-aux subdirectory. -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build-aux") - set(BUILD_AUX "${CMAKE_CURRENT_SOURCE_DIR}/build-aux") - add_subdirectory("${BUILD_AUX}") - message(STATUS "Using '${BUILD_AUX}' for C++ Plus build-aux directory.") -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() -get_filename_component(BUILD_AUX "${BUILD_AUX}" ABSOLUTE) -include("${BUILD_AUX}/cmake/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) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/architectures.h" ARCHITECTURES) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/compilers.h" COMPILERS) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/languagestandards.h" LANGUAGESTANDARDS) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/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") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/cppp/cppp-platform.h.in" "${output_includedir}/cppp/cppp-platform.h") # Install # Includes diff --git a/include/cppp/cppp-platform.h.in b/include/cppp/cppp-platform.h.in index affa290..cdb393c 100644 --- a/include/cppp/cppp-platform.h.in +++ b/include/cppp/cppp-platform.h.in @@ -1,31 +1,15 @@ /** * @file cppp/cppp-platform.h * @author ChenPi11 - * @copyright Copyright (C) 2023 The C++ Plus Project - * @date 2023-08-07 + * @copyright Copyright (C) 2024 The C++ Plus Project * @brief C++ Plus platform predefined detection. * @version @PROJECT_VERSION@ - * @see https://sourceforge.net/p/predef/wiki/Home/ + * @see https://github.com/cpredef/predef * @link https://github.com/cppp-project/cppp-platform */ -/* 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 . */ - -#ifndef _CPPP_PLATFORM_H -#define _CPPP_PLATFORM_H +#ifndef _CPPP_PLATFORM_H_INCLUDED +#define _CPPP_PLATFORM_H_INCLUDED 1 /* Architectures detection. */ @ARCHITECTURES@ diff --git a/lang/en_US.langmap b/lang/en_US.langmap deleted file mode 100644 index b7efe0a..0000000 --- a/lang/en_US.langmap +++ /dev/null @@ -1,96 +0,0 @@ -# C++ Plus NLS Util language map for cppp-platform. -# en_US - -''' -/* 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 . */ -''' -/* 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 . */ -''' - -''' -/* Architectures detection. */ -''' -/* Architectures detection. */ -''' - -''' -/* Fix amd64 and 8086 bug */ -''' -/* Fix amd64 and 8086 bug */ -''' - -''' -/* Compilers detection. */ -''' -/* Compilers detection. */ -''' - -''' -/* C/C++ standards detection. */ -''' -/* C/C++ standards detection. */ -''' - -''' -/* Platforms detection. */ -''' -/* Platforms detection. */ -''' - -''' -/* Unknown architectures */ -''' -/* Unknown architectures */ -''' - -''' -/* Usually C17 means C18. */ -''' -/* Usually C17 means C18. */ -''' - -''' -/* C++ predefines */ -''' -/* C++ predefines */ -''' - -''' -/* Fix MSVC++ __cplusplus's feature. */ -''' -/* Fix MSVC++ __cplusplus's feature. */ -''' - -''' -/* C++ version */ -''' -/* C++ version */ -''' diff --git a/lang/zh_CN.langmap b/lang/zh_CN.langmap deleted file mode 100644 index 9aa8eff..0000000 --- a/lang/zh_CN.langmap +++ /dev/null @@ -1,90 +0,0 @@ -# C++ Plus NLS Util language map for cppp-platform. -# zh_CN - -''' -/* 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 . */ -''' -/* 版权所有 (C) 2023 The C++ Plus Project - 本文件是 cppp-platform 库的一部分。 - - cppp-platform 库是自由软件;您可以在 unlicense.org 上发布的 The Unlicense 条款下重新分发或修改它。 - cppp-platform 库是基于无任何保证的;没有明示的保证,包括但不限于适销性或对特定用途的适用性。 - 有关更多细节,请参阅 The Unlicense。 - - 您应该已经收到了 The Unlicense 的副本,与 cppp-platform 库一起;请参阅 COPYING 文件。 - 如果没有收到,请访问 。 */ -''' - -''' -/* Architectures detection. */ -''' -/* CPU 架构检测。 */ -''' - -''' -/* Fix amd64 and 8086 bug */ -''' -/* 修复 amd64 和 8086 检测的错误 */ -''' - -''' -/* Compilers detection. */ -''' -/* 编译器检测。 */ -''' - -''' -/* C/C++ standards detection. */ -''' -/* C/C++ 标准检测。 */ -''' - -''' -/* Platforms detection. */ -''' -/* 平台检测 */ -''' - -''' -/* Unknown architectures */ -''' -/* 未知的 CPU 架构 */ -''' - -''' -/* Usually C17 means C18. */ -''' -/* 通常, C17 和 C18 相同。 */ -''' - -''' -/* C++ predefines */ -''' -/* C++ 预定义 */ -''' - -''' -/* Fix MSVC++ __cplusplus's feature. */ -''' -/* 修复了 MSVC++ __cplusplus 宏值错误的问题 */ -''' - -''' -/* C++ version */ -''' -/* C++ 标准 */ -''' From fee8fe9af6269cb05b1210899107aafb4c4705cd Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Sat, 30 Nov 2024 11:11:55 +0800 Subject: [PATCH 3/8] Remove repoutils. --- .gitignore | 3 - CPPPPKG | 17 ----- ChangeLog | 78 --------------------- FILELIST | 19 ----- cpppdist.py | 195 ---------------------------------------------------- setup.cmd | 42 ----------- setup.sh | 58 ---------------- 7 files changed, 412 deletions(-) delete mode 100644 CPPPPKG delete mode 100644 ChangeLog delete mode 100644 FILELIST delete mode 100755 cpppdist.py delete mode 100644 setup.cmd delete mode 100755 setup.sh diff --git a/.gitignore b/.gitignore index 75b677f..be1a63f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,9 +33,6 @@ Testing .vscode .cache -# Autopull modules -build-aux - # Dist directory and temps cppp-platform-v* __pycache__ diff --git a/CPPPPKG b/CPPPPKG deleted file mode 100644 index 9b7fe2c..0000000 --- a/CPPPPKG +++ /dev/null @@ -1,17 +0,0 @@ -{ - "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" - ] -} diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index d0d88ff..0000000 --- a/ChangeLog +++ /dev/null @@ -1,78 +0,0 @@ -2023-08-24 ChenPi11 - - Optimize the way to import build-aux. - -2023-08-09 ChenPi11 - - Add C++ Plus package infomation. - Update docs. - Add GitHub CI. - Prepare for release v1.3.0. - -2023-08-08 ChenPi11 - - Add CMake buildsystem support. - Add submodule 'build-aux'. - Add NLS Language Map. - -2023-08-07 ChenPi11 - - Update docs. - Change project structure. - Remove Autoconf buildsystem support. - Add ChangeLog. - Rename the project to 'cppp-platform'. - -2023-06-01 ChenPi11 - - 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 - - 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 - - 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 - - 1.0.1 Add Haiku OS support. - -2023-02-18 ChenPi11 - - Update title.h - -2023-02-18 ChenPi11 - - 1.0.0 - -2023-02-18 ChenPi11 - - Initial commit. diff --git a/FILELIST b/FILELIST deleted file mode 100644 index 38fb07b..0000000 --- a/FILELIST +++ /dev/null @@ -1,19 +0,0 @@ -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 diff --git a/cpppdist.py b/cpppdist.py deleted file mode 100755 index f65e6bd..0000000 --- a/cpppdist.py +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (C) 2023 The C++ Plus Project. -# This file is part of the cppp library. -# -# The cppp library is free software; you can redistribute it -# and/or modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. -# -# The cppp 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 GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with the cppp library; see the file COPYING. -# If not, see . - -# C++ Plus dist utils. - -import os -import sys -import json -import shutil -import importlib.util - -PACKAGE_INFO = "CPPPPKG" -PROGNAME = "cpppdist.py" - -def import_file(path): - """ - Import a Python file from it's path - - Args: - path (str): Python file's path - - Raises: - ModuleNotFoundError: When module invalid, load error or not found. - - Returns: - ModuleType: module - """ - spec = importlib.util.spec_from_file_location(os.path.basename(path).replace(".py", ""), path) - if(spec == None): - raise ModuleNotFoundError("Invalid module or module not found: " + path) - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - return module - -class Package: - """ - A dist package type - """ - name = "" - version = "" - list_file_path = "" - filelist = [] - subpackages = {} - - def __init__(self, pkginfo_filepath) -> None: - try: - os.chdir(fwd) - with open(pkginfo_filepath, "r", encoding="UTF-8") as info_file: - data = json.load(info_file) - self.name = data["name"] - self.version = data["version"] - self.list_file_path = data["list_file_path"] - try: - _subpackages = data["subpackages"] - for pkgname in _subpackages: - pkgpath = _subpackages[pkgname]["path"] - try: - pkgmodule = import_file(os.path.join(pkgpath, PROGNAME)) - self.subpackages[pkgpath] = pkgmodule.package - except Exception as e: - if(not _subpackages[pkgname]["ignore"]): - raise - else: - print(f"DEBUG: Ignore a subpackage '{pkgname}': {e}", file=sys.stderr) - except KeyError: - pass - self.filelist = self.get_file_list() - finally: - os.chdir(cwd) - - def get_file_list(self) -> list: - """ - Get file list for dist. - """ - try: - os.chdir(fwd) - file_list = [] - with open(self.list_file_path, "rt", encoding="UTF-8") as list_file: - data = list_file.read() - file_list = data.strip().split("\n") - return file_list - finally: - os.chdir(cwd) - - def copy_files(self, dest): - """ - Copy files to dist dest - """ - try: - os.chdir(fwd) - if(os.path.exists(dest)): - shutil.rmtree(dest) - print(f"Copy package '{self.name}' to '{dest}' ... ", file=sys.stderr) - progressbar = ProgressBar(len(self.filelist)) - for file in self.filelist: - relpath = os.path.relpath(file, fwd) - filedir = os.path.abspath(os.path.join(dest, relpath, "..")) - if(not os.path.exists(filedir)): - os.makedirs(filedir) - shutil.copy(file, os.path.join(dest, relpath)) - progressbar.add(1) - progressbar.end() - print("", end="\n", file=sys.stderr) - # Copy subpackages - for (pkgpath, pkg) in self.subpackages.items(): - pkg.copy_files(os.path.join(dest, os.path.join(dest, pkgpath))) - finally: - os.chdir(cwd) - -class ProgressBar: - """ - Progress bar type. - """ - def __init__(self, total): - self.total = total - self.cur = 0 - sys.stderr.write("\n") - self.update() - - def add(self, step): - """ - Add current value and update. - """ - self.cur += step - self.update() - - def set(self, cur): - """ - Set current value and update. - """ - self.cur = cur - self.update() - - def update(self): - """ - Update progress bar. - """ - try: - progress = 0.0 - if(self.cur): - progress = self.cur / self.total - term_width = os.get_terminal_size(sys.stderr.fileno()).columns - part_width = term_width - len("[]100.0%") - if(part_width <= 0): - # Terminal is too small, ignore. - return - sys.stderr.write("\r") - # Part1 is '#' - part1 = int(part_width * progress) * '#' - # Part2 is ' ' - part2 = int(part_width - len(part1)) * ' ' - # Part3 is 'xxx.x%' - part3 = str(int(progress * 1000) / 10) + "%" - sys.stderr.write(f"[{part1}{part2}]{part3}") - sys.stderr.flush() - except: - return - - def end(self): - """ - End this progress bar - """ - self.set(self.total) - sys.stderr.write("\n") - sys.stderr.flush() - -cwd = os.path.abspath(os.curdir) -fwd = os.path.abspath(os.path.join(__file__, "..")) - -package = None -try: - package = Package(PACKAGE_INFO) -except Exception as exc: - print("Getting packge infomation error:", exc, file=sys.stderr) - raise exc - -if __name__ == "__main__": - distdir = f"{package.name}-v{package.version}" - package.copy_files(os.path.abspath(distdir)) diff --git a/setup.cmd b/setup.cmd deleted file mode 100644 index 21bbdf8..0000000 --- a/setup.cmd +++ /dev/null @@ -1,42 +0,0 @@ -@echo off -rem Setup a repository during individual development. -rem -rem This script requires git program in the PATH. - -rem Copyright (C) 2023 The C++ Plus Project. -rem -rem This program is free software: you can redistribute it and/or modify -rem it under the terms of the GNU Lesser General Public License as published by -rem the Free Software Foundation; either version 3 of the License, or -rem (at your option) any later version. -rem -rem This program is distributed in the hope that it will be useful, -rem but WITHOUT ANY WARRANTY; without even the implied warranty of -rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -rem GNU Lesser General Public License for more details. -rem -rem You should have received a copy of the GNU Lesser General Public License -rem along with this program. If not, see . - -rem Usage: setup.cmd - -if exist .\build-aux ( - echo Success: '.\build-aux' is exists, please don't remove it, and you can develop this package normally. - goto QUIT -) - -if exist ..\build-aux ( - echo Success: '..\build-aux' is exists, please don't remove it, and you can develop this package normally. - goto QUIT -) - -echo Notice: '..\build-aux' for C++ Plus are not exists, cloning it...... -git clone https://github.com/cppp-project/build-aux -if %errorlevel%==0 ( - echo Success: '.\build-aux' cloned successfully, please don't remove it, and you can develop this package normally. -) else ( - echo Error: .\build-aux' cloned failed, you can clone it by yourself or copy it from C++ Plus release source package. - echo Notice: try to run 'git clone https://github.com/cppp-project/build-aux'. -) - -:QUIT diff --git a/setup.sh b/setup.sh deleted file mode 100755 index a6b5997..0000000 --- a/setup.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env sh -# Setup a repository during individual development. -# -# This script requires git program in the PATH. - -# Copyright (C) 2023 The C++ Plus Project. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program 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 -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -# Usage: ./setup.sh -# - -# Usage: text_out [color_id] [level] [msg] -text_out() -{ - echo "\033[$1m$2: $3 \033[0m" -} - -# Usage: execute [command] -execute() -{ - text_out 94 "$1" - $1 - return $? -} - -if test -d './build-aux' -then - text_out 32 "Success" "'./build-aux' is exists, please don't remove it, and you can develop this package normally." - exit 0 -fi - -if test -d '../build-aux' -then - text_out 32 "Success" "'../build-aux' is exists, please don't remove it, and you can develop this package normally." - exit 0 -fi - -text_out 0 "Notice" "'../build-aux' for C++ Plus are not exists, cloning it......" -execute "git clone https://github.com/cppp-project/build-aux" -if [ $? -eq 0 ] -then - text_out 32 "Success" "'./build-aux' cloned successfully, please don't remove it, and you can develop this package normally." -else - text_out 31 "Error" "'./build-aux' cloned failed, you can clone it by yourself or copy it from C++ Plus release source package." - text_out 0 "Notice" "try to run 'git clone https://github.com/cppp-project/build-aux'. " -fi From 28cfa3edc3bd80f3b97623743e221ce3d6939ff4 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Sat, 30 Nov 2024 11:14:29 +0800 Subject: [PATCH 4/8] Remove copyright notice and rename `COPYING` to `LICENSE`. --- CMakeLists.txt | 16 ---------------- COPYING => LICENSE | 0 README.md | 4 ++-- include/cppp/cppp-platform.h.in | 1 - 4 files changed, 2 insertions(+), 19 deletions(-) rename COPYING => LICENSE (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1630cef..8f6d41f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,3 @@ -# Copyright (C) 2024 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 . - cmake_minimum_required(VERSION 3.10) project(cppp-platform VERSION 1.3.0) diff --git a/COPYING b/LICENSE similarity index 100% rename from COPYING rename to LICENSE diff --git a/README.md b/README.md index b8f9f02..5a9b590 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Introduction -cppp-platform is a portable platform check library for C++ Plus. +cppp-platform is a portable platform check library for C+++. # Build ## Dependence -+ CMake (version >= 3.12) ++ CMake (version >= 3.10) ## Command ```shell diff --git a/include/cppp/cppp-platform.h.in b/include/cppp/cppp-platform.h.in index cdb393c..92706a6 100644 --- a/include/cppp/cppp-platform.h.in +++ b/include/cppp/cppp-platform.h.in @@ -1,7 +1,6 @@ /** * @file cppp/cppp-platform.h * @author ChenPi11 - * @copyright Copyright (C) 2024 The C++ Plus Project * @brief C++ Plus platform predefined detection. * @version @PROJECT_VERSION@ * @see https://github.com/cpredef/predef From 483fc21906efd2d24dd817752fcea5762bbb90a3 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Sat, 30 Nov 2024 11:27:45 +0800 Subject: [PATCH 5/8] Add example. --- CMakeLists.txt | 15 ++++++++++++--- README.md | 37 ++++++++++--------------------------- src/example.c | 27 +++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 30 deletions(-) create mode 100644 src/example.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f6d41f..e2c2385 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.10) project(cppp-platform VERSION 1.3.0) +option(BUILD_EXAMPLE "Build example" OFF) + # Read source files file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/architectures.h" ARCHITECTURES) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/compilers.h" COMPILERS) @@ -8,12 +10,19 @@ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/languagestandards.h" LANGUAGESTANDARD file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/platforms.h" PLATFORMS) # Genetate header -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/cppp/cppp-platform.h.in" "${output_includedir}/cppp/cppp-platform.h") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/cppp/cppp-platform.h.in" "${CMAKE_BINARY_DIR}/include/cppp/cppp-platform.h") + +# Build example +if(BUILD_EXAMPLE) + add_executable(example "${CMAKE_CURRENT_SOURCE_DIR}/src/example.c") + target_include_directories(example PRIVATE "${CMAKE_BINARY_DIR}/include") +endif() + # Install # Includes # PERMISSIONS 0644 -install(FILES "${output_includedir}/cppp/cppp-platform.h" - DESTINATION "${install_includedir}" +install(FILES "${CMAKE_BINARY_DIR}/include/cppp/cppp-platform.h" + DESTINATION "${CMAKE_INSTALL_PREFIX}/include" RENAME "cppp/cppp-platform.h" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) diff --git a/README.md b/README.md index 5a9b590..84776e4 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,22 @@ -# Introduction -cppp-platform is a portable platform check library for C+++. +# cppp-platfrom -- Portable platform check library + +## Build + +### Dependencies -# Build -## Dependence + CMake (version >= 3.10) -## Command +### Command + ```shell mkdir build cd build cmake .. -DCMAKE_INSTALL_PREFIX=[[PREFIX]] +# If you want to build the example, add -DBUILD_EXAMPLE=ON cmake --build . cmake --install . ``` -# Example -After install, you can use cppp-platform in C/C++ -```c -#include -#include -int main() -{ - if(__has_windows__) - { - printf("Compile in Windows!\n"); - } - else - { - printf("Compile non-Windows!\n"); - } - printf("Target arch:%s\n",__arch__); - printf("Target arch name:%s\n",__arch_name__); - printf("Pointer width:%d\n",__POINTER_WIDTH__); -} -``` +## Documentation -# Manual -[User Manual](doc/doc.md) +[Documentation](doc/doc.md) diff --git a/src/example.c b/src/example.c new file mode 100644 index 0000000..f6ad172 --- /dev/null +++ b/src/example.c @@ -0,0 +1,27 @@ +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc != 1) + { + fprintf(stderr, "Usage: %s\n", argv[0]); + return EXIT_FAILURE; + } + + if (__has_windows__) + { + printf("Running on Windows!\n"); + } + else + { + printf("Running non-Windows!\n"); + } + printf("Target architcture id: %d\n", __arch__); + printf("Target arch name: %s\n", __arch_name__); + printf("Pointer width: %d\n", __POINTER_WIDTH__); + + return EXIT_SUCCESS; +} From 6414a08faf196a48e044ac3806ee8dc2c189dccd Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Sat, 30 Nov 2024 11:54:35 +0800 Subject: [PATCH 6/8] Update documents. --- doc/architectures.md | 75 ++++++++++++++++++++++++++++------------ doc/compilers.md | 52 +++++++++++++++++++--------- doc/doc.md | 3 +- doc/languagestandards.md | 73 ++++++++++++++++++++++++++++---------- doc/platforms.md | 54 +++++++++++++++++++---------- 5 files changed, 180 insertions(+), 77 deletions(-) diff --git a/doc/architectures.md b/doc/architectures.md index c3b8892..e3878a0 100644 --- a/doc/architectures.md +++ b/doc/architectures.md @@ -1,14 +1,23 @@ # Architectures + ## Source -src/architectures.h -## Content + +[src/architectures.h](https://github.com/cppp-project/cppp-platform/blob/main/src/architectures.h) + +## Contents + ### \_\_arch\_\_ -#### Type -macros -#### Description -Represents the processor architecture type -If the judgment fails, the value is '\_\_arch_unknown\_\_' -#### We provide preset architecture macros + +#### The type of \_\_arch\_\_ + +macro + +#### Description of \_\_arch\_\_ + +Represents the processor architecture type. If the judgment fails, the value is set to '\_\_arch_unknown\_\_'. + +#### Value of \_\_arch\_\_ + | Architecture | Macro | | :----: | :----: | | Alpha | \_\_arch_alpha\_\_ | @@ -31,40 +40,60 @@ If the judgment fails, the value is '\_\_arch_unknown\_\_' | TMS470 | \_\_arch_tms470\_\_8 | | Unknown architecture | \_\_arch_unknown\_\_ | -#### Usage +#### Example of \_\_arch\_\_ + ```c #include + #if (__arch__ == __arch_x86__) -#pragma message "Build in x86 arch" +#pragma message "Build in x86." #elif (__arch__ == __arch_arm__) -#pragma message "Build in arm arch" +#pragma message "Build in arm." #elif -#pragma message "Build in other arch" +#pragma message "Build in other." #endif -int main(){} + +int main() +{ + return 0; +} ``` + ### \_\_arch_name\_\_ -#### Type + +#### Type of \_\_arch_name\_\_ + macro -#### Description -Architecture name, like 'uname -m' -If the judgment fails, the value is "unknown" -#### Usage + +#### Description of \_\_arch_name\_\_ + +Architecture name, like `uname -m`. If the judgment fails, the value is `"Unknown"`. + +#### Example of \_\_arch_name\_\_ + ```c #include + #include + int main() { printf("Arch name: %s\n", __arch_name__); } ``` + ### \_\_POINTER_WIDTH\_\_ -#### Type + +#### Type of \_\_POINTER_WIDTH\_\_ + macro -#### Description -This represents the calculation formula for pointer length -The value is generally 32 or 64 -#### Usage + +#### Description of \_\_POINTER_WIDTH\_\_ + +This represents the pointer length. The value is generally 32 or 64. + +#### Example of \_\_POINTER_WIDTH\_\_ + ```c #include #include diff --git a/doc/compilers.md b/doc/compilers.md index 3861145..fafee4c 100644 --- a/doc/compilers.md +++ b/doc/compilers.md @@ -1,24 +1,27 @@ # Compilers + ## Source -src/compilers.h + +[src/compilers.h](https://github.com/cppp-project/cppp-platform/blob/main/src/compilers.h) + ## Content + ### \_\_has_xxx_compiler\_\_ -#### Type -macros -#### Description -1 if there is a corresponding compiler, otherwise 0. -The 'xxx' here refers to the compiler name, and details can be found in the 'src/compilers.h' source code. - -**Note: An environment may contain multiple compiler environments.** -#### Usage -```c -#include -#if __has_msvc_compiler__ -#error "This project do not support MSVC!" -#endif -int main(){} -``` -#### We provide preset compiler macros + +#### Type of \_\_has_xxx_compiler\_\_ + +macro + +#### Description of \_\_has_xxx_compiler\_\_ + +`1` if there is a corresponding compiler, otherwise `0`. + +The 'xxx' here refers to the compiler name, and details can be found in the `src/compilers.h` source code. + +**Note: An environment may contain multiple compiler environments, so multiple compiler macros may be defined at the same time. e.g. `__has_gcc_compiler__`, `__has_clang_compiler__`.** + +#### Compiler List + | Compiler | Macro | | :----: | :----: | | ACC | \_\_has_acc_compiler\_\_ | @@ -92,3 +95,18 @@ int main(){} | VBCC | \_\_has_vbcc_compiler\_\_ | | Watcom C++ | \_\_has_watcom_compiler\_\_ | | Zortech C++ | \_\_has_zortech_compiler\_\_ | + +#### Example of \_\_has_xxx_compiler\_\_ + +```c +#include + +#if __has_msvc_compiler__ +#error "This project do not support MSVC!" +#endif + +int main() +{ + return 0; +} +``` diff --git a/doc/doc.md b/doc/doc.md index ff30986..89510ae 100644 --- a/doc/doc.md +++ b/doc/doc.md @@ -1,4 +1,5 @@ -# cppp-platform Manual +# cppp-platform Documentation + [Architectures](./architectures.md) [Compilers](./compilers.md) diff --git a/doc/languagestandards.md b/doc/languagestandards.md index c05337b..ddcd58f 100644 --- a/doc/languagestandards.md +++ b/doc/languagestandards.md @@ -1,44 +1,81 @@ # C/C++ Standards + ## Source -src/languagestandards.h + +[src/languagestandards.h](https://github.com/cppp-project/cppp-platform/blob/main/src/languagestandards.h) + ## Content -## \_\_has_cXX\_\_ -#### Type -macros -#### Description + +### \_\_has_cXX\_\_ + +#### Type of \_\_has_cXX\_\_ + +macro + +#### Description of \_\_has_cXX\_\_ + The 'XX' here refers to the C standard, and details can be found in the 'src/languagestandards.h' source code. + #### Usage + ```c #include + #if __has_c11__ #pragma message "You are in C11." #endif -int main(){} + +int main() +{ + return 0; +} ``` -## \_\_has_cppXX\_\_ -#### Type -macros -#### Description -The 'XX' here refers to the C++ standard, and details can be found in the 'src/languagestandards.h' source code. -#### Usage + +### \_\_has_cppXX\_\_ + +#### Type of \_\_has_cppXX\_\_ + +macro + +#### Description of \_\_has_cppXX\_\_ + +The 'XX' here refers to the C++ standard, and details can be found in the `src/languagestandards.h` source code. + +#### Usage of \_\_has_cppXX\_\_ + ```c #include + #if __has_cpp17__ #pragma message "You are in C++17." #endif -int main(){} + +int main() +{ + return 0; +} ``` -## \_\_cpp_version\_\_ -#### Type + +### \_\_cpp_version\_\_ + +#### Type of \_\_cpp_version\_\_ + macro -#### Description + +#### Description of \_\_cpp_version\_\_ + C++ standard for fixing issues with '\_MSVC_LANG' -### Usage + +### Usage of \_\_cpp_version\_\_ + ```cpp #include + #include + int main() { - std::cout<<__cpp_version__<<"\n"; + std::cout << __cpp_version__ << std::endl; + return EXIT_SUCCESS; } ``` diff --git a/doc/platforms.md b/doc/platforms.md index c9ffe41..8621c66 100644 --- a/doc/platforms.md +++ b/doc/platforms.md @@ -1,24 +1,27 @@ # Platforms + ## Source -src/platforms.h + +[src/platforms.h](https://github.com/cppp-project/cppp-platform/blob/main/src/platforms.h) + ## Content -## \_\_has_xxx\_\_ -#### Type -macros -#### Description -If there is a corresponding OS environment, it is 1, otherwise it is 0. -The 'xxx' here refers to the OS name, and details can be found in the 'src/platforms.h' source code. - -**Note: An compile environment may contain multiple environments** -#### Usage -```c -#include -#if __has_windows__ -#error "We do not support Windows!" -#endif -int main(){} -``` + +### \_\_has_xxx\_\_ + +#### Type of \_\_has_xxx\_\_ + +macro + +#### Description of \_\_has_xxx\_\_ + +If there is a corresponding OS environment, it is `1`, otherwise it is `0`. + +The 'xxx' here refers to the OS name, and details can be found in the `src/platforms.h` source code. + +**Note: An compile environment may contain multiple environments at the same time. e.g. Cygwin Environment is a Unix-like environment, but it is also a Windows environment.** + #### We provide preset compiler macros + | Platform | Macro | | :----: | :----: | | AIX | \_\_has_aix\_\_ | @@ -51,7 +54,7 @@ int main(){} | MinGW | \_\_has_mingw\_\_ | | MorphOS | \_\_has_morph_os\_\_ | | MPE/iX | \_\_has_mpe_ix\_\_ | -| MSDOS (C++ Plus C unsupport platform) | \_\_has_dos\_\_ | +| MSDOS | \_\_has_dos\_\_ | | NonStop | \_\_has_non_stop\_\_ | | Nucleus RTOS | \_\_has_nucleus\_\_ | | OS/2 | \_\_has_os2\_\_ | @@ -80,3 +83,18 @@ int main(){} | Windows CE | \_\_has_windows_ce\_\_ | | Wind/U Environment | \_\_has_windu\_\_ | | z/OS | \_\_has_zos\_\_ | + +#### Example of \_\_has_xxx\_\_ + +```c +#include + +#if __has_windows__ +#error "We do not support Windows!" +#endif + +int main() +{ + return 0; +} +``` From ef55887d711a76276e48faf7241841040b32e468 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Sat, 30 Nov 2024 11:55:04 +0800 Subject: [PATCH 7/8] Change unknown arch's `__arch_name__` to `Unknown`. --- src/architectures.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/architectures.h b/src/architectures.h index 19f4632..e19981f 100644 --- a/src/architectures.h +++ b/src/architectures.h @@ -38,7 +38,7 @@ #define __arch_unknown__ 0 #define __arch__ __arch_unknown__ -#define __arch_name__ "unknown" +#define __arch_name__ "Unknown" #if defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) #undef __arch__ #undef __arch_name__ From 8440bb4f7a085ce3c93f67fb7ab29a63844eaab4 Mon Sep 17 00:00:00 2001 From: ChenPi11 Date: Sat, 30 Nov 2024 13:13:02 +0800 Subject: [PATCH 8/8] Use Rubisco to manage the project. --- .github/workflows/build.yml | 110 +++++------------------------------- .gitignore | 4 +- .rubisco/build.yaml | 43 ++++++++++++++ repo.json | 38 +++++++++++++ 4 files changed, 98 insertions(+), 97 deletions(-) create mode 100644 .rubisco/build.yaml create mode 100644 repo.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61d5c21..5ffd0bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,124 +6,42 @@ on: jobs: - build-dist: + build: 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 + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.13" - 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/* + python -m pip install --upgrade pip + python -m pip install rubisco - 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 + - name: 🛠️ Build distribution 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 .. + rubisco build - 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 + for i in $(ls) ; do sha256sum $i > $i.sha256 ; done cd .. #--------------------------------------------publish-------------------------------------------- - name: ⬆️ Create release and upload assets - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') with: - tag_name: ${{ env.tag }} - files: ./dist/* + files: ./dist/* diff --git a/.gitignore b/.gitignore index be1a63f..4f9274d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # CMake build files build/ +dist/ +install/ CMakeFiles *.so *.so.*.*.* @@ -34,5 +36,5 @@ Testing .cache # Dist directory and temps -cppp-platform-v* +cppp-platform-* __pycache__ diff --git a/.rubisco/build.yaml b/.rubisco/build.yaml new file mode 100644 index 0000000..7a9224d --- /dev/null +++ b/.rubisco/build.yaml @@ -0,0 +1,43 @@ +name: 🛠️ Build cppp-platfrom + +steps: + - name: 📦 Make source distribution directory + mkdir: ${{ project.name }}-${{ project.version }} + - mkdir: dist + + - name: 📦 Copy files to source distribution directory + copy: ${{ cwd }} + to: ${{ project.name }}-${{ project.version }} + excludes: + [ + ".git*", + "build", + "dist", + "*.7z", + "*.gz", + "*.xz", + "*.zip", + ".vscode", + ".rubisco/extensions", + "${{ project.name }}-*", + ] + + - name: 📦 Packing the source distribution + compress: ${{ project.name }}-${{ project.version }} + to: dist/${{ project.name }}-${{ project.version }} + format: [zip, tar.xz] + + - name: 🛠️ Build the project. + mkdir: build + - cwd: build + run: ["cmake", "..", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=install"] + - cwd: build + run: ["cmake", "--build", ".", "--config", "Release"] + - cwd: build + run: ["cmake", "--install", ".", "--config", "Release"] + + - name: 📦 Packing the binary distribution. + compress: build/install + start: build + to: dist/${{ project.name }}-${{ project.version }}-unknown-unknown-unknown + format: [zip, tar.xz] diff --git a/repo.json b/repo.json new file mode 100644 index 0000000..a53e27c --- /dev/null +++ b/repo.json @@ -0,0 +1,38 @@ +{ + "name": "cppp-platform", + "version": "1.4.0", + "description": "C+++ portable platform check library.", + "maintainer": "ChenPi11 ", + "license": "Unlicense", + "hooks": { + "build": { + "run": ".rubisco/build.yaml" + }, + "format": { + "exec": "python -m ruff format rubisco" + }, + "test": { + "run": ".rubisco/test.yaml" + }, + "clean": { + "workflow": [ + { + "name": "Clean workflow", + "remove": [ + "build", + "dist", + "*/**/__pycache__", + ".rubisco/*.log", + "*.7z", + "*.gz", + "*.xz", + "*.zip", + "rubisco-*" + ], + "strict": false + } + ] + } + } + } + \ No newline at end of file