Quick fix for CMake broken Visual Studio 11 .sln

Current CMake 2.8.6 generates broken .sln files for Visual Studio 11 Developer Preview. The bug has been fixed already in CMake upstream.

Meanwhile, I have become annoyed by manually fixing the solution files. Here is quick .bat script I call from my cmake-{project}.bat proxy scripts I maintain for every project configured with CMake. So the fix is applied automatically every time I run CMake:

@echo off
REM Fix broken Visual Studio 11 .sln generated by CMake 2.8.6 (or earlier)
set SED="C:\Program Files (x86)\GnuWin32\bin\sed.exe"
set SLN=%1
copy %SLN% %SLN%.copy
%SED% "s/Studio 2011/Studio 11/g" %SLN%.copy > %SLN%
del /Q %SLN%.copy

FindBoost.cmake patched for Visual Studio 11

My patch updating CMake module FindBoost.cmake for Boost C++ Libraries lookup has been accepted and committed to the CMake Git repository. Thanks to Brad King for quick review.

The patch adds most recent versions of Boost 1.47 and 1.48 to the lookup table and uses correct toolset tag vc110 (see Library Naming) when checking for libraries built using Visual Studio 11.

New SOCI Project Leader needed

Maciej Sobczak, current leader of SOCI project has just announced on soci-users mailing list that he is looking for a volunteer willing to take over the project leadership. For someone, who would like to take over the project management responsibilities and has a good understanding of the subject as well as a solid vision of what to do with the project in the future.

SOCI is a database access library for C++ that makes the illusion of embedding SQL queries in the regular C++ code, staying entirely within the Standard C++.

Building Boost with Visual Studio 11 Developer Preview

Yesterday, I installed Visual Studio 11 Developer Preview. The new release is available for free and is usable for free until June 2012, so it’s a great opportunity to try and learn what Microsoft has to offer for C++ programmers. And, it looks it offers a lot, including SCARY features.

The first test I usually do when it comes to test a new C++ toolset is to build Boost C++ Libraries using mainstream development sources.

The Boost simply builds well. I have even configured build of Boost.Python using Python version 3.2.

There are no hacks required to make the build happen. Simply, follow Boost Getting Started on Windows, section 5.3. Or, Build Binaries From Source. Once the Boost.Build tools bootstrapped, I issued the following command:

b2 --toolset=msvc variant=debug runtime-link=shared threading=multi define=_CRT_NONSTDC_NO_DEPRECATE define=_CRT_SECURE_NO_DEPRECATE define=_SCL_SECURE_NO_DEPRECATE stage

Fifteen minutes later, the Boost build was ready and staged.

By the way, some time ago Christian Henning posted a quick cheat sheet of bjam commands for Visual Studio. It’s very handy.

Update on SqlGeometry and POINT EMPTY in WKB

Long time ago I discussed about how SqlGeometry handles POINT EMPTY in WKB format. The SqlGeometry states the definition of OGC GEOMETRY type for Microsoft SQL Server. Shortly, the message was that SqlGeometry implicitly casts POINT EMPTY to MULTIPOINT EMPTY geometry when generating WKB output. PostGIS casts as well, but does it in a consistent way, in my opinion, outputting GEOMETRYCOLLECTION.

Following those findings, I assumed it is not quite correct, or I didn’t like the inconsistency, and I had reported it to Microsoft Connect as a bug: SqlGeometry reports invalid type of WKB of POINT EMPTY.

Recently, I have received a couple of comments from Microsoft to my report. The comments are attached to the report linked above, but I paste them below for completeness and archive:

Our development team for the spatial data types tells me that it is not possible to use a single value for the WKB format of any spatial data type. For the POINT EMPTY, the WKB format does not allow empty points, so we are outputting a MULTIPOINT with zero elements.
In a MULTIPOINT EMPTY, we are stripping out empty points.

The reasoning is technically correct. It’s just Microsoft does it differently. However, as second comment suggests, the current behaviour may change in future:

But we might consider changing it to get consistent behavior.

SOCI 3.1.0 Released

It has been a very long journey since version 3.0.0 of SOCI was released. Namely, it’s been nearly three years. The RERO philosophy didn’t quite kick in somehow, but the new SOCI 3.1.0 is finally out.

The latest package can be downloaded from here http://sourceforge.net/projects/soci/ and the complete documentation is part of the package as well as available on-line at http://soci.sourceforge.net/doc/index.html. The project web page reflects the latest changes as well http://soci.sourceforge.net/.

This new release brings all the developments that took place during the last two years and that were up to now somewhat inconveniently available only from our Git repository. At the same time it also defines the snapshot and a basis for subsequent library evolution.

Here extract from the CHANGES file

Version 3.1.0 differs from 3.0.0 in the following ways:

  • Added Ada language binding
  • Migrated build system from GNU Autotools and Visual Studio projects to CMake
  • CMake build tested with Visual Studio, GCC and clang
  • Incorporated a compromise for naming versioned shared libraries
  • Enhanced and improved integration with Boost libraries: Boost.DateTime, Boost.Fusion, Boost.Optional, Boost.Tuple
  • Bug fixes and improvements in core and backends:
    • Added soci::values::get_properties accessor useful for composing soci::type_conversion
    • Export advanced API of backend loader from DLL
    • Added static factory registration functions for backends
    • Added get_affected_rows operation
    • Fixed thread-safety of connection pool under Windows
    • Fixed bug with dropping const qualifiers when binding to std::vector<soci::indicator>
    • Fixed bug in default initialization of an object of const backend_factory which requires user-provided default constructor (see C++03/C++0x)
    • Fixes for 64-bit builds
    • Removed redundant exchange_traits breaking ODR on LP64
    • Better ODBC support
    • Type conversion support for unsigned integer types
    • Bug ID:1971436 – incorrect rowset copy operations
    • Bug ID:2010367 – memory leak (ODBC)
    • Bug ID:2010409 – invalid memory allocation in define by position (ODBC)
    • Bug ID:2021243 – long long type support in Visual C++
    • Patch ID:2483066 – 64bit Linux and 64bit integer submitted
    • Patch ID:2809809 – Fix build with GCC 4.4
    • Patch ID:2809810 – Fix SQLite3 build with GCC 4.3
    • Patch ID:2581206 – Windows Unicode application
    • Patch ID:3058275 – install target for CMake build submitted
    • Patch ID:3069375 – use $(prefix)/lib64 on AMD64 platforms
    • Improved performance while accessing query results (MySQL)
    • Bug fixes for PROCEDURE support (MySQL)
    • Removed throw statements from mysql_rowid_backend and mysql_blob_backend destructors (MySQL)
    • Verify that prepared statements survive session::reconnect() operation (MySQL)
    • Improved support for time and date (MySQL, PostgreSQL)
    • Fixed bug with strings of length exceeding 255 characters (ODBC)
    • Improved interpretation of the connect string (Oracle)
    • Added handling of unsigned long long (Oracle, SQLite3, PostgreSQL)
    • Fixes in integral types support (PostgreSQL)
    • Support for colon-casts (PostgreSQL)
    • Added possibility for use BLOB (PostgreSQL)
    • Added support for connection property “synchronous=on|off” (SQLite3)
    • Improved BLOB data handling (SQLite3)
    • Improved boolean type support (SQLite3)
    • Session timeout support (SQLite3)
    • Improved tests clean-up (SQLite3)
    • Added missing typedef of sqlite3_destructor_type which has been defined in sqlite3.h but since 3.3.10 (see comment for reference to SQLite ticket)
  • Updated tests for various backends and SQL data types
  • Changed naming conventions and style across all the source code
  • Firebird backend removed from official release as not actively maintained. Available in the Git repository
  • Migrated from CVS to Git repository

On behalf of SOCI Team, I’d like to thank all users and contributors who actively helped us to bring the new release to the public. I have tried hard to list everyone in the AUTHORS file. If anyone has been omitted, it happened by mistake and please don’t hesitate to tell me.

Unfortunately, due to lack of active maintenance the Firebird backend has been removed. Also, the ODBC backend needs more love, especially testing. However, we welcome anyone who is interested in taking over the maintenance of the Firebird backend as well as helping us to test and improve the ODBC backend.

As the author of the CMake configuration, I’m strongly interested in any feedback and constructive critique. Please, feel free to post your comments to soci-users. Do you have any ideas for SOCI backends to other databases? Share it!

We are very excited about this release. It allows us to define the directions for future work. There is plenty of ideas to pursue.

Preparing for Subversion to Git migration

GEOS is slowly moving to Git, so I decided to clear the Subversion specific settings, namely the svn:keywords. The procedure is quick and based on the commands I used to perform bulk svn:keywords property update.

First, svn:keywords property is removed:

find . -path '*/.svn' -prune -o -type f -print  | xargs svn propdel -q svn:keywords

Next, line consisting of $Id$ keyword is stripped from every plain text file using a tiny script coded in Python:


#! /usr/bin/env python
import fileinput
import re
import sys

def strip_line(filename, rx):
    sys.stderr.write(filename + '\n')
    for line in fileinput.input(filename, inplace=1):
        m = re.match(rx, line)
        if m is None:
            sys.stdout.write(line)
        else:
            sys.stderr.write(line)

if len(sys.argv) < 2:
    sys.exit("Missing filename")

pattern = '^.*\$Id.*$'
rx = re.compile(pattern, re.DOTALL)
strip_line(sys.argv[1], rx)

The script is executed for every file, excluding the working copy admin area in .svn:

for f in `find . -path '*/.svn' -prune -o -type f -print`; do ~/bin/strip_line_regex.py $f; done;

Voila!

Update: Torvalds answers Does GIT has vc keywords like CVS/Subversion?