summaryrefslogtreecommitdiff
path: root/ept/CMakeLists.txt
blob: 19e9edf5f33cad770a6c5a4d611277405dfd307f (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
project( ept )
include( ${WIBBLE_TEST_CMAKE} )

file( GLOB src *.cpp debtags/*.cc debtags/maint/*.cc
  popcon/*.cc popcon/maint/*.cc apt/*.cc axi/*.cc )

file( GLOB h_top *.h )
file( GLOB h_apt apt/*.h )
file( GLOB h_debtags debtags/*.h debtags/*.tcc )
file( GLOB h_debtags_maint debtags/maint/*.h debtags/maint/*.tcc )
file( GLOB h_popcon popcon/*.h )
file( GLOB h_popcon_maint popcon/maint/*.h )
file( GLOB h_axi axi/*.h )

file( GLOB debtagstesth debtags/*.test.h debtags/maint/*.test.h )
file( GLOB popcontesth popcon/*.test.h )
file( GLOB apttesth apt/*.test.h )
file( GLOB axitesth axi/*.test.h )
set( testh ${debtagstesth} ${popcontesth}
           ${apttesth} ${axitesth} )

include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} 
                     ${TAGCOLL_INCLUDE_DIRS} ${WIBBLE_INCLUDE_DIRS} )
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
link_libraries( ${WIBBLE_LIBRARIES} ${TAGCOLL_LIBRARIES} apt-pkg xapian -lsocket )
else(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
link_libraries( ${WIBBLE_LIBRARIES} ${TAGCOLL_LIBRARIES} apt-pkg xapian -lpthread )
endif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
add_definitions( -fexceptions -fPIC -fvisibility=default )

add_library( ept SHARED ${src} )
add_library( ept-static STATIC ${src} )
set_target_properties( ept PROPERTIES SOVERSION ${LIBEPT_SOVERSION} CLEAN_DIRECT_OUTPUT 1)
set_target_properties( ept-static PROPERTIES SOVERSION ${LIBEPT_SOVERSION} OUTPUT_NAME "ept" CLEAN_DIRECT_OUTPUT 1)

set( TEST_ENV_DIR ${ept_BINARY_DIR}/test-env/ )

configure_file( ${ept_SOURCE_DIR}/config.h.cmake-in
  ${ept_BINARY_DIR}/config.h )

set( prefix "${CMAKE_INSTALL_PREFIX}" )
set( exec_prefix "${prefix}/bin" )
set( libdir "${prefix}/lib" )
set( includedir "${prefix}/include" )
configure_file( ${ept_SOURCE_DIR}/libept.pc.in
  ${ept_BINARY_DIR}/libept.pc @ONLY )

# regression testing
link_directories( ${CMAKE_CURRENT_BINARY_DIR}/../lib )
link_libraries( ept )
wibble_add_test( ept-test ${testh} )

set( datastamp ${CMAKE_CURRENT_BINARY_DIR}/data-stamp )
set( datadir ${CMAKE_CURRENT_SOURCE_DIR}/test-data )
set( listfile wherever_debian_._Packages )

wibble_check_target( ept-test ${datastamp} )

execute_process( COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCH )
string( REPLACE "\n" "" ARCH "${ARCH}" )

add_custom_command(
  OUTPUT ${datastamp}
  COMMAND mkdir -p test-env/etc test-env/state/lists/partial
		           test-env/cache test-env/debtags
			   test-env/cache/archives/partial test-env/desktop
  COMMAND sed -e s,i386,${ARCH}, < ${datadir}/packagelist > test-env/state/lists/${listfile}
  COMMAND cp -a ${datadir}/etc/sources.list test-env/etc/
  COMMAND sed -e s,i386,${ARCH}, < ${datadir}/dpkg-status > test-env/dpkg-status
  COMMAND cp -a ${datadir}/desktop/*.desktop test-env/desktop/
  COMMAND cp ${datadir}/debtags/package-tags test-env/debtags/test.tag
  COMMAND cp ${datadir}/debtags/vocabulary test-env/debtags/test.voc
  COMMAND mkdir -p test-env/debtags/empty
  COMMAND mkdir -p test-env/debtags/user
  COMMAND mkdir -p test-env/xapian/
  COMMAND mkdir -p test-env/popcon/
  COMMAND mkdir -p test-env/popcon/empty
  COMMAND cp -a ${datadir}/popcon/all-popcon-results.txt.gz test-env/popcon/
  COMMAND cp -a ${datadir}/popcon/popularity-contest test-env/popcon/
  COMMAND touch data-stamp )

install( TARGETS ept ept-static
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib )

install( FILES ${ept_BINARY_DIR}/libept.pc DESTINATION lib/pkgconfig )
install( FILES ${h_top} DESTINATION include/ept )
install( FILES ${h_apt} DESTINATION include/ept/apt )
install( FILES ${h_debtags} DESTINATION include/ept/debtags )
install( FILES ${h_debtags_maint} DESTINATION include/ept/debtags/maint )
install( FILES ${h_popcon} DESTINATION include/ept/popcon )
install( FILES ${h_popcon_maint} DESTINATION include/ept/popcon/maint )
install( FILES ${h_axi} DESTINATION include/ept/axi )