You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by fa...@apache.org on 2014/01/01 14:38:50 UTC

svn commit: r1554617 - in /qpid/proton/branches/fadams-javascript-binding: proton-c/CMakeLists.txt tools/cmake/Modules/FindEmscripten.cmake

Author: fadams
Date: Wed Jan  1 13:38:50 2014
New Revision: 1554617

URL: http://svn.apache.org/r1554617
Log:
Modified the change to proton-c/CMakeLists.txt to use a more idiomatic test as suggested by Andrew Stitcher using a FindEmscripten.cmake module

Added:
    qpid/proton/branches/fadams-javascript-binding/tools/cmake/Modules/FindEmscripten.cmake
Modified:
    qpid/proton/branches/fadams-javascript-binding/proton-c/CMakeLists.txt

Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/CMakeLists.txt?rev=1554617&r1=1554616&r2=1554617&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/CMakeLists.txt (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/CMakeLists.txt Wed Jan  1 13:38:50 2014
@@ -220,11 +220,6 @@ if (SWIG_FOUND)
   add_subdirectory(bindings)
 endif (SWIG_FOUND)
 
-# TODO Make these tests more idiomatic cmake as per comments by Andrew Stitcher.
-# 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.
-#
 # 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++
@@ -232,19 +227,10 @@ endif (SWIG_FOUND)
 # 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)
+  find_package(Emscripten)
+  if (EMSCRIPTEN_FOUND)
+    add_subdirectory(bindings/javascript)
+  endif (EMSCRIPTEN_FOUND)
 endif (BUILD_JAVASCRIPT)
 
 add_subdirectory(docs/api)

Added: qpid/proton/branches/fadams-javascript-binding/tools/cmake/Modules/FindEmscripten.cmake
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/tools/cmake/Modules/FindEmscripten.cmake?rev=1554617&view=auto
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/tools/cmake/Modules/FindEmscripten.cmake (added)
+++ qpid/proton/branches/fadams-javascript-binding/tools/cmake/Modules/FindEmscripten.cmake Wed Jan  1 13:38:50 2014
@@ -0,0 +1,40 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# FindEmscripten
+# This module check if Emscripten and its prerequisites are installed and if so sets EMSCRIPTEN_FOUND
+# Emscripten (https://github.com/kripken/emscripten) is a C/C++ to JavaScript cross-compiler used to
+# generate the JavaScript bindings.
+
+if (NOT EMSCRIPTEN_FOUND)
+    # 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)
+            set(EMSCRIPTEN_FOUND ON)
+        endif (NOT EMCC)
+    endif (NOT NODE)
+endif (NOT EMSCRIPTEN_FOUND)
+



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org