Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions WINDOWS-DEVELOPMENT-QUICKSTART-ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ GitHub 네트워크 작업은 기존 정책을 공통으로 사용한다. 전송
저장소에 접근할 수 없으면 경고 후 TizenVG 없이 완료한다. 저장소 접근
후 발생한 TizenVG configure, build, install 오류는 숨기지 않는다.

TizenVG에 이어 WebView용 LWE(Starfish) SDK도 자동으로 준비한다
(`vcpkg-script\setup-starfish.ps1`). 첫 실행은 소스 빌드 때문에 오래
걸리며(약 30~60분), 실패 시 경고만 남기고 계속한다. 자세한 내용과 재실행
방법은 아래 "LWE(Starfish) SDK 준비" 절을 참고한다.

Debug 빌드가 필요하면 `-Configuration Debug`를 지정한다 (기본은 Release).
공개 SDK는 Release 전용이므로 이때 정적 라이브러리
`dali-windows-dependencies.lib`만 Debug로 자동 재빌드한다. 같은 SDK로
Release를 다시 쓰려면 `-Configuration Release`로 재실행하면 된다.

```powershell
.\install.ps1 -Configuration Debug
```

Debug 빌드 참고:

- WebView(LWE)는 현재 Release 전용이다. LWE 공개 API가 std::string을 DLL
경계로 주고받아 전체 구성 일치가 필수인데 Starfish SDK가 Release로만
빌드되기 때문이다. `lwe-web-engine-pluginuild.ps1`은 Debug 요청 시
명확한 오류로 중단한다.
- TizenVG는 C API라 구성 혼용이 안전해 Release 그대로 사용한다.

## 프로젝트별 빌드와 설치

```powershell
Expand All @@ -48,13 +70,25 @@ cd <workspace>\dali-core
cd <workspace>\dali-adaptor
.\build\windows\build.ps1

cd <workspace>\windows-dependencies\lwe-web-engine-plugin
.\build.ps1

cd <workspace>\dali-ui
.\build\windows\build.ps1

cd <workspace>\dali-ui\samples
.\build.ps1
```

`lwe-web-engine-plugin`은 WebView용 LWE(Starfish) 웹엔진 플러그인
(`dali2-web-engine-lwe-plugin.dll`)을 빌드해 `dali-env\bin`에 설치한다.
dali-env에 설치된 dali2-core/dali2-adaptor 패키지를 링크하므로 반드시
dali-adaptor 다음, dali-ui 이전 순서로 빌드한다. 선행 조건으로
`WindowsDependenciesSDK`에 LWE SDK(`include\LWEWebView.h`,
`lib\Starfish.lib`, `bin\Starfish.dll`)가 있어야 하며, 준비 방법은
아래 "LWE(Starfish) SDK 준비" 절을 참고한다. WebView가 필요 없으면 이
단계는 건너뛴다.

각 명령은 configure, build, install을 모두 수행한다. 빌드 중간 산출물은
각 저장소의 `_build\windows`에 있고 설치 결과는 `dali-env`에 모인다.

Expand Down Expand Up @@ -110,3 +144,48 @@ sdk-contents.json
실행의 비교를 위해 입력 manifest만 갱신한다.

정식 버전 정책은 `WINDOWS-SDK-VERSIONING-TODO.md`에 정리되어 있다.

## LWE(Starfish) SDK 준비

`lwe-web-engine-plugin` 빌드의 선행 조건으로, `WindowsDependenciesSDK`에
LWE 헤더(`LWEWebView.h` 등)와 `lib\Starfish.lib`, `bin\Starfish.dll`이
있어야 한다.

**`install.ps1`이 자동으로 처리한다.** 의존성 설치 단계에서
`vcpkg-script\setup-starfish.ps1`이 함께 실행되어 LWE SDK까지 준비된다.
실패해도 경고만 남기고 SDK 설치는 계속되며(WebView만 비활성), 문제를
해결한 뒤 스크립트만 다시 실행하면 된다:

```powershell
cd <workspace>\windows-dependencies
.\vcpkg-script\setup-starfish.ps1 # 재실행 (이미 완료된 단계는 건너뜀)
.\vcpkg-script\setup-starfish.ps1 -Force # 강제 재빌드
# install.ps1 -SkipStarfish # LWE를 아예 건너뛰기
```

