Basic unit test build configuration.
This commit is contained in:
parent
f548e6b6a4
commit
6ce262a3b7
5 changed files with 94 additions and 6 deletions
|
|
@ -23,6 +23,13 @@ set(VERSION "0.11.2-dev")
|
|||
set(VERSION_INFO "Release")
|
||||
set(LANGUAGE_SUPPORT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/locale)
|
||||
|
||||
#
|
||||
# Primary library minimum version requirements. See src/CMakeLists.txt
|
||||
# for others.
|
||||
#
|
||||
set(TARGET_GLIB 2.42) # Also passed to valac, so don't include a point rev
|
||||
set(TARGET_GTK 3.14.0)
|
||||
|
||||
if (NOT ISO_CODE_639_XML)
|
||||
find_path(ISOCODES_DIRECTORY NAMES iso_639.xml PATHS ${CMAKE_INSTALL_PREFIX} /usr/share/xml/iso-codes)
|
||||
if (ISOCODES_DIRECTORY)
|
||||
|
|
@ -140,6 +147,14 @@ endif ()
|
|||
# GResources
|
||||
include(GlibCompileResourcesSupport)
|
||||
|
||||
#
|
||||
# Unit tests.
|
||||
#
|
||||
# We don't use CMake's enable_testing/add_test built-ins because they
|
||||
# use ctest.
|
||||
add_custom_target(test ALL geary-test)
|
||||
add_dependencies(test geary-test)
|
||||
|
||||
#
|
||||
# Uninstall target
|
||||
#
|
||||
|
|
@ -169,7 +184,7 @@ add_dependencies(uninstall uninstall-base)
|
|||
# everything has has been removed
|
||||
add_custom_target(
|
||||
post-uninstall
|
||||
)
|
||||
)
|
||||
|
||||
# Dist
|
||||
# This generates the dist tarballs
|
||||
|
|
@ -216,3 +231,4 @@ add_subdirectory(po)
|
|||
add_subdirectory(sql)
|
||||
add_subdirectory(ui)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
||||
|
|
|
|||
|
|
@ -37,16 +37,19 @@ distclean: clean
|
|||
@-rm -rf $(BUILD_DIR)
|
||||
@-rm -f Makefile
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@$(MAKE) -C $(BUILD_DIR) $@
|
||||
|
||||
.PHONY: dist
|
||||
dist:
|
||||
dist: test
|
||||
@$(MAKE) -C $(BUILD_DIR) dist
|
||||
@cp build/*.xz .
|
||||
|
||||
.PHONY: ubuntu
|
||||
ubuntu:
|
||||
ubuntu: test
|
||||
@$(MAKE) -C $(BUILD_DIR) ubuntu
|
||||
|
||||
.PHONY: valadoc
|
||||
valadoc:
|
||||
@$(MAKE) -C $(BUILD_DIR) valadoc
|
||||
|
||||
|
|
|
|||
|
|
@ -481,13 +481,12 @@ else ()
|
|||
)
|
||||
endif ()
|
||||
|
||||
set(TARGET_GLIB 2.42)
|
||||
|
||||
pkg_check_modules(DEPS REQUIRED
|
||||
gthread-2.0
|
||||
glib-2.0>=${TARGET_GLIB}.0
|
||||
gio-2.0>=${TARGET_GLIB}.0
|
||||
gtk+-3.0>=3.14.0
|
||||
gtk+-3.0>=${TARGET_GTK}
|
||||
libsoup-2.4>=2.48
|
||||
gee-0.8>=0.8.5
|
||||
libnotify>=0.7.5
|
||||
|
|
|
|||
59
test/CMakeLists.txt
Normal file
59
test/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# Geary build script
|
||||
# Copyright 2016 Software Freedom Conservancy Inc.
|
||||
# Copyright 2016 Michael Gratton <mike@vee.net>
|
||||
|
||||
set(TEST_SRC
|
||||
main.vala
|
||||
)
|
||||
|
||||
# Vala
|
||||
find_package(Vala REQUIRED)
|
||||
include(ValaVersion)
|
||||
include(ValaPrecompile)
|
||||
|
||||
pkg_check_modules(DEPS REQUIRED
|
||||
gee-0.8
|
||||
gio-2.0
|
||||
glib-2.0
|
||||
gmime-2.6
|
||||
gthread-2.0
|
||||
)
|
||||
|
||||
set(TEST_PACKAGES
|
||||
glib-2.0 gio-2.0 gee-0.8 gmime-2.6 geary-static
|
||||
)
|
||||
|
||||
set(CFLAGS
|
||||
${DEPS_CFLAGS}
|
||||
${DEPS_CFLAGS_OTHER}
|
||||
-D_BUILD_ROOT_DIR=\"${CMAKE_BINARY_DIR}\"
|
||||
-D_SOURCE_ROOT_DIR=\"${CMAKE_SOURCE_DIR}\"
|
||||
)
|
||||
|
||||
set(LIB_PATHS ${DEPS_LIBRARY_DIRS})
|
||||
link_directories(${LIB_PATHS})
|
||||
add_definitions(${CFLAGS})
|
||||
|
||||
set(VALAC_OPTIONS
|
||||
--vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi
|
||||
--metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata
|
||||
--target-glib=${TARGET_GLIB}
|
||||
--thread
|
||||
--debug
|
||||
--enable-checking
|
||||
--enable-deprecated
|
||||
--fatal-warnings
|
||||
${EXTRA_VALA_OPTIONS}
|
||||
)
|
||||
|
||||
vala_precompile(TEST_VALA_C geary-test
|
||||
${TEST_SRC}
|
||||
PACKAGES
|
||||
${TEST_PACKAGES}
|
||||
OPTIONS
|
||||
${VALAC_OPTIONS}
|
||||
--vapidir=${CMAKE_BINARY_DIR}/src
|
||||
)
|
||||
|
||||
add_executable(geary-test ${TEST_VALA_C})
|
||||
target_link_libraries(geary-test ${DEPS_LIBRARIES} gthread-2.0 geary-static)
|
||||
11
test/main.vala
Normal file
11
test/main.vala
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright 2016 Michael Gratton <mike@vee.net>
|
||||
*
|
||||
* This software is licensed under the GNU Lesser General Public License
|
||||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
void main(string[] args) {
|
||||
Test.init(ref args);
|
||||
print("OHHAI!");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue