pcmake
pcmake 是一個輕量級、跨平台的 C/C++ 專案建置工具。
安裝
pip install pcmake
使用方法
在專案目錄下建立
檔案: Pcmakefile
app = target("ssl_app")
app.set_kind("binary")
app.add_files("main.c", "math_utils.c")
app.add_packages("openssl")
檔案: main.c
#include <stdio.h>
#include <string.h>
#include <openssl/sha.h> // 由 pmake 的 add_packages("openssl") 處理路徑
#include "math_utils.h"
int main() {
// 1. 測試自定義函式庫
int num = 5;
printf("--- pmake 跨平台測試 ---\n");
printf("數字 %d 的平方是: %d\n", num, square(num));
// 2. 測試 OpenSSL SHA256
const char *data = "Hello Gemini & pmake!";
unsigned char hash[SHA256_DIGEST_LENGTH];
// 呼叫 OpenSSL 函式
SHA256((unsigned char*)data, strlen(data), hash);
printf("字串: \"%s\"\n", data);
printf("SHA256 結果: ");
for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) {
printf("%02x", hash[i]);
}
printf("\n------------------------\n");
return 0;
}
檔案: math_util.h
#ifndef MATH_UTILS_H
#define MATH_UTILS_H
int square(int a);
#endif
檔案: math_util.c
#include "math_utils.h"
int square(int a) {
return a * a;
}
然後執行建置:
pcmake build
這樣就會產生
(venv) cccuser@cccimacdeiMac hello_pcmake % ls -all
total 104
drwxr-xr-x@ 8 cccuser staff 256 Mar 15 17:32 .
drwxr-xr-x@ 3 cccuser staff 96 Mar 15 17:32 ..
drwxr-xr-x@ 4 cccuser staff 128 Mar 15 17:32 .pmake_cache
-rw-r--r--@ 1 cccuser staff 752 Mar 15 20:14 main.c
-rw-r--r--@ 1 cccuser staff 64 Mar 15 16:14 math_utils.c
-rw-r--r--@ 1 cccuser staff 69 Mar 15 16:01 math_utils.h
-rw-r--r--@ 1 cccuser staff 195 Mar 15 16:28 Pcmakefile
-rwxr-xr-x@ 1 cccuser staff 33688 Mar 15 17:32 ssl_app
最後你就可以執行
(venv) cccuser@cccimacdeiMac hello_pcmake % ./ssl_app
--- pmake 跨平台測試 ---
數字 5 的平方是: 25
字串: "Hello Gemini & pmake!"
SHA256 結果: a44b648ff26615cb44c163c246ed18fd89cd4991f025bc13cff3d876bbd32b7d
------------------------
Metadata
Release files for pcmake 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pcmake-0.1.1.tar.gz | 5.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pcmake-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / pcmake-0.1.1.tar.gz
| Download URL | pcmake-0.1.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ce010c988707bb523bc82642333bcf98210c4826cf0c2d1f963be8f0ae412a5
|
|
BLAKE2b-256 checksum How to use checksums |
93143406f8db7f2ce0594787d3e08efaa94f41824300327f3fc170bcbe16d787
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / pcmake-0.1.1-py3-none-any.whl
| Download URL | pcmake-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75cea04de3081179902314544fdfab69a6b4f702db4e32d4dc5794d9309ccee5
|
|
BLAKE2b-256 checksum How to use checksums |
1ee6a3726f4e0654ae3abf825db2cb3482ab3992f962a4320ebc37d9b02216c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for pcmake 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.