스크립트가 자동으로 수행하는 일:

1. **vcpkg 추가 포트**: openssl / libwebsockets / glew 설치 (구버전 포트
호환 수정 포함, release 전용). openssl이 10~20분 걸린다.
2. **Starfish 소스**: `github.sec.samsung.net/lws/starfish` 클론 + 서브모듈
+ `lwe-web-engine-plugin\patches\`의 x64 패치 적용 + 바인딩 생성기용
python3/jinja2/ply 준비.
3. **빌드·설치**: VS2022 x64 Release로 `Starfish.dll` 빌드(첫 빌드 20~40분)
후 SDK의 `include\`, `lib\`, `bin\`에 복사.

추가 전제 조건: Python 3 + pip, `github.sec.samsung.net` 접근 권한.

**지름길**: 이미 빌드된 SDK가 있으면(예: 다른 작업공간) `include\LWEWebView.h`,
`include\LWEWorker.h`, `include\PlatformIntegrationData.h`, `lib\Starfish.lib`,
`bin\Starfish.dll`(+선택 `bin\Starfish.pdb`)만 새 SDK로 복사해도 된다 —
스크립트가 이 파일들을 발견하면 전체를 건너뛴다.

## WebView 샘플 실행

```powershell
cd <workspace>
. .\dali-env\setenv.ps1
.\dali-env\bin\web-view-win.example.exe
```

키: `ESC` 종료, `B`/`F` 뒤로/앞으로, `R` 새로고침, `H` 인라인 HTML, `J` JS 실행.
36 changes: 35 additions & 1 deletion build_windows_dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
param(
[string]$Proxy = "",
[string]$VcpkgRoot = "",
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Release",
[string]$StarfishRepository = "",
[string]$StarfishRevision = "",
[switch]$SkipStarfish,
[switch]$SkipTizenVg,
[switch]$SkipThirdParty,
[switch]$Clean,
Expand Down Expand Up @@ -48,6 +53,7 @@ if(-not $SkipThirdParty -and -not $SkipTizenVg)
VcpkgRoot = (Join-Path $WorkspaceContext.SdkRoot "vcpkg")
InstallPrefix = $WorkspaceContext.SdkRoot
SkipVcpkg = $true
Configuration = $Configuration
}
if($Proxy)
{
Expand All @@ -61,7 +67,35 @@ $Context = New-DaliBuildContext `
-VcpkgRoot (Join-Path $WorkspaceContext.SdkRoot "vcpkg") `
-InstallPrefix $WorkspaceContext.SdkRoot
Initialize-DaliBuildEnvironment -Context $Context
$Common = Get-DaliCommonCMakeArguments -Context $Context

# LWE (Starfish) web engine SDK. Optional: a failure only warns, WebView is
# simply unavailable and setup-starfish.ps1 can be re-run standalone.
if(-not $SkipStarfish)
{
$StarfishArguments = @{
InstallPrefix = $Context.InstallPrefix
Jobs = $Jobs
}
if($StarfishRepository)
{
$StarfishArguments.Repository = $StarfishRepository
}
if($StarfishRevision)
{
$StarfishArguments.Revision = $StarfishRevision
}
try
{
& (Join-Path $ScriptRoot "vcpkg-script/setup-starfish.ps1") @StarfishArguments
}
catch
{
Write-Warning "LWE (Starfish) SDK setup failed: $($_.Exception.Message)"
Write-Warning "WebView will be unavailable; re-run vcpkg-script/setup-starfish.ps1 after fixing."
}
}

$Common = Get-DaliCommonCMakeArguments -Context $Context -Configuration $Configuration

Invoke-DaliCMakeProject `
-Name "windows-dependencies" `
Expand Down
95 changes: 88 additions & 7 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
[CmdletBinding()]
param(
# Configuration the DALi projects will be built with. The published SDK is
# Release-only; for Debug the dali-windows-dependencies static library is
# rebuilt in Debug so dali-core links without a CRT mismatch (LNK2038).
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Release",
[string]$Proxy = "",
[string]$ReleaseRepository = "dalihub/windows-dependencies",
[string]$ReleaseTag = "windows-sdk-latest",
[switch]$BuildFromSource,
# Skip the LWE (Starfish) web-engine SDK build; WebView will be unavailable.
[switch]$SkipStarfish,
[int]$Jobs = 8
)

Expand All @@ -27,6 +34,37 @@ if($ReleaseRepository -notmatch '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$')
. (Join-Path $ScriptRoot "vcpkg-script\dali-build-common.ps1")
Set-DaliProxyEnvironment -Proxy $Proxy

function Move-DirectoryWithRetry
{
param(
[Parameter(Mandatory = $true)]
[string]$LiteralPath,
[Parameter(Mandatory = $true)]
[string]$Destination,
[int]$RetryCount = 10,
[int]$RetryDelayMs = 500
)

$Attempt = 0
while($Attempt -lt $RetryCount)
{
try
{
Move-Item -LiteralPath $LiteralPath -Destination $Destination -Force
return
}
catch
{
$Attempt++
if($Attempt -ge $RetryCount)
{
throw
}
Start-Sleep -Milliseconds $RetryDelayMs
}
}
}

function Install-DownloadedSdk
{
$BaseUri = "https://github.com/$ReleaseRepository/releases/download/$ReleaseTag"
Expand Down Expand Up @@ -64,11 +102,7 @@ function Install-DownloadedSdk
New-Item -ItemType Directory -Force -Path $ExtractRoot | Out-Null
try
{
& tar.exe -xf $ArchivePath -C $ExtractRoot
if($LASTEXITCODE -ne 0)
{
throw "Failed to extract $ArchivePath"
}
Expand-Archive -LiteralPath $ArchivePath -DestinationPath $ExtractRoot -Force
$ExpectedToolchain = Join-Path $ExtractRoot "vcpkg\scripts\buildsystems\vcpkg.cmake"
if(-not (Test-Path -LiteralPath $ExpectedToolchain))
{
Expand All @@ -82,11 +116,11 @@ function Install-DownloadedSdk
}
if(Test-Path -LiteralPath $SdkRoot)
{
Move-Item -LiteralPath $SdkRoot -Destination $BackupRoot
Move-DirectoryWithRetry -LiteralPath $SdkRoot -Destination $BackupRoot
}
try
{
Move-Item -LiteralPath $ExtractRoot -Destination $SdkRoot
Move-DirectoryWithRetry -LiteralPath $ExtractRoot -Destination $SdkRoot
}
catch
{
Expand Down Expand Up @@ -123,6 +157,7 @@ if(-not $InstalledRelease)
{
Write-Host "No usable published SDK was found. Building the same SDK layout from source." -ForegroundColor Yellow
$BuildArguments = @{
Configuration = $Configuration
SkipTizenVg = $true
Clean = $true
Jobs = $Jobs
Expand All @@ -131,9 +166,32 @@ if(-not $InstalledRelease)
{
$BuildArguments.Proxy = $Proxy
}
if($SkipStarfish)
{
$BuildArguments.SkipStarfish = $true
}
& (Join-Path $ScriptRoot "build_windows_dependencies.ps1") @BuildArguments
}

# The published SDK ships a Release-only dali-windows-dependencies.lib. It is
# a static library, so a Debug DALi build cannot link it (LNK2038 CRT
# mismatch); rebuild just that project in Debug into the SDK.
if($InstalledRelease -and $Configuration -eq "Debug")
{
Write-Host "Rebuilding dali-windows-dependencies.lib as Debug (published SDK is Release-only)." -ForegroundColor Yellow
$DebugContext = New-DaliBuildContext -WindowsDependenciesRoot $ScriptRoot `
-VcpkgRoot (Join-Path $SdkRoot "vcpkg") -InstallPrefix $SdkRoot
Initialize-DaliBuildEnvironment -Context $DebugContext
$DebugArguments = Get-DaliCommonCMakeArguments -Context $DebugContext -Configuration $Configuration
Invoke-DaliCMakeProject `
-Name "windows-dependencies ($Configuration)" `
-SourceDirectory (Join-Path $ScriptRoot "build") `
-BuildDirectory (Join-Path $ScriptRoot "_build\windows") `
-ConfigureArguments $DebugArguments `
-Clean `
-Jobs $Jobs
}

