Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

[cmake] add FindWasm.cmake and binaryen code into the repo #1412

Merged
merged 23 commits into from
Feb 27, 2018

Conversation

asiniscalchi
Copy link
Contributor

@asiniscalchi asiniscalchi commented Feb 17, 2018

it allows the cmake syntax:

find_package(Binaryen)
find_package(Wast)

and the cmake standard syntax
$ cmake .. -DWAST_ROOT=<path> -DBINARYEN_ROOT=<path>

@asiniscalchi asiniscalchi changed the title [cmake] usage of FindBinaryen and FindWasm.cmake [cmake] usage of FindBinaryen.cmake and FindWasm.cmake Feb 17, 2018
Copy link
Contributor

@wanderingbort wanderingbort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will also conflict with #1452 which also introduces a FindBinaryen.cmake with additional need.

Depending on which one makes it through first this may need revision.

# TODO: Check if compiler is able to generate wasm32
if( NOT ("${WASM_CLANG}" STREQUAL "" OR "${WASM_LLC}" STREQUAL "" OR "${WASM_LLVM_LINK}" STREQUAL "" OR NOT BINARYEN_BIN) )
set(WASM_TOOLCHAIN TRUE)
if(WASM_FOUND AND BINARYEN_FOUND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that find_package has Wasm and Binaryen as required, is there any purpose to this conditional or the dependent one in the root CMakeLists.txt that handles "soft" failure of the wasm toolchain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It dependes on what you want: master branch already fails if toolchain is not found.
What do you prefer ?

@@ -1,4 +1,4 @@
if(WASM_TOOLCHAIN)
if(WASM_TOOLCHAIN_FOUND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, there is no "successful" cmake run where WASM_TOOLCHAIN_FOUND would be false. Most of these conditionals can be removed in favor of running the side of the branch that corresponds with success.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. I was trying to mimic the master branch behavior

@asiniscalchi
Copy link
Contributor Author

So in the end the question is:
Do you want the contracts compilation to be mandatory ?

@wanderingbort
Copy link
Contributor

For a while, it was mandatory as the chain library needed compilation for the system contract. I suppose at this point it could return to optional but we have already leaned in to using WASM to exercise the chain in our integration/smoke tests. It is impossible to test some parts of the chain functionality without contracts working.

TL;DR we should assume its mandatory and strip out anything thats now unnecessary as a result.

Also, the OSX build needs love, even if its only changing the scripts to properly interface with your new modules

@asiniscalchi
Copy link
Contributor Author

Done.
You have the binaryen submodule into the repo.

@asiniscalchi asiniscalchi changed the title [cmake] usage of FindBinaryen.cmake and FindWasm.cmake [cmake] add FindWasm.cmake and binaryen code into the repo Feb 24, 2018
@wanderingbort
Copy link
Contributor

I tried to run this through our build scripts which rely on (among otherthings) WASM_LLVM_CONFIG instead of WASM_ROOT

please consider either maintaining WASM_LLVM_CONFIG as a single entry for configuring all endpoints or changing the build scripts to properly use WASM_ROOT

Copy link
Contributor

@wanderingbort wanderingbort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment above

@wanderingbort
Copy link
Contributor

#1479 has internalized binaryen to our repo to address issues across several PRs,

I would still like to integrate your FindWasm changes but we need to address the mismatch with the build scripts.

@asiniscalchi
Copy link
Contributor Author

I didn't find any other WASM_LLVM_CONFIG in the repo

@wanderingbort wanderingbort merged commit 4773369 into EOSIO:master Feb 27, 2018
@asiniscalchi asiniscalchi deleted the dev_cmake_using_finds branch April 8, 2018 16:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants