Merge lp:~ralsina/u1db/cmake2 into lp:u1db

Proposed by Roberto Alsina on 2012-06-27
Status: Merged
Approved by: dobey on 2012-06-29
Approved revision: 348
Merged at revision: 335
Proposed branch: lp:~ralsina/u1db/cmake2
Merge into: lp:u1db
Diff against target: 232 lines (+120/-62)
6 files modified
CMakeLists.txt (+68/-0)
Makefile (+0/-33)
cmake/Modules/FindCython.cmake (+29/-0)
cmake/Modules/ReplicatePythonSourceTree.cmake (+14/-0)
setup.py (+2/-1)
src/CMakeLists.txt (+7/-28)
To merge this branch: bzr merge lp:~ralsina/u1db/cmake2
Reviewer Review Type Date Requested Status
dobey (community) Approve on 2012-06-28
Eric Casteleijn (community) 2012-06-27 Approve on 2012-06-27
Review via email: mp+112392@code.launchpad.net

Commit Message

Get rid of the top Makefile, go all cmake, fix deps.

Description of the Change

Get rid of the top Makefile, go all cmake, fix deps. No install target yet.

To test:

mkdir build && cd build && cmake .. && make check

To post a comment you must log in.
Eric Casteleijn (thisfred) wrote :

since make check does nothing, tarmac will fail this, so I think the make target will have to happen on this branch, or we need to make changes to tarmac.

review: Needs Fixing
Roberto Alsina (ralsina) wrote :

> since make check does nothing, tarmac will fail this, so I think the make
> target will have to happen on this branch, or we need to make changes to
> tarmac.

What do you mean "make check does nothing"?

Make check runs the tests :-)

Eric Casteleijn (thisfred) wrote :

I meant in the same place that tarmac looks. If the goal is to change tarmac to run the tests differently, then it's ok by me. (I still want Rodney's approval before marking approved though)

review: Approve
dobey (dobey) wrote :

If doing "cmake . && make check" instead of doing cmake .. in a subdir, the build fails unable to find u1db/u1db.h.

review: Needs Fixing
Roberto Alsina (ralsina) wrote :

> If doing "cmake . && make check" instead of doing cmake .. in a subdir, the
> build fails unable to find u1db/u1db.h.

Now it should work from anywhere.

dobey (dobey) wrote :

Well it works from a subdir and from not now it seems, though there's no way to "clean" the tree automatically and get rid of the extra cmake stuff.

review: Approve
Roberto Alsina (ralsina) wrote :

> Well it works from a subdir and from not now it seems, though there's no way
> to "clean" the tree automatically and get rid of the extra cmake stuff.

The "right" way to use cmake is not to build inside the sources. In that case, "distclean" is just "rm -rf *"

Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~ralsina/u1db/cmake2 into lp:u1db failed. Below is the output from the failed tests.

make: *** No rule to make target `check-valgrind'. Stop.

Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (3.7 KiB)

The attempt to merge lp:~ralsina/u1db/cmake2 into lp:u1db failed. Below is the output from the failed tests.

cmake version 2.8.8
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>

Options
  -C <initial-cache> = Pre-load a script to populate the cache.
  -D <var>:<type>=<value> = Create a cmake cache entry.
  -U <globbing_expr> = Remove matching entries from CMake cache.
  -G <generator-name> = Specify a makefile generator.
  -Wno-dev = Suppress developer warnings.
  -Wdev = Enable developer warnings.
  -E = CMake command mode.
  -i = Run in wizard mode.
  -L[A][H] = List non-advanced cached variables.
  --build <dir> = Build a CMake-generated project binary tree.
  -N = View mode only.
  -P <file> = Process script mode.
  --find-package = Run in pkg-config like mode.
  --graphviz=[file] = Generate graphviz of dependencies.
  --system-information [file] = Dump information about this system.
  --debug-trycompile = Do not delete the try_compile build tree.
                                Only useful on one try_compile at a time.
  --debug-output = Put cmake in a debug mode.
  --trace = Put cmake in trace mode.
  --warn-uninitialized = Warn about uninitialized values.
  --warn-unused-vars = Warn about unused variables.
  --no-warn-unused-cli = Don't warn about command line options.
  --check-system-vars = Find problems with variable usage in system
                                files.
  --help-command cmd [file] = Print help for a single command and exit.
  --help-command-list [file] = List available listfile commands and exit.
  --help-commands [file] = Print help for all commands and exit.
  --help-compatcommands [file]= Print help for compatibility commands.
  --help-module module [file] = Print help for a single module and exit.
  --help-module-list [file] = List available modules and exit.
  --help-modules [file] = Print help for all modules and exit.
  --help-custom-modules [file]= Print help for all custom modules and exit.
  --help-policy cmp [file] = Print help for a single policy and exit.
  --help-policies [file] = Print help for all policies and exit.
  --help-property prop [file] = Print help for a single property and exit.
  --help-property-list [file] = List available properties and exit.
  --help-properties [file] = Print help for all properties and exit.
  --help-variable var [file] = Print help for a single variable and exit.
  --help-variable-list [file] = List documented variables and exit.
  --help-variables [file] = Print help for all variables and exit.
  --copyright [file] = Print the CMake copyright and exit.
  --help,-help,-usage,-h,-H,/?= Print usage information and exit.
  --help-full [file] = Print full help and exit.
  --help-html [file] = Print full help in HTML format.
  --help-man [file] = Print full help as a UNIX man pa...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'CMakeLists.txt'
2--- CMakeLists.txt 1970-01-01 00:00:00 +0000
3+++ CMakeLists.txt 2012-06-28 17:11:18 +0000
4@@ -0,0 +1,68 @@
5+cmake_minimum_required (VERSION 2.6)
6+project (u1db)
7+
8+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
9+include_directories(${CMAKE_SOURCE_DIR}/include)
10+
11+find_package(Cython REQUIRED)
12+
13+find_package(CURL REQUIRED)
14+if (CURL_FOUND)
15+ include_directories(${CURL_INCLUDE_DIRS})
16+endif (CURL_FOUND)
17+
18+find_package(OAUTH REQUIRED)
19+if (OAUTH_FOUND)
20+ include_directories(${OAUTH_INCLUDE_DIRS})
21+endif (OAUTH_FOUND)
22+
23+find_package(JSON REQUIRED)
24+if (JSON_FOUND)
25+ include_directories(${JSON_INCLUDE_DIRS})
26+endif (JSON_FOUND)
27+
28+find_package(Sqlite3 REQUIRED)
29+if (Sqlite3_FOUND)
30+ include_directories(${Sqlite3_INCLUDE_DIRS})
31+endif (Sqlite3_FOUND)
32+
33+add_custom_target( ReplicatePythonSourceTree ALL ${CMAKE_COMMAND} -P
34+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/ReplicatePythonSourceTree.cmake
35+ ${CMAKE_CURRENT_BINARY_DIR}
36+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
37+
38+add_custom_target(check
39+ COMMAND python -m testtools.run discover
40+ DEPENDS build-inplace
41+)
42+
43+add_custom_target(build-inplace
44+ COMMAND python setup.py build_ext -i -I "${CMAKE_SOURCE_DIR}/include"
45+ DEPENDS ReplicatePythonSourceTree u1db
46+)
47+
48+add_custom_target(build-debug
49+ COMMAND python-dbg setup.py build_ext -i -I "${CMAKE_SOURCE_DIR}/include"
50+ DEPENDS ReplicatePythonSourceTree u1db
51+)
52+
53+add_custom_target(check-valgrind
54+ COMMAND valgrind --tool=memcheck --suppressions=${CMAKE_SOURCE_DIR}/custom.supp python-dbg -m testtools.run discover
55+ DEPENDS build-debug
56+)
57+
58+add_custom_target(check-valgrind-leaks
59+ COMMAND valgrind --tool=memcheck --suppressions=${CMAKE_SOURCE_DIR}/custom.supp --track-origins=yes --num-callers=40 --leak-resolution=high --leak-check=full python-dbg -m testtools.run discover
60+ DEPENDS build-debug
61+)
62+
63+add_custom_target(check-verbose
64+ COMMAND python -c \"import unittest, sys\; from testtools import run\; run.TestProgram(argv=sys.argv, testRunner=unittest.TextTestRunner(verbosity=2), stdout=sys.stdout)\" discover
65+ DEPENDS build-inplace
66+)
67+
68+add_custom_target(html-docs
69+ COMMAND cd ${CMAKE_SOURCE_DIR}/html-docs; make html
70+)
71+
72+add_subdirectory(src)
73\ No newline at end of file
74
75=== removed file 'Makefile'
76--- Makefile 2012-06-19 18:46:42 +0000
77+++ Makefile 1970-01-01 00:00:00 +0000
78@@ -1,33 +0,0 @@
79-
80-.PHONY: check check-verbose html-docs check-valgrind build-debug
81-
82-check: build-inplace
83- python -m testtools.run discover
84-
85-build-inplace: build-cmake
86- export CFLAGS='-Werror';\
87- python setup.py build_ext -i
88-
89-build-debug: build-cmake
90- export CFLAGS='-Werror';\
91- python-dbg setup.py build_ext -i
92-
93-check-valgrind: build-debug
94- valgrind --tool=memcheck \
95- --suppressions=custom.supp \
96- python-dbg -m testtools.run discover
97-
98-check-valgrind-leaks: build-debug
99- valgrind --tool=memcheck --suppressions=custom.supp \
100- --track-origins=yes --num-callers=40 --leak-resolution=high \
101- --leak-check=full python-dbg -m testtools.run discover
102-
103-check-verbose:
104- python -c "import unittest, sys; from testtools import run; run.TestProgram(argv=sys.argv, testRunner=unittest.TextTestRunner(verbosity=2), stdout=sys.stdout)" discover
105-
106-html-docs:
107- cd html-docs; make html
108-
109-build-cmake:
110- export CFLAGS='-fPIC';\
111- cd src; cmake . ; make
112
113=== added file 'cmake/Modules/FindCython.cmake'
114--- cmake/Modules/FindCython.cmake 1970-01-01 00:00:00 +0000
115+++ cmake/Modules/FindCython.cmake 2012-06-28 17:11:18 +0000
116@@ -0,0 +1,29 @@
117+# Find the Cython compiler.
118+#
119+# This code sets the following variables:
120+#
121+# CYTHON_EXECUTABLE
122+#
123+#=============================================================================
124+# Copyright 2011 Kitware, Inc.
125+#
126+# Licensed under the Apache License, Version 2.0 (the "License");
127+# you may not use this file except in compliance with the License.
128+# You may obtain a copy of the License at
129+#
130+# http://www.apache.org/licenses/LICENSE-2.0
131+#
132+# Unless required by applicable law or agreed to in writing, software
133+# distributed under the License is distributed on an "AS IS" BASIS,
134+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135+# See the License for the specific language governing permissions and
136+# limitations under the License.
137+#=============================================================================
138+
139+find_program( CYTHON_EXECUTABLE NAMES cython )
140+
141+include( FindPackageHandleStandardArgs )
142+FIND_PACKAGE_HANDLE_STANDARD_ARGS( Cython REQUIRED_VARS CYTHON_EXECUTABLE )
143+
144+mark_as_advanced( CYTHON_EXECUTABLE )
145+
146
147=== added file 'cmake/Modules/ReplicatePythonSourceTree.cmake'
148--- cmake/Modules/ReplicatePythonSourceTree.cmake 1970-01-01 00:00:00 +0000
149+++ cmake/Modules/ReplicatePythonSourceTree.cmake 2012-06-28 17:11:18 +0000
150@@ -0,0 +1,14 @@
151+# Note: when executed in the build dir, then CMAKE_CURRENT_SOURCE_DIR is the
152+# build dir.
153+file( COPY html-docs DESTINATION "${CMAKE_ARGV3}")
154+file( COPY setup.py u1db DESTINATION "${CMAKE_ARGV3}"
155+ FILES_MATCHING
156+ PATTERN "*.py"
157+ PATTERN "*.pyx"
158+ PATTERN "*.pyx"
159+ PATTERN "*.sql"
160+ PATTERN "*.key"
161+ PATTERN "*.cert"
162+ PATTERN "*.pem" )
163+file( COPY "u1db-serve" "u1db-client" "MANIFEST.in" "README"
164+ "COPYING" "COPYING.LESSER" DESTINATION "${CMAKE_ARGV3}")
165
166=== modified file 'setup.py'
167--- setup.py 2012-06-19 17:44:50 +0000
168+++ setup.py 2012-06-28 17:11:18 +0000
169@@ -15,6 +15,7 @@
170 # You should have received a copy of the GNU Lesser General Public License
171 # along with u1db. If not, see <http://www.gnu.org/licenses/>.
172
173+import os
174 import sys
175
176
177@@ -85,7 +86,7 @@
178 ext.append(Extension(
179 "u1db.tests.c_backend_wrapper",
180 ["u1db/tests/c_backend_wrapper.pyx"],
181- include_dirs=["include"],
182+ include_dirs=['include'],
183 library_dirs=["src"],
184 libraries=['u1db', 'sqlite3', 'oauth'] + extra_libs,
185 define_macros=[] + extra_defines,
186
187=== modified file 'src/CMakeLists.txt'
188--- src/CMakeLists.txt 2012-06-21 10:39:29 +0000
189+++ src/CMakeLists.txt 2012-06-28 17:11:18 +0000
190@@ -11,35 +11,14 @@
191 SET (LIB_TYPE SHARED)
192 ENDIF (BUILD_SHARED_LIBS)
193
194-
195-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake/Modules/")
196-include_directories(${CMAKE_SOURCE_DIR}/../include)
197-
198-find_package(CURL REQUIRED)
199-if (CURL_FOUND)
200- include_directories(${CURL_INCLUDE_DIRS})
201-endif (CURL_FOUND)
202-
203-find_package(OAUTH REQUIRED)
204-if (OAUTH_FOUND)
205- include_directories(${OAUTH_INCLUDE_DIRS})
206-endif (OAUTH_FOUND)
207-
208-find_package(JSON REQUIRED)
209-if (JSON_FOUND)
210- include_directories(${JSON_INCLUDE_DIRS})
211-endif (JSON_FOUND)
212-
213-find_package(Sqlite3 REQUIRED)
214-if (Sqlite3_FOUND)
215- include_directories(${Sqlite3_INCLUDE_DIRS})
216-endif (Sqlite3_FOUND)
217-
218 add_custom_command (
219- OUTPUT ${CMAKE_SOURCE_DIR}/u1db_schema.c
220- COMMAND python ${CMAKE_SOURCE_DIR}/../sql_to_c.py ${CMAKE_SOURCE_DIR}/../u1db/backends/dbschema.sql u1db__schema ${CMAKE_SOURCE_DIR}/u1db_schema.c
221- DEPENDS ${CMAKE_SOURCE_DIR}/../u1db/backends/dbschema.sql ${CMAKE_SOURCE_DIR}/../sql_to_c.py
222+ OUTPUT ${CMAKE_SOURCE_DIR}/src/u1db_schema.c
223+ COMMAND python ${CMAKE_SOURCE_DIR}/sql_to_c.py ${CMAKE_SOURCE_DIR}/u1db/backends/dbschema.sql u1db__schema ${CMAKE_SOURCE_DIR}/src/u1db_schema.c
224+ DEPENDS ${CMAKE_SOURCE_DIR}/u1db/backends/dbschema.sql ${CMAKE_SOURCE_DIR}/sql_to_c.py
225 )
226 add_library (u1db ${LIB_TYPE} mkstemp_compat.c u1db.c u1db_http_sync_target.c u1db_query.c u1db_sync_target.c u1db_uuid.c u1db_vectorclock.c u1db_schema.c)
227
228-SET_TARGET_PROPERTIES(u1db PROPERTIES SOVERSION 1)
229+SET_TARGET_PROPERTIES(u1db
230+ PROPERTIES SOVERSION 1
231+ COMPILE_FLAGS -fPIC
232+)

Subscribers

People subscribed via source and target branches