$TizenVgArguments = @{
DaliRoot = $WorkspaceRoot
VcpkgRoot = (Join-Path $SdkRoot "vcpkg")
Expand All @@ -146,6 +204,29 @@ if($Proxy)
}
& (Join-Path $ScriptRoot "vcpkg-script\setup-dali-dependencies.ps1") @TizenVgArguments

# LWE (Starfish) web engine SDK for the WebView plugin. A failure here only
# warns: WebView is optional, and setup-starfish.ps1 can be re-run standalone.
# Note: the LWE SDK is currently Release-only; with -Configuration Debug the
# WebView plugin cannot be used (LWE passes std::string across the DLL
# boundary, so all configurations must match).
if(-not $SkipStarfish)
{
if($Configuration -eq "Debug")
{
Write-Warning "LWE (Starfish) is built Release-only for now; WebView is unavailable in Debug builds."
}
try
{
& (Join-Path $ScriptRoot "vcpkg-script\setup-starfish.ps1") -InstallPrefix $SdkRoot -Jobs $Jobs
}
catch
{
Write-Warning "LWE (Starfish) SDK setup failed: $($_.Exception.Message)"
Write-Warning "WebView will be unavailable. Fix the issue and re-run vcpkg-script\setup-starfish.ps1,"
Write-Warning "or skip building lwe-web-engine-plugin."
}
}

$RuntimeContext = New-DaliBuildContext -WindowsDependenciesRoot $ScriptRoot
Install-DaliRuntimeScripts -Context $RuntimeContext
Write-Host "`nDALi Windows dependencies are ready in $SdkRoot" -ForegroundColor Green
Expand Down
61 changes: 61 additions & 0 deletions lwe-web-engine-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)

# LWE (Lightweight Web Engine / Starfish) WebEnginePlugin for DALi on Windows.
#
# dali-adaptor's web-engine-impl.cpp dlopen's "libdali2-web-engine-lwe-plugin.so"
# at runtime; the Windows dlfcn shim maps that to dali2-web-engine-lwe-plugin.dll
# and loads it from the directory containing dali2-adaptor.dll. This project
# builds that DLL out-of-tree so dali-adaptor itself carries no plugin sources.
#
# Build AFTER dali-core and dali-adaptor are installed into dali-env: the plugin
# links their installed packages (public/devel API only). The LWE SDK
# (LWEWebView.h / Starfish.lib) comes from WindowsDependenciesSDK via
# CMAKE_PREFIX_PATH.

PROJECT(dali2-web-engine-lwe-plugin-win CXX)

SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

FIND_PACKAGE(dali2-core CONFIG REQUIRED)
FIND_PACKAGE(dali2-adaptor CONFIG REQUIRED)

FIND_PATH(LWE_INCLUDE_DIR NAMES LWEWebView.h REQUIRED)
FIND_LIBRARY(STARFISH_LIBRARY NAMES Starfish REQUIRED)
MESSAGE(STATUS "LWE include: ${LWE_INCLUDE_DIR}")
MESSAGE(STATUS "Starfish : ${STARFISH_LIBRARY}")

ADD_LIBRARY(${PROJECT_NAME} SHARED
DaliInputEventConverter.cpp
LWEWebEngineBackForwardList.cpp
LWEWebEngineContext.cpp
LWEWebEngineCookieManager.cpp
LWEWebEngineLoadError.cpp
LWEWebEnginePlugin.cpp
LWEWebEngineSettings.cpp
web-engine-lwe-plugin.cpp
)

# The DLL must carry the exact name the dlfcn shim derives from
# libdali2-web-engine-lwe-plugin.so.
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "dali2-web-engine-lwe-plugin"
PREFIX ""
)

TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${LWE_INCLUDE_DIR})

# Match the DALi Windows ABI: /vmg (member-function-pointer representation used
# by DALi callbacks) and the __restrict__ mapping, same as the dali-ui samples.
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE /vmg /utf-8 /wd4251)
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE __restrict__=__restrict)

TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE
dali2-adaptor::dali2-adaptor
dali2-core::dali2-core
${STARFISH_LIBRARY}
dbghelp # TEMP DEBUG: crash/abort stack dumps in LWEWebEnginePlugin.cpp
)

# Install next to dali2-adaptor.dll so the dlfcn shim finds it.
INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
Loading