-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update dependencies to latest versions and fix linker warnings (#22)
* update yarn dependencies to latest versions * update C++ dependencies and fix unused linker settings warning
- Loading branch information
1 parent
a1bd01b
commit 2631c8e
Showing
8 changed files
with
1,102 additions
and
2,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) | ||
|
||
project(TypeScriptXX | ||
LANGUAGES CXX | ||
) | ||
project(TypeScriptXX LANGUAGES CXX) | ||
|
||
# ---- Setup ---- | ||
|
||
set(CMAKE_CXX_FLAGS_RELEASE "-Oz -g0") | ||
|
||
# ---- Dependencies ---- | ||
# Add C++ dependencies through CPM.cmake. | ||
# See https://github.com/TheLartians/CPM.cmake for more info. | ||
# Add C++ dependencies through CPM.cmake. See | ||
# https://github.com/TheLartians/CPM.cmake for more info. | ||
include(cmake/CPM.cmake) | ||
|
||
# exact package versions are defined in package-lock.cmake | ||
# this helps us specify exact versions of transitive dependencies | ||
CPMUsePackageLock(package-lock.cmake) | ||
# Update transitive dependencies to more recent versions (this has to be done | ||
# before adding derived projects) | ||
cpmaddpackage("gh:TheLartians/[email protected]") | ||
cpmaddpackage("gh:TheLartians/[email protected]") | ||
|
||
# using the ModernCppStarter as an example project | ||
# replace this with your library | ||
CPMAddPackage( | ||
NAME Greeter | ||
GITHUB_REPOSITORY TheLartians/ModernCppStarter | ||
VERSION 0.16.1 | ||
) | ||
# Format.cmake is used to run clang-format | ||
cpmaddpackage("gh:TheLartians/[email protected]") | ||
|
||
# EmGlue is used to create the TypeScript declarations and the JavaScript bindings | ||
CPMAddPackage("gh:TheLartians/[email protected]") | ||
# EmGlue is used to create the TypeScript declarations and the JavaScript | ||
# bindings | ||
cpmaddpackage("gh:TheLartians/[email protected]") | ||
|
||
# Format.cmake is used to run clang-format | ||
CPMAddPackage("gh:[email protected]") | ||
# using the ModernCppStarter as an example project for JS bindings replace this | ||
# with the library you want to use | ||
cpmaddpackage(NAME Greeter GITHUB_REPOSITORY TheLartians/ModernCppStarter | ||
VERSION 0.17.3) | ||
|
||
# ---- Create wams glue library ---- | ||
|
||
|
@@ -41,15 +38,15 @@ target_link_libraries(wasmGlue PUBLIC Glue Greeter::Greeter) | |
|
||
# ---- Create main library ---- | ||
|
||
set(EMSCRIPTEN_FLAGS "-s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s \"EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun','callMain']\" -s MODULARIZE=1 -s SINGLE_FILE=1 -s INVOKE_RUN=0") | ||
set(EMSCRIPTEN_FLAGS | ||
"-s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s \"EXPORTED_RUNTIME_METHODS=['addOnPostRun','callMain']\" -s MODULARIZE=1 -s SINGLE_FILE=1 -s INVOKE_RUN=0" | ||
) | ||
|
||
add_executable(WasmModule source/main.cpp) | ||
target_link_libraries(WasmModule wasmGlue EmGlue ${EMSCRIPTEN_FLAGS}) | ||
set_target_properties(WasmModule PROPERTIES | ||
CXX_STANDARD 17 | ||
OUTPUT_NAME WasmModule | ||
COMPILE_FLAGS ${EMSCRIPTEN_FLAGS} | ||
) | ||
|
||
set_target_properties(WasmModule PROPERTIES CXX_STANDARD 17 OUTPUT_NAME | ||
WasmModule) | ||
|
||
# ---- Create declarations printer ---- | ||
|
||
|
@@ -59,10 +56,14 @@ target_link_libraries(WasmModuleDeclarations wasmGlue) | |
|
||
# ---- Move library and declarations into place ---- | ||
|
||
add_custom_command(TARGET WasmModule POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/WasmModule.js ${CMAKE_CURRENT_LIST_DIR}/../source/WasmModule.js | ||
) | ||
|
||
add_custom_command(TARGET WasmModuleDeclarations POST_BUILD | ||
COMMAND node ${CMAKE_CURRENT_BINARY_DIR}/WasmModuleDeclarations.js > ${CMAKE_CURRENT_LIST_DIR}/../source/WasmModule.d.ts | ||
) | ||
add_custom_command( | ||
TARGET WasmModule | ||
POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/WasmModule.js | ||
${CMAKE_CURRENT_LIST_DIR}/../source/WasmModule.js) | ||
|
||
add_custom_command( | ||
TARGET WasmModuleDeclarations | ||
POST_BUILD | ||
COMMAND node ${CMAKE_CURRENT_BINARY_DIR}/WasmModuleDeclarations.js > | ||
${CMAKE_CURRENT_LIST_DIR}/../source/WasmModule.d.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
set(CPM_DOWNLOAD_VERSION 0.34.0) | ||
|
||
if(CPM_SOURCE_CACHE) | ||
# Expand relative path. This is important if the provided path contains a tilde (~) | ||
# Expand relative path. This is important if the provided path contains a | ||
# tilde (~) | ||
get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE) | ||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
set(CPM_DOWNLOAD_LOCATION | ||
"${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
set(CPM_DOWNLOAD_LOCATION | ||
"$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
else() | ||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
set(CPM_DOWNLOAD_LOCATION | ||
"${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
endif() | ||
|
||
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) | ||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") | ||
file(DOWNLOAD | ||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION} | ||
) | ||
file( | ||
DOWNLOAD | ||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION}) | ||
endif() | ||
|
||
include(${CPM_DOWNLOAD_LOCATION}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.