cmake wasm
作者:互联网
cmake_minimum_required(VERSION 3.20)
project(untitled121)
set(CMAKE_VERBOSE_MAKEFILE 1)
set(CMAKE_C_COMPILER emcc)
set(CMAKE_CXX_COMPILER emcc)
set(CMAKE_AR emar)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR wasm)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
set(triple wasm32)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_SYSROOT /Users/jalyzhang/CLionProjects/untitled93/git/emsdk/upstream/emscripten/cache/sysroot)
#set(WASM_LINKER ${INSTALL_DIR}/wasm-ld)
set(WASM_LINKER /Users/jalyzhang/CLionProjects/untitled93/git/emsdk/upstream/bin/wasm-ld)
set(CMAKE_C_LINK_EXECUTABLE "${WASM_LINKER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_LINK_EXECUTABLE "${WASM_LINKER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
add_executable(untitled121 main.cpp 1.cpp)
# Specify LLVM toolchain
set_target_properties(untitled121 PROPERTIES LINK_FLAGS "--strip-all --no-entry --allow-undefined --lto-O2 --demangle --export-all")
标签:set,CMAKE,--,CXX,wasm,cmake,COMPILER 来源: https://www.cnblogs.com/Janly/p/16529497.html