[vcpkg] add x86-wasm.cmake to community triplets (#11323)

* add x86-wasm.cmake to community triplets

The EMSDK enviroment variable is normally defined when first installing Emscripten.

* Rename x86-wasm.cmake to wasm32-emscripten.cmake

* Update wasm32-emscripten.cmake

* Update wasm32-emscripten.cmake

* Add wasm32 and wasm64 arch to docs

* Create wasm64-emscripten.cmake

* remove wasm64

* Delete wasm64-emscripten.cmake

* Add wasm32 to list of identifiers

* add emscripten VCPKG_CMAKE_SYSTEM_NAME support

* add path check to EMSDK cmake toolchain
This commit is contained in:
Mohammed Alyousef 2020-06-03 02:07:41 +03:00 committed by GitHub
parent ad7a227329
commit a6257ac262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 1 deletions

1
.gitignore vendored
View File

@ -313,6 +313,7 @@ __pycache__/
!triplets/community/arm-ios.cmake
!triplets/community/x64-ios.cmake
!triplets/community/x86-ios.cmake
!triplets/community/wasm32-emscripten.cmake
!triplets/arm-uwp.cmake
!triplets/x64-uwp.cmake
!triplets/x64-windows.cmake

View File

@ -138,6 +138,8 @@ The predefined expressions are computed from standard triplet settings:
- `osx` - `VCPKG_CMAKE_SYSTEM_NAME` == `"Darwin"`
- `android` - `VCPKG_CMAKE_SYSTEM_NAME` == `"Android"`
- `static` - `VCPKG_LIBRARY_LINKAGE` == `"static"`
- `wasm32` - `VCPKG_TARGET_ARCHITECTURE` == `"wasm32"`
- `emscripten` - `VCPKG_CMAKE_SYSTEM_NAME` == `"Emscripten"`
These predefined expressions can be overridden in the triplet file via the [`VCPKG_DEP_INFO_OVERRIDE_VARS`](../users/triplets.md) option.

View File

@ -29,7 +29,7 @@ Community Triplets are enabled by default, when using a community triplet a mess
### VCPKG_TARGET_ARCHITECTURE
Specifies the target machine architecture.
Valid options are `x86`, `x64`, `arm`, and `arm64`.
Valid options are `x86`, `x64`, `arm`, `arm64` and `wasm32`.
### VCPKG_CRT_LINKAGE
Specifies the desired CRT linkage (for MSVC).
@ -49,6 +49,7 @@ Valid options include any CMake system name, such as:
- `WindowsStore` (Universal Windows Platform)
- `Darwin` (Mac OSX)
- `Linux` (Linux)
- `Emscripten` (WebAssembly)
### VCPKG_CMAKE_SYSTEM_VERSION
Specifies the target platform system version.

View File

@ -25,6 +25,8 @@ namespace vcpkg
osx,
uwp,
android,
emscripten,
wasm32,
static_link,
};
@ -113,6 +115,8 @@ namespace vcpkg
{"osx", Identifier::osx},
{"uwp", Identifier::uwp},
{"android", Identifier::android},
{"emscripten", Identifier::emscripten},
{"wasm32", Identifier::wasm32},
{"static", Identifier::static_link},
};
@ -165,6 +169,8 @@ namespace vcpkg
case Identifier::osx: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "Darwin");
case Identifier::uwp: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "WindowsStore");
case Identifier::android: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "Android");
case Identifier::emscripten: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "Emscripten");
case Identifier::wasm32: return true_if_exists_and_equal("VCPKG_TARGET_ARCHITECTURE", "wasm32");
case Identifier::static_link: return true_if_exists_and_equal("VCPKG_LIBRARY_LINKAGE", "static");
}

View File

@ -0,0 +1,15 @@
set(VCPKG_ENV_PASSTHROUGH EMSDK PATH)
if(NOT DEFINED ENV{EMSDK})
message(FATAL_ERROR "The EMSDK environment variable must be defined")
endif()
if(NOT EXISTS $ENV{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake)
message(FATAL_ERROR "Emscripten.cmake toolchain file not found")
endif()
set(VCPKG_TARGET_ARCHITECTURE wasm32)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Emscripten)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE $ENV{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake)