-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (50 loc) · 1.88 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# cmake for flutterkit-native embedder.
# Windows-only right now...
cmake_minimum_required(VERSION 3.11)
project(flutterkit_embedder VERSION "0.1.0" LANGUAGES CXX C)
# Fancy new cpp, please
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
# Yoink StereoKit from public git repo
include(FetchContent)
set(SK_BUILD_TESTS OFF CACHE INTERNAL "")
set(SK_BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
FetchContent_Declare(
StereoKitC
GIT_REPOSITORY https://github.com/StereoKit/StereoKit.git
GIT_TAG 66b4036febabcd11790bf390391871c077402bc5
)
FetchContent_MakeAvailable(StereoKitC)
# Grab a snap of the Flutter engine + embedder headers.
# Make sure the hash matches your flutter engine.version file.
# Why? Who knows... some versions seem compatible, some crash and complain
# about binary formats... wild!
# Todo: make **not** windows-x64...
FetchContent_Declare(
Flutter
URL https://storage.googleapis.com/flutter_infra_release/flutter/3316dd8728419ad3534e3f6112aa6291f587078a/windows-x64/windows-x64-embedder.zip
)
FetchContent_MakeAvailable(Flutter)
# We force OpenGL here because Flutter doesn't speak DirectX
add_definitions("-DSKG_FORCE_OPENGL")
include_directories(
src
)
# Add source files to our target executable
add_executable( flutterkit_embedder
src/flutter_surface.cpp
src/main.cpp
)
# Link to dependencies
target_link_libraries( flutterkit_embedder
PRIVATE StereoKitC
PRIVATE ${flutter_SOURCE_DIR}/flutter_engine.dll.lib
)
# Include the embedder header.
target_include_directories(flutterkit_embedder PRIVATE ${flutter_SOURCE_DIR})
# Need to copy our icudtl.dat and flutter_engine.dll into our destination dir.
add_custom_command(
TARGET flutterkit_embedder POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/external/icudtl.dat ${flutter_SOURCE_DIR}/flutter_engine.dll
$<TARGET_FILE_DIR:flutterkit_embedder>)