aboutsummaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-02-12 11:22:32 -0600
committerTed Gould <ted@gould.cx>2014-02-12 11:22:32 -0600
commit7035341609179f1d646b3c48df79c15d4fa5a72f (patch)
treed34b4e0902de50a76d6836b637d9b03ea95e2fad /tests/CMakeLists.txt
parent23482084db3c4b94ad019639507a5891d2199560 (diff)
downloadayatana-indicator-sound-7035341609179f1d646b3c48df79c15d4fa5a72f.tar.gz
ayatana-indicator-sound-7035341609179f1d646b3c48df79c15d4fa5a72f.tar.bz2
ayatana-indicator-sound-7035341609179f1d646b3c48df79c15d4fa5a72f.zip
Setting up the build so we can have Vala mocks
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b25b20a..09073b9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -10,6 +10,76 @@ add_library (gtest STATIC
${GTEST_SOURCE_DIR}/gtest_main.cc)
target_link_libraries(gtest ${GTEST_LIBS})
+###########################
+# Vala Mocks
+###########################
+
+set(VALA_MOCKS_HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/vala-mocks.h")
+set(VALA_MOCKS_SYMBOLS_PATH "${CMAKE_CURRENT_BINARY_DIR}/vala-mocks.def")
+
+vala_init(vala-mocks
+ DEPENDS
+ indicator-sound-service-lib
+ PACKAGES
+ config
+ gio-2.0
+ gio-unix-2.0
+ libxml-2.0
+ libpulse
+ libpulse-mainloop-glib
+ libnotify
+ accounts-service
+ indicator-sound-service
+ OPTIONS
+ --ccode
+ --thread
+ --vapidir=${CMAKE_BINARY_DIR}/src/
+ --vapidir=${CMAKE_SOURCE_DIR}/vapi/
+ --vapidir=.
+)
+
+vala_add(vala-mocks
+ media-player-mock.vala
+)
+
+vala_finish(vala-mocks
+ SOURCES
+ vala_mocks_VALA_SOURCES
+ OUTPUTS
+ vala_mocks_VALA_C
+ GENERATE_HEADER
+ ${VALA_MOCKS_HEADER_PATH}
+ GENERATE_SYMBOLS
+ ${VALA_MOCKS_SYMBOLS_PATH}
+)
+
+set_source_files_properties(
+ ${vala_mocks_VALA_SOURCES}
+ PROPERTIES
+ HEADER_FILE_ONLY TRUE
+)
+
+set(
+ VALA_MOCKS_SOURCES
+ ${vala_mocks_VALA_SOURCES}
+ ${vala_mocks_VALA_C}
+ ${VALA_MOCKS_SYMBOLS_PATH}
+)
+
+add_definitions(
+ -Wno-unused-but-set-variable
+)
+
+add_library(
+ vala-mocks-lib STATIC
+ ${VALA_MOCKS_SOURCES}
+)
+
+target_link_libraries(
+ vala-mocks-lib
+ indicator-sound-service-lib
+)
+
###########################
# Name Watch Test
@@ -29,6 +99,7 @@ add_executable (accounts-service-user-test accounts-service-user.cc)
target_link_libraries (
accounts-service-user-test
indicator-sound-service-lib
+ vala-mocks-lib
gtest
${SOUNDSERVICE_LIBRARIES}
${TEST_LIBRARIES}