ジェネレータオプション
ジェネレータは以下のオプションを受け付けます:
| オプション | 短縮形 | デフォルト | 説明 |
|---|---|---|---|
--name |
-n |
"MyApp" | プロジェクト名 |
--author |
-a |
"Your Name" | 作者名 |
--version |
-v |
"1.0.0" | バージョン |
--output |
-o |
プロジェクト名から生成 | 出力ディレクトリ |
--with-git |
- | false | Gitリポジトリを初期化 |
--help |
-h |
- | ヘルプを表示 |
使用例
基本的な使用方法
# デフォルト設定で生成
deno run --allow-read --allow-write --allow-run \
https://raw.githubusercontent.com/COx2/deno-advent-calender-2025/main/generator/generate.ts
カスタム設定
# すべてのオプションを指定
deno run --allow-read --allow-write --allow-run \
https://raw.githubusercontent.com/COx2/deno-advent-calender-2025/main/generator/generate.ts \
--name "GameEngine" \
--author "John Doe" \
--version "0.1.0" \
--output ./my-game-engine \
--with-git
短縮形オプション
deno run --allow-read --allow-write --allow-run \
https://raw.githubusercontent.com/COx2/deno-advent-calender-2025/main/generator/generate.ts \
-n "MyLib" -a "Developer" -o ./mylib
ビルドコマンド
生成されたプロジェクトでは、以下のDenoタスクが使用できます:
ビルドコマンド
| コマンド | 説明 |
|---|---|
deno task build |
Releaseモードでビルド |
deno task build:debug |
Debugモードでビルド |
deno task build:release |
Releaseモードでビルド(明示的) |
deno task clean |
ビルドディレクトリを削除 |
deno task rebuild |
クリーン後にリビルド |
deno task test |
ビルド後に実行ファイルを実行 |
開発コマンド
| コマンド | 説明 |
|---|---|
deno task format |
TypeScriptファイルをフォーマット |
deno task format:check |
フォーマットをチェック |
deno task lint |
TypeScriptファイルをLint |
ビルドスクリプトオプション
ビルドスクリプトを直接実行する場合の追加オプション:
# クリーンのみ
deno run --allow-all ./build.ts --clean
# Debugビルド
deno run --allow-all ./build.ts --config Debug
# ビルド後にテスト実行
deno run --allow-all ./build.ts --test
# Ninjaジェネレータを使用(インストールされている場合)
deno run --allow-all ./build.ts --generator Ninja
Note (Windows):
Windowsではデフォルトで "Visual Studio 17 2022" ジェネレータが使用されます。
Ninjaがインストールされている場合は
--generator Ninja で高速なビルドが可能です。
ビルド出力
ビルドすると以下のターゲットが生成されます:
静的ライブラリ
[project]_core
計算機能などのコア機能を提供
- Windows:
build/Release/[project]_core.lib - Unix:
build/lib/lib[project]_core.a
共有ライブラリ
[project]_utils
ユーティリティ関数を提供
- Windows:
build/Release/[project]_utils.dll - macOS:
build/lib/lib[project]_utils.dylib - Linux:
build/lib/lib[project]_utils.so
実行ファイル
[project]
両方のライブラリを使用するメインアプリケーション
- Windows:
build/Release/[project].exe - Unix:
build/bin/[project]
ディレクトリ構造の違い
build/
├── Release/ # Releaseビルド成果物
│ ├── myapp.exe
│ ├── myapp_core.lib
│ ├── myapp_utils.dll
│ ├── myapp_utils.lib # インポートライブラリ
│ └── myapp_utils.exp
└── Debug/ # Debugビルド成果物
└── ...
build/
├── bin/ # 実行ファイル
│ └── myapp
└── lib/ # ライブラリ
├── libmyapp_core.a
└── libmyapp_utils.so (or .dylib)
カスタマイズ
ビルド設定の変更
build.config.ts を編集してプロジェクト設定を変更できます:
export const config: BuildConfig = {
projectName: "MyApp",
version: "1.0.0",
author: "Your Name",
buildTypes: ["Debug", "Release"],
};
CMake設定の変更
CMakeLists.txt を編集して、ライブラリの追加や設定の変更が可能です。
新しいソースファイルの追加
src/以下に新しいファイルを作成CMakeLists.txtの該当ターゲットにファイルを追加deno task rebuildでリビルド
トラブルシューティング
CMake not found
CMakeがインストールされていることを確認してください:
cmake --version
Deno permission errors
ビルドスクリプトには適切な権限が必要です:
deno run --allow-all build.ts
Build errors
ビルドディレクトリをクリーンしてから再試行:
deno task clean
deno task build
DLL not found (Windows)
実行ファイルとDLLは同じディレクトリに配置されます。 実行ファイルを移動する場合は、DLLも一緒にコピーしてください。