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
/trash-*.exe
/libgit2.pc
......
......@@ -91,7 +91,7 @@ FILE(GLOB SRC_H include/git2/*.h)
# On Windows use specific platform sources
IF (WIN32 AND NOT CYGWIN)
ADD_DEFINITIONS(-DWIN32 -D_DEBUG)
ADD_DEFINITIONS(-DWIN32 -D_DEBUG)
FILE(GLOB SRC src/*.c src/transports/*.c src/win32/*.c)
ELSE()
FILE(GLOB SRC src/*.c src/transports/*.c src/unix/*.c)
......@@ -113,9 +113,9 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_
# Install
INSTALL(TARGETS git2
RUNTIME DESTINATION ${INSTALL_BIN}
LIBRARY DESTINATION ${INSTALL_LIB}
ARCHIVE DESTINATION ${INSTALL_LIB}
RUNTIME DESTINATION ${INSTALL_BIN}
LIBRARY DESTINATION ${INSTALL_LIB}
ARCHIVE DESTINATION ${INSTALL_LIB}
)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc DESTINATION ${INSTALL_LIB}/pkgconfig )
INSTALL(DIRECTORY include/git2 DESTINATION ${INSTALL_INC} )
......@@ -126,7 +126,7 @@ IF (BUILD_TESTS)
SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
ADD_DEFINITIONS(-DTEST_RESOURCES=\"${TEST_RESOURCES}\")
INCLUDE_DIRECTORIES(tests)
INCLUDE_DIRECTORIES(tests)
FILE(GLOB SRC_TEST tests/t??-*.c)
ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP})
......@@ -142,13 +142,22 @@ IF (BUILD_TESTS)
ENDIF ()
IF (BUILD_CLAY)
FIND_PACKAGE(PythonInterp REQUIRED)
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}\")
INCLUDE_DIRECTORIES(tests-clay)
FILE(GLOB_RECURSE SRC_TEST tests-clay/*.c)
INCLUDE_DIRECTORIES(${CLAY_PATH})
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})
IF (WIN32)
TARGET_LINK_LIBRARIES(libgit2_clay ws2_32)
......
......@@ -9,13 +9,9 @@ https://github.com/tanoku/clay
* Write your modules and tests. Use good, meaningful names.
* Mix the tests:
./clay -vtap .
* Make sure you actually build the tests by setting:
BUILD_CLAY=ON
cmake -DBUILD_CLAY=ON build/
* 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