project(SimTK_python) cmake_minimum_required(VERSION 2.6 FATAL_ERROR) # PY_STAGING_DIR is where the python package area is created # as opposed to PY_TESTINSTALL_DIR which a local final binary install # for local testing. set(PY_STAGING_DIR "${CMAKE_BINARY_DIR}/package" CACHE PATH "Where temporary python package directory will be created") mark_as_advanced(PY_STAGING_DIR) set(PY_TESTINSTALL_DIR "${CMAKE_BINARY_DIR}/testinstall" CACHE PATH "Where temporary python install directory will be created") mark_as_advanced(PY_TESTINSTALL_DIR) set(SimTK_PYTHON_ENABLE_TESTING ON CACHE BOOL "Whether to create tests") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules") add_subdirectory(pyplusplus) if(SimTK_PYTHON_ENABLE_TESTING) # Copy python sources into testing area file(GLOB_RECURSE PY_SRCS RELATIVE "${CMAKE_SOURCE_DIR}/simtk" "${CMAKE_SOURCE_DIR}/simtk/*.py") # message("${PY_SRCS}") foreach(SRC ${PY_SRCS}) set(infile "${CMAKE_SOURCE_DIR}/simtk/${SRC}") set(outfile "${PY_TESTINSTALL_DIR}/simtk/${SRC}") add_custom_command( OUTPUT "${outfile}" COMMAND ${CMAKE_COMMAND} -E copy "${infile}" "${outfile}" DEPENDS "${infile}" COMMENT "Creating ${outfile}" ) set(MOVED_PY_SRCS "${MOVED_PY_SRCS}" "${outfile}") # message("${infile}" "${outfile}") endforeach(SRC ${PY_SRCS}) add_custom_target(CopyPySources ALL DEPENDS ${MOVED_PY_SRCS}) # Add test programs enable_testing() add_subdirectory(test) endif(SimTK_PYTHON_ENABLE_TESTING)