diff --git a/.vsconfig b/.vsconfig new file mode 100644 index 0000000..d1b5302 --- /dev/null +++ b/.vsconfig @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedDesktop" + ] +} diff --git "a/docs/02_ENV/ENV_01_\351\226\213\347\231\272\347\222\260\345\242\203\346\247\213\347\257\211\346\211\213\351\240\206.txt" "b/docs/02_ENV/ENV_01_\351\226\213\347\231\272\347\222\260\345\242\203\346\247\213\347\257\211\346\211\213\351\240\206.txt" index 81c6fe2..b493331 100644 --- "a/docs/02_ENV/ENV_01_\351\226\213\347\231\272\347\222\260\345\242\203\346\247\213\347\257\211\346\211\213\351\240\206.txt" +++ "b/docs/02_ENV/ENV_01_\351\226\213\347\231\272\347\222\260\345\242\203\346\247\213\347\257\211\346\211\213\351\240\206.txt" @@ -2,27 +2,75 @@ 開発環境構築手順 (Development Environment Setup) ======================================================================== -1. 必要なソフトウェア (Required Software) +1. セットアップ方法の選択 (Setup Method) ------------------------------------------------------------------------ -1-1. Visual Studio 2022 +1-1. 自動セットアップ(推奨) + + リポジトリルートの `setup.ps1` を使用することで,Visual Studio の + インストール,データフォルダの作成,NuGet パッケージの復元を + 自動化できる. + + ■ 実行手順 + + 1. PowerShell を管理者権限で開く. + 2. リポジトリのルートに移動する. + + $ cd [リポジトリのパス] + + 3. スクリプトの実行ポリシーを一時的に変更する. + + $ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass + + 4. セットアップスクリプトを実行する. + + $ .\setup.ps1 + + 5. スクリプト完了後,IC Imaging Control SDK を手動でインストールする. + - 詳細は「2-2. IC Imaging Control SDK」を参照する. + + ■ 自動化される内容 + + ・Visual Studio 2022 のインストール(未インストール時のみ) + - `.vsconfig` により「.NET デスクトップ開発」ワークロードが + 自動で設定される. + ・`C:\TIAS_Data` フォルダの作成(未作成時のみ) + ・NuGet パッケージの復元 + + ■ 自動化されない内容(手動対応が必要) + + ・IC Imaging Control SDK のインストール + ・実行時設定ファイルの配置(config.xml,カメラ設定 XML,CSV) + +1-2. 手動セットアップ + + スクリプトを使用しない場合は,以下のセクション 2〜4 の手順に + 従って手動で構築する. + + +2. 必要なソフトウェア (Required Software) +------------------------------------------------------------------------ + +2-1. Visual Studio 2022 ・公式サイトからインストーラをダウンロードしてインストールする. ・ワークロード選択で「.NET デスクトップ開発」を有効にする. + ・リポジトリルートの `.vsconfig` をインストーラで読み込むと, + 必要なワークロードが自動で提案される. -1-2. IC Imaging Control SDK +2-2. IC Imaging Control SDK ・The Imaging Source が提供するカメラ制御ライブラリ. ・ImagingSource 製カメラ(DFK33UX178,DFK23UX249)の使用に必要. ・インストール後,参照 DLL が Visual Studio から認識されることを確認する. -1-3. Lumenera SDK +2-3. Lumenera SDK ・Lumenera 製カメラ(Lw110)の使用に必要. ・`lumenera.api.dll` はリポジトリ内に同梱されている. -2. リポジトリのセットアップ (Repository Setup) +3. リポジトリのセットアップ (Repository Setup) ------------------------------------------------------------------------ 1. リポジトリのクローン @@ -43,23 +91,24 @@ ・「ビルド」→「ソリューションのビルド」を実行し,エラーがないことを確認する. -3. 実行時の準備 (Runtime Preparation) +4. 実行時の準備 (Runtime Preparation) ------------------------------------------------------------------------ -3-1. 設定ファイルの配置 +4-1. 設定ファイルの配置 ・`TIASshot/config.xml` が実行ファイルと同じディレクトリに存在することを確認する. ・パラメータの詳細は `SPEC_02_設定ファイル仕様.txt` を参照する. -3-2. カメラ設定ファイルの確認 +4-2. カメラ設定ファイルの確認 ・ImagingSource カメラを使用する場合,以下のファイルが同ディレクトリに必要. - `DFK33UX178.xml` - `DFK23UX249.xml` -3-3. TCC参照ファイルの確認 +4-3. TCC参照ファイルの確認 ・以下の CSV ファイルが実行ファイルと同じディレクトリに必要. - `tcc_srgb.csv`: sRGB 変換の参照値 - `tcc_xyz.csv`: XYZ 変換の参照値 -3-4. データ保存フォルダの確認 +4-4. データ保存フォルダの確認 ・`config.xml` の `` に指定したフォルダへの書き込み権限があることを確認する. ・デフォルトは `C:\TIAS_Data`. + ・`setup.ps1` を実行した場合,このフォルダは自動で作成される. diff --git a/setup.ps1 b/setup.ps1 new file mode 100644 index 0000000..0529d88 --- /dev/null +++ b/setup.ps1 @@ -0,0 +1,89 @@ +# ============================================================================= +# TIASshot 開発環境セットアップスクリプト +# 実行方法: PowerShell を管理者権限で開き,以下を実行する +# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass +# .\setup.ps1 +# ============================================================================= + +$ErrorActionPreference = "Stop" + +Write-Host "========================================" -ForegroundColor Cyan +Write-Host " TIASshot 開発環境セットアップ" -ForegroundColor Cyan +Write-Host "========================================" -ForegroundColor Cyan +Write-Host "" + +# ----------------------------------------------------------------------------- +# Step 1: Visual Studio 2022 のインストール +# ----------------------------------------------------------------------------- +Write-Host "[Step 1] Visual Studio 2022 のインストール確認..." -ForegroundColor Yellow + +$vsInstalled = Get-Command devenv.exe -ErrorAction SilentlyContinue +if ($vsInstalled) { + Write-Host " Visual Studio はインストール済みです.スキップします." -ForegroundColor Green +} else { + Write-Host " Visual Studio 2022 をインストールします..." -ForegroundColor White + $vsconfigPath = Join-Path $PSScriptRoot ".vsconfig" + winget install Microsoft.VisualStudio.2022.Community --no-upgrade ` + --override "--config `"$vsconfigPath`" --quiet --wait" + Write-Host " インストール完了." -ForegroundColor Green +} + +Write-Host "" + +# ----------------------------------------------------------------------------- +# Step 2: データ保存フォルダの作成 +# ----------------------------------------------------------------------------- +Write-Host "[Step 2] データ保存フォルダの作成..." -ForegroundColor Yellow + +$dataFolder = "C:\TIAS_Data" +if (Test-Path $dataFolder) { + Write-Host " $dataFolder は既に存在します.スキップします." -ForegroundColor Green +} else { + New-Item -ItemType Directory -Path $dataFolder | Out-Null + Write-Host " $dataFolder を作成しました." -ForegroundColor Green +} + +Write-Host "" + +# ----------------------------------------------------------------------------- +# Step 3: NuGet パッケージの復元 +# ----------------------------------------------------------------------------- +Write-Host "[Step 3] NuGet パッケージの復元..." -ForegroundColor Yellow + +$slnPath = Join-Path $PSScriptRoot "TIASshot.sln" +if (Test-Path $slnPath) { + nuget restore $slnPath + Write-Host " NuGet パッケージの復元が完了しました." -ForegroundColor Green +} else { + Write-Host " TIASshot.sln が見つかりません.手動で復元してください." -ForegroundColor Red +} + +Write-Host "" + +# ----------------------------------------------------------------------------- +# Step 4: IC Imaging Control SDK(手動インストール案内) +# ----------------------------------------------------------------------------- +Write-Host "[Step 4] IC Imaging Control SDK のインストール案内..." -ForegroundColor Yellow +Write-Host " IC Imaging Control SDK は手動インストールが必要です." -ForegroundColor White +Write-Host " ブラウザで The Imaging Source のダウンロードページを開きます." -ForegroundColor White +Write-Host "" +$response = Read-Host " ダウンロードページを開きますか? (y/N)" +if ($response -eq "y" -or $response -eq "Y") { + Start-Process "https://www.theimagingsource.com/en-us/support/download/" +} + +Write-Host "" + +# ----------------------------------------------------------------------------- +# 完了メッセージ +# ----------------------------------------------------------------------------- +Write-Host "========================================" -ForegroundColor Cyan +Write-Host " セットアップが完了しました" -ForegroundColor Cyan +Write-Host "========================================" -ForegroundColor Cyan +Write-Host "" +Write-Host "次の手順を手動で実施してください:" -ForegroundColor Yellow +Write-Host " 1. IC Imaging Control SDK のインストール(Step 4 参照)" +Write-Host " 2. TIASshot.sln を Visual Studio 2022 で開いてビルド確認" +Write-Host " 3. config.xml・カメラ設定ファイル・CSV ファイルの配置" +Write-Host " (詳細は docs\02_ENV\ENV_01_開発環境構築手順.txt を参照)" +Write-Host ""