On 19/11/13 20:30, Andrew Stitcher wrote:
# Build the JavaScript language binding.
# This is somewhat different to the other language bindings in that it
does not use swig. It uses a C/C++ to
# JavaScript cross-compiler called emscripten
(https://github.com/kripken/emscripten). Emscripten takes C/C++
# and "compiles" it into a highly optimisable subset of JavaScript
called asm.js (http://asmjs.org/) that can
# be aggressively optimised and run at near-native speed (usually
between 1.5 to 10 times slower than native C/C++).
option("BUILD_JAVASCRIPT" "Build JavaScript language binding" ON)
if (BUILD_JAVASCRIPT)
    # First check that Node.js is installed as that is needed by emscripten.
    find_program(NODE node)
    if (NOT NODE)
      message(STATUS "Node.js (http://nodejs.org) is not installed: can't
build JavaScript binding")
    else (NOT NODE)
      # Check that the emscripten C/C++ to JavaScript cross-compiler is
installed.
      find_program(EMCC emcc)
      if (NOT EMCC)
        message(STATUS "Emscripten
(https://github.com/kripken/emscripten) is not installed: can't build
JavaScript binding")
      else (NOT EMCC)
        add_subdirectory(bindings/javascript)
      endif (NOT EMCC)
    endif (NOT NODE)
endif (BUILD_JAVASCRIPT)


BTW this whole approach to checking dependencies is not something you
should copy from the existing proton/qpid code
hahahaha - thanks, you've make me chuckle. As it happens the sum total of my experience with CMake has been a couple of CMakeList.txt files that I used to port zlib using emscripten and this stuff, and I basically borrowed and tweaked from what I found in the Proton and Qpid CMake files.

I don't know, teaching me bad habits :-) I've been "doing cmake just to make it work " too :-D

  it is really not the
idiomatic cmake way to do this - in our defense up till now we've really
being doing cmake just to make it work, and our cmake code base is (IMO)
just starting to get large enough to be hard to follow and so we need to
take more care.

The idiomatic approach involves writing smaller FindXXX.cmake files
which return a fixed set of variables and using find_package(XXX...) in
the main cmake file.

I'd be happy enough to "do the right thing", I don't suppose you could point me at something that does things properly (and that's fairly easy to follow) I usually find it easier to learn this stuff through some "worked examples" - the CMake documentation is a pretty good reference, but I haven't found it to be that great as a tutorial. Any pointers to good habits happily received.

Cheers, and thanks for the comments.
Frase




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to