Commit 86a459a8 by Clemens Buchacher

cmake: generate clay main

The clay test suite files clay.h and clay_main.c are generated by
the clay python script. Teach CMake about this dependency and
remove the generated files from the repository.
parent 06fcf057
/tests-clay/clay.h
/tests-clay/clay_main.c
/apidocs /apidocs
/trash-*.exe /trash-*.exe
/libgit2.pc /libgit2.pc
......
...@@ -142,13 +142,22 @@ IF (BUILD_TESTS) ...@@ -142,13 +142,22 @@ IF (BUILD_TESTS)
ENDIF () ENDIF ()
IF (BUILD_CLAY) IF (BUILD_CLAY)
FIND_PACKAGE(PythonInterp REQUIRED)
SET(CLAY_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/") SET(CLAY_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/")
SET(CLAY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tests-clay")
ADD_DEFINITIONS(-DCLAY_FIXTURE_PATH=\"${CLAY_FIXTURES}\") ADD_DEFINITIONS(-DCLAY_FIXTURE_PATH=\"${CLAY_FIXTURES}\")
INCLUDE_DIRECTORIES(tests-clay) INCLUDE_DIRECTORIES(${CLAY_PATH})
FILE(GLOB_RECURSE SRC_TEST tests-clay/*.c) FILE(GLOB_RECURSE SRC_TEST ${CLAY_PATH}/*/*.c ${CLAY_PATH}/clay_helpers.c ${CLAY_PATH}/testlib.c)
ADD_EXECUTABLE(libgit2_clay ${SRC} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP}) ADD_CUSTOM_COMMAND(
OUTPUT ${CLAY_PATH}/clay_main.c ${CLAY_PATH}/clay.h
COMMAND ${PYTHON_EXECUTABLE} clay -vtap .
DEPENDS ${CLAY_PATH}/clay ${SRC_TEST}
WORKING_DIRECTORY ${CLAY_PATH}
)
ADD_EXECUTABLE(libgit2_clay ${SRC} ${CLAY_PATH}/clay_main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP})
TARGET_LINK_LIBRARIES(libgit2_clay ${CMAKE_THREAD_LIBS_INIT}) TARGET_LINK_LIBRARIES(libgit2_clay ${CMAKE_THREAD_LIBS_INIT})
IF (WIN32) IF (WIN32)
TARGET_LINK_LIBRARIES(libgit2_clay ws2_32) TARGET_LINK_LIBRARIES(libgit2_clay ws2_32)
......
...@@ -9,13 +9,9 @@ https://github.com/tanoku/clay ...@@ -9,13 +9,9 @@ https://github.com/tanoku/clay
* Write your modules and tests. Use good, meaningful names. * Write your modules and tests. Use good, meaningful names.
* Mix the tests:
./clay -vtap .
* Make sure you actually build the tests by setting: * Make sure you actually build the tests by setting:
BUILD_CLAY=ON cmake -DBUILD_CLAY=ON build/
* Test: * Test:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment