mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-14 18:33:16 +08:00
now cmake takes snippets of code, completes them into compilable sources, builds them,
executes them and stores their output in files.
This commit is contained in:
parent
ee3410f79a
commit
a316cd8a76
@ -1,6 +1,10 @@
|
||||
IF(BUILD_DOC)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
ADD_SUBDIRECTORY(snippets)
|
||||
|
||||
ENDIF(BUILD_DOC)
|
||||
|
@ -1,14 +1,20 @@
|
||||
FILE(GLOB examples_SRCS "*.cpp")
|
||||
FILE(GLOB snippets_SRCS "*.cpp")
|
||||
|
||||
FOREACH(example_src ${examples_SRCS})
|
||||
GET_FILENAME_COMPONENT(example ${example_src} NAME_WE)
|
||||
ADD_EXECUTABLE(${example} ${example_src})
|
||||
GET_TARGET_PROPERTY(example_executable ${example} LOCATION)
|
||||
FOREACH(snippet_src ${snippets_SRCS})
|
||||
GET_FILENAME_COMPONENT(snippet ${snippet_src} NAME_WE)
|
||||
SET(compile_snippet_target compile_${snippet})
|
||||
SET(compile_snippet_src ${compile_snippet_target}.cpp)
|
||||
FILE(READ ${snippet_src} snippet_source_code)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
ADD_EXECUTABLE(${compile_snippet_target}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
GET_TARGET_PROPERTY(compile_snippet_executable
|
||||
${compile_snippet_target} LOCATION)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET ${example}
|
||||
TARGET ${compile_snippet_target}
|
||||
POST_BUILD
|
||||
COMMAND ${example_executable}
|
||||
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out
|
||||
COMMAND ${compile_snippet_executable}
|
||||
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
|
||||
)
|
||||
MESSAGE(coucou)
|
||||
ENDFOREACH(example_src)
|
||||
ENDFOREACH(snippet_src)
|
||||
|
7
doc/snippets/compile_snippet.cpp.in
Normal file
7
doc/snippets/compile_snippet.cpp.in
Normal file
@ -0,0 +1,7 @@
|
||||
#include <Eigen/Core.h>
|
||||
USING_EIGEN_DATA_TYPES
|
||||
using namespace std;
|
||||
int main(int, char**)
|
||||
{
|
||||
${snippet_source_code}
|
||||
}
|
@ -1,10 +1,3 @@
|
||||
#include <Eigen/Core.h>
|
||||
USING_EIGEN_DATA_TYPES
|
||||
using namespace std;
|
||||
int main(int, char**)
|
||||
{
|
||||
Matrix4d m = Matrix4d::identity();
|
||||
m.dynBlock(2,0,2,2) = m.dynBlock(0,0,2,2);
|
||||
cout << m << endl;
|
||||
return 0;
|
||||
}
|
||||
Matrix4d m = Matrix4d::identity();
|
||||
m.dynBlock(2,0,2,2) = m.dynBlock(0,0,2,2);
|
||||
cout << m << endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user