"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/cmake/SpiderMonkey.cmake" (25 May 2009, 3355 Bytes) of package /linux/misc/old/google-gadgets-for-linux-0.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) CMake source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 # Copyright 2008 Google Inc.
    3 #
    4 # Licensed under the Apache License, Version 2.0 (the "License");
    5 # you may not use this file except in compliance with the License.
    6 # You may obtain a copy of the License at
    7 #
    8 #      http://www.apache.org/licenses/LICENSE-2.0
    9 #
   10 # Unless required by applicable law or agreed to in writing, software
   11 # distributed under the License is distributed on an "AS IS" BASIS,
   12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13 # See the License for the specific language governing permissions and
   14 # limitations under the License.
   15 #
   16 
   17 MACRO(TRY_COMPILE_SMJS _test_program _definitions _link_flags)
   18   TRY_COMPILE(TRY_COMPILE_SMJS_RESULT
   19     ${CMAKE_BINARY_DIR}/configure
   20     ${CMAKE_SOURCE_DIR}/cmake/${_test_program}
   21     CMAKE_FLAGS
   22       -DINCLUDE_DIRECTORIES:STRING=${SMJS_INCLUDE_DIR}
   23       -DLINK_DIRECTORIES:STRING=${SMJS_LINK_DIR}
   24       -DCMAKE_EXE_LINKER_FLAGS:STRING=${_link_flags}
   25       -DLINK_LIBRARIES:STRING=${SMJS_LIBRARIES}
   26     COMPILE_DEFINITIONS ${_definitions}
   27     OUTPUT_VARIABLE TRY_COMPILE_SMJS_OUTPUT)
   28   # MESSAGE("'${TRY_COMPILE_SMJS_RESULT}' '${TRY_COMPILE_SMJS_RESULT}'")
   29 ENDMACRO(TRY_COMPILE_SMJS _test_program _definitions _link_flags)
   30 
   31 MACRO(TRY_RUN_SMJS _test_program _definitions _link_flags)
   32   TRY_RUN(TRY_RUN_SMJS_RESULT TRY_RUN_SMJS_COMPILE_RESULT
   33     ${CMAKE_BINARY_DIR}/configure
   34     ${CMAKE_SOURCE_DIR}/cmake/${_test_program}
   35     CMAKE_FLAGS
   36       -DINCLUDE_DIRECTORIES:STRING=${SMJS_INCLUDE_DIR}
   37       -DLINK_DIRECTORIES:STRING=${SMJS_LINK_DIR}
   38       -DCMAKE_EXE_LINKER_FLAGS:STRING=${_link_flags}
   39       -DLINK_LIBRARIES:STRING=${SMJS_LIBRARIES}
   40     COMPILE_DEFINITIONS ${_definitions}
   41     OUTPUT_VARIABLE TRY_RUN_SMJS_OUTPUT)
   42   # MESSAGE("'${TRY_RUN_SMJS_COMPILE_RESULT}' '${TRY_RUN_SMJS_RESULT}'" '${TRY_RUN_SMJS_OUTPUT}')
   43 ENDMACRO(TRY_RUN_SMJS _test_program _definitions _link_flags)
   44 
   45 SET(SMJS_LIST
   46   mozilla-js
   47   xulrunner-js
   48   firefox2-js
   49   firefox-js
   50   seamonkey-js
   51   )
   52 FOREACH(js ${SMJS_LIST})
   53   IF(NOT SMJS_FOUND)
   54     GET_CONFIG(${js} 0 SMJS SMJS_FOUND)
   55     IF(SMJS_FOUND)
   56       SET(SMJS_NAME ${js})
   57     ENDIF(SMJS_FOUND)
   58   ENDIF(NOT SMJS_FOUND)
   59 ENDFOREACH(js ${SMJS_LIST})
   60 
   61 IF(SMJS_FOUND)
   62   IF(UNIX)
   63     SET(SMJS_DEFINITIONS "${SMJS_DEFINITIONS} -DXP_UNIX")
   64   ENDIF(UNIX)
   65 
   66   TRY_COMPILE_SMJS(
   67     test_js_threadsafe.c
   68     "${SMJS_DEFINITIONS} -DMIN_SMJS_VERSION=160 -DJS_THREADSAFE"
   69     "${CMAKE_EXE_LINKER_FLAGS} ${SMJS_LINKER_FLAGS}")
   70 
   71   IF(TRY_COMPILE_SMJS_RESULT)
   72     SET(SMJS_DEFINITIONS "${SMJS_DEFINITIONS} -DJS_THREADSAFE")
   73   ELSE(TRY_COMIPLE_SMJS_RESULT)
   74     TRY_COMPILE_SMJS(
   75       test_js_threadsafe.c
   76       "${SMJS_DEFINITIONS} -DMIN_SMJS_VERSION=160"
   77       "${CMAKE_EXE_LINKER_FLAGS} ${SMJS_LINKER_FLAGS}")
   78     IF(NOT TRY_COMPILE_SMJS_RESULT)
   79       SET(SMJS_FOUND 0)
   80       MESSAGE("Failed to try run SpiderMonkey, the library version may be too low.")
   81     ENDIF(NOT TRY_COMPILE_SMJS_RESULT)
   82   ENDIF(TRY_COMPILE_SMJS_RESULT)
   83 ENDIF(SMJS_FOUND)
   84 
   85 IF(SMJS_FOUND)
   86   TRY_RUN_SMJS(
   87     test_js_mozilla_1_8_branch.c
   88     "${SMJS_DEFINITIONS} -DMOZILLA_1_8_BRANCH"
   89     "${CMAKE_EXE_LINKER_FLAGS} ${SMJS_LINKER_FLAGS}")
   90 
   91   IF(TRY_RUN_SMJS_COMPILE_RESULT AND "${TRY_RUN_SMJS_RESULT}" STREQUAL "0")
   92     SET(SMJS_DEFINITIONS "${SMJS_DEFINITIONS} -DMOZILLA_1_8_BRANCH")
   93   ENDIF(TRY_RUN_SMJS_COMPILE_RESULT AND "${TRY_RUN_SMJS_RESULT}" STREQUAL "0")
   94 ENDIF(SMJS_FOUND)