Skip to content

Commit

Permalink
feat: cmake port. (#92)
Browse files Browse the repository at this point in the history
* chore: add cmake install using pipi port

* wip: wip cmake port

* wip: cmake port

* fix: remove example and add test

* fix: bad test on cmake

* chore: refactor test & add version on cmake port

* refactor: add code comments

---------

Co-authored-by: Yohe-Am <[email protected]>
  • Loading branch information
destifo and Yohe-Am authored Jul 1, 2024
1 parent 7458536 commit 8d50518
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 10 deletions.
49 changes: 49 additions & 0 deletions ports/cmake.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { InstallConfigFat, InstallConfigSimple } from "../port.ts";
import { AsdfInstallConf } from "./asdf.ts";
import { PipiInstallConf } from "./pipi.ts";
import * as ports from "./mod.ts";

/**
* Port to install cmake
*
* For macOS users, you need to add python as allowed build dependencies
* as cmake is downladed via pip install.
*
* Example:
* ```typescript
* const installs = {
python_latest: ports.cpy_bs({ version: "3.12.2", releaseTag: "20240224" }),
};
* config({
stdDeps: true,
allowedBuildDeps: [
installs.python_latest
],
enableRuntimes: true
});
* ```
*
*/
export default function conf(
config: InstallConfigSimple,
): InstallConfigFat[] {
/*
The universal macOS cmake build downloaded by asdf crashes
due to security restrictions in macOS, so it's installed using pipi port instead, which runs with no problems.
*/
if (Deno.build.os === "darwin") {
const pipiConfig: PipiInstallConf = {
packageName: "cmake",
version: config.version,
};
return ports.pipi(pipiConfig);
}
const asdfConfig: AsdfInstallConf = {
...config,
pluginRepo: "https://github.com/asdf-community/asdf-cmake",
installType: "version",
version: config.version,
};

return [ports.asdf(asdfConfig)];
}
1 change: 1 addition & 0 deletions ports/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export { default as act } from "./act.ts";
export { default as asdf } from "./asdf.ts";
export { default as cargo_binstall } from "./cargo-binstall.ts";
export { default as cargobi } from "./cargobi.ts";
export { default as cmake } from "./cmake.ts";
export { default as cpy_bs } from "./cpy_bs.ts";
export { default as curl } from "./curl.ts";
export { default as deno_ghrel } from "./deno_ghrel.ts";
Expand Down
2 changes: 1 addition & 1 deletion ports/pipi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import cpy_bs from "./cpy_bs.ts";
import * as std_ports from "../modules/ports/std.ts";

const manifest = {
export const manifest = {
ty: "denoWorker@v1" as const,
name: "pipi_pypi",
version: "0.1.0",
Expand Down
18 changes: 9 additions & 9 deletions tests/ports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,21 @@ const cases: CustomE2eTestCase[] = [
: `meta --version && wasmedge --version`,
ignore: testTargetPlatform == "linux/aarch64",
},
// 77 meg +
{
name: "asdf-cmake",
installConf: ports.asdf({
pluginRepo: "https://github.com/asdf-community/asdf-cmake",
installType: "version",
}),
ePoint: `cmake --version`,
},
// 80 meg
{
name: "cpy_bs",
installConf: ports.cpy_bs(),
ePoint: `python3 --version`,
},
// 77 meg +, depends on "cpy_bs" on darwin/macos
{
name: "cmake",
installConf: ports.cmake({}),
ePoint: `cmake --version`,
secureConf: {
enableRuntimes: true,
},
},
// 80 meg +
{
name: "pipi-poetry",
Expand Down

0 comments on commit 8d50518

Please sign in to comment.