blob: 61acab668e66e4f00ea445f41062ae153f2a0e36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
### Main library
add_library(libmodman SHARED module.cpp module_manager.cpp)
if(NOT WIN32)
target_link_libraries(libmodman dl)
endif()
set_target_properties(libmodman PROPERTIES PREFIX "" VERSION 0 SOVERSION 0.0.0)
install(TARGETS libmodman DESTINATION ${rlibdir})
### Tests
function(mm_create_module MODTYPE MODNAME MODCOND MODSYMB)
configure_file(test/module.cpp.in test/${MODTYPE}_${MODNAME}.cpp @ONLY)
if(NOT IS_DIRECTORY test/modules/${MODTYPE})
file(MAKE_DIRECTORY test/modules/${MODTYPE})
endif()
add_library(test/modules/${MODTYPE}/${MODNAME} MODULE test/${MODTYPE}_${MODNAME}.cpp)
set_target_properties(test/modules/${MODTYPE}/${MODNAME} PROPERTIES PREFIX "")
endfunction(mm_create_module)
function(mm_create_program name EXTTYPE)
add_executable(test/${name} test/main.cpp)
set_property(TARGET test/${name} PROPERTY COMPILE_DEFINITIONS "EXTTYPE=${EXTTYPE}_extension")
target_link_libraries(test/${name} libmodman)
if(${ARGC} GREATER 2)
target_link_libraries(test/${name} ${ARGN};libmodman)
endif()
endfunction(mm_create_program)
function(mm_create_test name progname modtype)
add_test(NAME ${name} COMMAND test/${progname} test/modules/${modtype} ${ARGN})
endfunction(mm_create_test)
# I'm not sure why this doesn't work on win32
if(UNIX)
mm_create_module(condition one false NULL)
mm_create_module(condition two true NULL)
mm_create_module(singleton one true NULL)
mm_create_module(singleton two true NULL)
mm_create_module(sorted one true NULL)
mm_create_module(sorted two true NULL)
mm_create_module(symbol one true \"asdfoia\")
mm_create_module(symbol two true \"deflate\")
mm_create_program(condition condition)
mm_create_program(singleton singleton)
mm_create_program(sorted sorted)
mm_create_program(symbol symbol)
mm_create_program(symbolz symbol z)
mm_create_test(condition condition condition two)
mm_create_test(singleton singleton singleton one)
mm_create_test(sorted sorted sorted two one)
mm_create_test(symbol symbolz symbol two)
mm_create_test(nosymbol symbol symbol)
mm_create_test(nosymreq symbol symbol one)
endif(UNIX)
|