Merge lp:~thomas-voss/unity/new-gmock into lp:unity

Proposed by Thomas Voß
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: no longer in the source branch.
Merged at revision: 3419
Proposed branch: lp:~thomas-voss/unity/new-gmock
Merge into: lp:unity
Diff against target: 158 lines (+46/-23)
4 files modified
CMakeLists.txt (+31/-9)
debian/control (+1/-1)
tests/CMakeLists.txt (+7/-11)
tests/test-gestures/CMakeLists.txt (+7/-2)
To merge this branch: bzr merge lp:~thomas-voss/unity/new-gmock
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Didier Roche-Tolomelli Approve
Review via email: mp+173450@code.launchpad.net

Commit message

Adjust CMake setup to account for new GMock version.

Description of the change

Adjust CMake setup to account for new GMock version.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

approved! Let's wait for nux now and we can merge all those :)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

approving globally now that new gmock is available

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-07-03 16:13:29 +0000
3+++ CMakeLists.txt 2013-07-09 11:47:26 +0000
4@@ -270,9 +270,25 @@
5 add_subdirectory(doc)
6
7 # Check for google test and build it locally
8+set (
9+ GMOCK_ROOT_DIR
10+ "/usr/src/gmock"
11+ CACHE
12+ PATH
13+ "Path to Google mock srcs"
14+)
15+
16+set (
17+ GMOCK_INCLUDE_DIR
18+ "/usr/include/gmock/include"
19+ CACHE
20+ PATH
21+ "Path to Google mock include"
22+)
23+
24 set(
25 GTEST_ROOT_DIR
26- "/usr/src/gtest" # Default value, adjustable by user with e.g., ccmake
27+ "${GMOCK_ROOT_DIR}/gtest" # Default value, adjustable by user with e.g., ccmake
28 CACHE
29 PATH
30 "Path to Google test srcs"
31@@ -280,20 +296,26 @@
32
33 set(
34 GTEST_INCLUDE_DIR
35- "/usr/include/gtest"
36+ "${GMOCK_ROOT_DIR}/gtest/include"
37 CACHE
38 PATH
39 "Path to Google tests include"
40 )
41
42-find_path(GTEST_INCLUDE_DIR gtest/gtest.h)
43-if (GTEST_INCLUDE_DIR)
44- #FIXME - hardcoded is bad!
45+if (GTEST_INCLUDE_DIR AND GMOCK_INCLUDE_DIR)
46+ include_directories (
47+ ${GMOCK_INCLUDE_DIR}
48+ ${GTEST_INCLUDE_DIR}
49+ )
50 add_subdirectory(
51- ${GTEST_ROOT_DIR}
52- gtest
53- )
54-endif(GTEST_INCLUDE_DIR)
55+ ${GMOCK_ROOT_DIR}
56+ "${CMAKE_CURRENT_BINARY_DIR}/gmock"
57+ )
58+elseif (GTEST_INCLUDE_DIR AND NOT GMOCK_INCLUDE_DIR)
59+ include_directories (
60+ ${GTEST_INCLUDE_DIR}
61+ )
62+endif(GTEST_INCLUDE_DIR AND GMOCK_INCLUDE_DIR)
63
64 add_subdirectory(services)
65 add_subdirectory(tests)
66
67=== modified file 'debian/control'
68--- debian/control 2013-07-04 12:07:03 +0000
69+++ debian/control 2013-07-09 11:47:26 +0000
70@@ -47,7 +47,7 @@
71 libxi-dev (>= 2:1.7.1.901),
72 libxpathselect-dev (>=1.3),
73 libgtest-dev,
74- google-mock,
75+ google-mock (>= 1.6.0+svn437),
76 Standards-Version: 3.9.3
77 Homepage: https://launchpad.net/unity
78 # If you aren't a member of ~unity-team but need to upload packaging changes,
79
80=== modified file 'tests/CMakeLists.txt'
81--- tests/CMakeLists.txt 2013-07-02 01:11:30 +0000
82+++ tests/CMakeLists.txt 2013-07-09 11:47:26 +0000
83@@ -76,13 +76,10 @@
84 #
85
86 enable_testing()
87-# :(
88-find_library (GMOCK_LIB gmock)
89-find_library (GMOCK_MAIN_LIB gmock_main)
90-find_path(GTEST_SRC_DIR gtest.cc PATHS /usr/src/gtest/src)
91+set(GMOCK_LIB gmock)
92+set(GMOCK_MAIN_LIB gmock_main)
93
94-if (GTEST_SRC_DIR AND
95- GMOCK_LIB AND
96+if (GMOCK_LIB AND
97 GMOCK_MAIN_LIB)
98
99 # MockWindowManager
100@@ -351,8 +348,7 @@
101 panel-lib)
102 add_test(UnityGTest test-gtest)
103 endif (ENABLE_X_SUPPORT)
104-endif (GTEST_SRC_DIR AND
105- GMOCK_LIB AND
106+endif (GMOCK_LIB AND
107 GMOCK_MAIN_LIB)
108
109 if(ENABLE_X_SUPPORT)
110@@ -388,7 +384,7 @@
111 #&& ${GTEST_TEST_COMMAND_DBUS} --gtest_output=xml:./
112 && echo "Warning, DBus test cases are disabled!!")
113
114-if (GTEST_SRC_DIR)
115+if (GTEST_ROOT_DIR)
116 if (ENABLE_X_SUPPORT)
117 add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit test-gtest test-gtest-slow test-gtest-xless test-gtest-dbus test-gestures)
118 add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest-xless test-gtest-dbus test-gestures)
119@@ -399,9 +395,9 @@
120 add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest-xless)
121 endif ()
122 add_custom_target (check-report COMMAND ${TEST_UNIT_COMMAND} && gtester-report ${TEST_RESULT_XML} > ${TEST_RESULT_HTML})
123-else (GTEST_SRC_DIR)
124+else (GTEST_ROOT_DIR)
125 add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit)
126-endif (GTEST_SRC_DIR)
127+endif (GTEST_ROOT_DIR)
128 # make target to allow devs to run "make autopilot" from build dir:
129 set (AUTOPILOTDIR "${CMAKE_CURRENT_SOURCE_DIR}/autopilot")
130 # Rules to install autopilot files and executable script:
131
132=== modified file 'tests/test-gestures/CMakeLists.txt'
133--- tests/test-gestures/CMakeLists.txt 2013-07-01 22:05:30 +0000
134+++ tests/test-gestures/CMakeLists.txt 2013-07-09 11:47:26 +0000
135@@ -1,4 +1,4 @@
136-if (GTEST_SRC_DIR)
137+if (GTEST_ROOT_DIR)
138 set(UNITY_SRC ${CMAKE_SOURCE_DIR}/plugins/unityshell/src)
139
140 add_custom_command(OUTPUT CompoundGestureRecognizer.cpp
141@@ -33,6 +33,11 @@
142 remove_definitions(${CFLAGS})
143 set_directory_properties(PROPERTY INCLUDE_DIRECTORIES "")
144
145+ include_directories (
146+ ${GMOCK_INCLUDE_DIR}
147+ ${GTEST_INCLUDE_DIR}
148+ )
149+
150 include_directories (${CMAKE_SOURCE_DIR})
151 include_directories (${CMAKE_SOURCE_DIR}/unity-shared)
152
153@@ -71,4 +76,4 @@
154 add_dependencies(test-gestures gtest unity-core-${UNITY_API_VERSION})
155
156 add_custom_target (check-gestures COMMAND ./test-gestures DEPENDS test-gestures)
157-endif (GTEST_SRC_DIR)
158+endif (GTEST_ROOT_DIR)