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

first attempt at cmake build system #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nickdesaulniers
Copy link

review? @lukewagner

this builds the two c++ executables, but doesn't build the emscriptenized load-wasm-worker.js file or remove anything from the Makefile.

@sunfishcode
Copy link

Do you expect you'll add the emscriptenized load-wasm-worker.js feature eventually? (In other words, is this the first step toward implementing the comment in the first line of https://github.com/WebAssembly/polyfill-prototype-1/blob/master/Makefile ?)

@nickdesaulniers
Copy link
Author

Not sure about the js exectubale regarding best practices of having compiler specific build targets. I'll have to do some research, but I think it's doable. @juj probably knows.

@juj
Copy link

juj commented Jul 1, 2015

Sure, it's possible to have CMake target .js or .html output files. See the CMake tests in Emscripten tests/ directory. Note that it is not a project-specific property, but Emscripten is a platform to target, just like Windows, Linux or OS X. That means that one CMakeLists.txt file can't contain two projects that would target different platforms, e.g. one that would target native, and another that would target JS, but the choice of which one to compile for is done at command line by choosing the appropriate target toolchain file (for Emscripten, that's running with emcmake cmake xxx instead of just cmake xxx)

@nickdesaulniers
Copy link
Author

so basically, the cmake build script would have to be run twice; once to build the C++ code, and once to build the JS code, possibly removing the cmake cache in between? Does that sound correct @juj?

@juj
Copy link

juj commented Jul 1, 2015

Yes, or set it to build to two different directories, so they can each have their own cache files and directory structures.

@nickdesaulniers
Copy link
Author

or set it to build to two different directories

So I would have to move the source files into their own directories each with their own CMakeLists.txt?

@juj
Copy link

juj commented Jul 1, 2015

No, there's no need to move anything. CMake is not restricted to making builds to the root directory of the project, but good CMake practices employ what they call "out-of-source" builds, see http://www.cmake.org/Wiki/CMake_FAQ#What_is_an_.22out-of-source.22_build.3F . This is intended to exactly cater to the case when one wants to simultaneously keep builds of the same project with multiple different configurations (e.g. different target platforms, different build options, like debug vs release, or simd enabled vs not, or anything else custom).

@lukewagner
Copy link
Owner

On vacation atm, but when everything works, @sunfishcode feel free to do the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants