Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emscripten options should be in the compile and link command #2455

Closed
jonathanpoelen opened this issue Jun 13, 2022 · 2 comments
Closed

emscripten options should be in the compile and link command #2455

jonathanpoelen opened this issue Jun 13, 2022 · 2 comments
Labels
Milestone

Comments

@jonathanpoelen
Copy link
Contributor

Xmake Version

v2.6.7+HEAD.93b7245

Operating System Version and Architecture

Linux

Describe Bug

For compiler options to be handled properly by emcc/em++, same options must be used at compile and link.

Here, an explanation about the optimization options: https://emscripten.org/docs/compiling/Building-Projects.html?highlight=optimization#building-projects-optimizations

$ xmake
emcc -c -O2 -o build/.objs/test/wasm/wasm32/release/test.cpp.o test.cpp
em++ -o build/wasm/wasm32/release/test.html build/.objs/test/wasm/wasm32/release/test.cpp.o

-O2 is missing on em++ ...

Expected Behavior

$ xmake
emcc -c -O2 -o build/.objs/test/wasm/wasm32/release/test.cpp.o test.cpp
em++ -O2 -o build/wasm/wasm32/release/test.html build/.objs/test/wasm/wasm32/release/test.cpp.o

-O2 on both lines.

Project Configuration

test.cpp

#include <cstdio>
int main() { puts("Hello"); }

xmake.lua

set_optimize("faster") -- enable -O2

target("test")
    set_kind("binary")
    add_files("test.cpp")

Additional Information and Error Logs

No response

@waruqi
Copy link
Member

waruqi commented Jun 14, 2022

try xmake update -s github:xmake-io/xmake#opti

#2461

@waruqi waruqi added this to the v2.6.8 milestone Jun 14, 2022
@waruqi
Copy link
Member

waruqi commented Jun 14, 2022

I have improved it.

@waruqi waruqi closed this as completed Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants