Verifier support for CheckROCOW
[hiphop-php.git] / hphp / test / dso_test / dso_test.cmake
blob4e8b7adc2b80d5b74ca4aa07289b7c9f82e359be
2 # Build a DSO in dso_test, only to be used for testing
3 # on linux of zend extensions loaded dynamically through a DSO.
5 # See http://www.cmake.org/cmake/help/v3.0/command/add_custom_command.html
6 # See http://www.cmake.org/cmake/help/v3.0/command/add_custom_target.html
8 if (LINUX)
9   if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
10     # As we're generating cmake files (when calling hphpize), we can't do a
11     # standard out-of-source build.
12     #
13     # Also, as this is included from the root cmake, rather than added with
14     # add_directory(), the '_CURRENT' vars are set to the root dir, so not
15     # useful
16     set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/hphp/test/dso_test")
17     FILE(
18       GLOB FILE_LIST
20       "${SOURCE_DIR}/*.cpp"
21       "${SOURCE_DIR}/config.cmake"
22       "${SOURCE_DIR}/*.php"
23     )
24     FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/hphp/test/dso_test")
25     FILE(COPY ${FILE_LIST} DESTINATION "${CMAKE_BINARY_DIR}/hphp/test/dso_test")
26   endif()
27   set(HPHPIZE_EXE "${CMAKE_BINARY_DIR}/hphp/tools/hphpize/hphpize")
28   set(HPHPIZE_CMAKE "${CMAKE_BINARY_DIR}/hphp/tools/hphpize/hphpize.cmake")
29   set(HPHPIZE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
30   add_custom_target(
31     dso_test
32     DEPENDS dso_test.so hhvm
33   )
35   add_custom_command(
36     OUTPUT dso_test.so
38     #
39     # The output from hphpize and cmake is just discarded;
40     # the presumption is that it has been debugged and "just works".
41     #
42     COMMAND chmod 755 ${HPHPIZE_EXE}
43     COMMAND HHVM_HPHPIZE_CMAKE=${HPHPIZE_CMAKE}
44             /bin/sh ${HPHPIZE_EXE} > /dev/null
45     COMMAND cmake -DHHVM_DSO_TEST_MODE=On . > /dev/null
47     COMMAND make
49     WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/hphp/test/dso_test"
51     COMMENT "Making dso_test.so"
52     DEPENDS ${HPHPIZE_CMAKE} ${HPHPIZE_EXE}
53   )
55 endif()