From 5aaec95bbfb066130ecac03eece3813cee61a3e1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Feb 2011 14:50:11 +0200 Subject: Add test infrastructure for boost profile --- boost/Makefile.am | 12 + boost/build.bat | 96 ++++++ boost/common/Makefile.am | 7 + boost/common/common-vc10.sln | 15 + boost/common/common-vc9.sln | 15 + boost/common/makefile | 44 +++ boost/common/template/Makefile.am | 28 ++ boost/common/template/driver.cxx | 44 +++ boost/common/template/makefile | 119 +++++++ boost/common/template/template-vc10.vcxproj | 177 ++++++++++ .../common/template/template-vc10.vcxproj.filters | 24 ++ boost/common/template/template-vc9.vcproj | 360 ++++++++++++++++++++ boost/common/template/test.hxx | 27 ++ boost/common/template/test.std | 1 + boost/common/test.bat | 81 +++++ boost/makefile | 38 +++ boost/mysql/Makefile.am | 7 + boost/mysql/makefile | 35 ++ boost/mysql/mysql-vc10.sln | 15 + boost/mysql/mysql-vc9.sln | 15 + boost/mysql/template/Makefile.am | 31 ++ boost/mysql/template/driver.cxx | 44 +++ boost/mysql/template/makefile | 116 +++++++ boost/mysql/template/template-vc10.vcxproj | 180 ++++++++++ boost/mysql/template/template-vc10.vcxproj.filters | 25 ++ boost/mysql/template/template-vc9.vcproj | 361 +++++++++++++++++++++ boost/mysql/template/test.hxx | 27 ++ boost/mysql/template/test.std | 1 + boost/mysql/test.bat | 70 ++++ 29 files changed, 2015 insertions(+) create mode 100644 boost/Makefile.am create mode 100644 boost/build.bat create mode 100644 boost/common/Makefile.am create mode 100644 boost/common/common-vc10.sln create mode 100644 boost/common/common-vc9.sln create mode 100644 boost/common/makefile create mode 100644 boost/common/template/Makefile.am create mode 100644 boost/common/template/driver.cxx create mode 100644 boost/common/template/makefile create mode 100644 boost/common/template/template-vc10.vcxproj create mode 100644 boost/common/template/template-vc10.vcxproj.filters create mode 100644 boost/common/template/template-vc9.vcproj create mode 100644 boost/common/template/test.hxx create mode 100644 boost/common/template/test.std create mode 100644 boost/common/test.bat create mode 100644 boost/makefile create mode 100644 boost/mysql/Makefile.am create mode 100644 boost/mysql/makefile create mode 100644 boost/mysql/mysql-vc10.sln create mode 100644 boost/mysql/mysql-vc9.sln create mode 100644 boost/mysql/template/Makefile.am create mode 100644 boost/mysql/template/driver.cxx create mode 100644 boost/mysql/template/makefile create mode 100644 boost/mysql/template/template-vc10.vcxproj create mode 100644 boost/mysql/template/template-vc10.vcxproj.filters create mode 100644 boost/mysql/template/template-vc9.vcproj create mode 100644 boost/mysql/template/test.hxx create mode 100644 boost/mysql/template/test.std create mode 100644 boost/mysql/test.bat (limited to 'boost') diff --git a/boost/Makefile.am b/boost/Makefile.am new file mode 100644 index 0000000..85915d2 --- /dev/null +++ b/boost/Makefile.am @@ -0,0 +1,12 @@ +# file : boost/Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +SUBDIRS = common + +if DATABASE_MYSQL +SUBDIRS += mysql +endif + +EXTRA_DIST = __file__(extra_dist) diff --git a/boost/build.bat b/boost/build.bat new file mode 100644 index 0000000..4e4536c --- /dev/null +++ b/boost/build.bat @@ -0,0 +1,96 @@ +@echo off +rem file : boost/build.bat +rem author : Boris Kolpackov +rem copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +rem license : GNU GPL v2; see accompanying LICENSE file + +rem +rem build.bat database vc-version [/Build|/Clean|/Rebuild] +rem +rem Build Boost tests using the VC++ batch mode compilation. +rem + +setlocal + +set "confs=__path__(configurations)" +set "plats=__path__(platforms)" +set "failed=" + +if "_%1_" == "__" ( + echo no database specified + goto usage +) + +if "_%2_" == "__" ( + echo no VC++ version specified + goto usage +) + +if "_%2_" == "_9_" set "vcver=9" +if "_%2_" == "_10_" set "vcver=10" + +if "_%vcver%_" == "__" ( + echo unknown VC++ version %2 + goto usage +) + +set "action=%3" +if "_%action%_" == "__" set "action=/Build" + +set "devenv=%DEVENV%" +if "_%devenv%_" == "__" set "devenv=devenv.com" + +goto start + +rem +rem %1 - solution name +rem %2 - configuration to build +rem %3 - platform to build +rem +:run_build + echo. + echo building boost/%1 %3 %2 + "%devenv%" %1 %action% "%2|%3" 2>&1 + if errorlevel 1 set "failed=%failed% boost/%1\%3\%2" +goto :eof + +:start + +for %%d in (%1) do ( + for %%c in (%confs%) do ( + for %%p in (%plats%) do ( + call :run_build %%d/%%d-vc%vcver%.sln %%c %%p + ) + ) +) + +for %%c in (%confs%) do ( + for %%p in (%plats%) do ( + call :run_build common/common-%1-vc%vcver%.sln %%c %%p + ) +) + +if not "_%failed%_" == "__" goto error + +echo. +echo ALL BUILDS SUCCEEDED +echo. +goto end + +:usage +echo. +echo usage: build.bat database vc-version [action] +echo valid actions are /Build, /Clean, and /Rebuild +echo. + +:error +if not "_%failed%_" == "__" ( + echo. + for %%t in (%failed%) do echo FAILED: %%t + echo. +) +endlocal +exit /b 1 + +:end +endlocal diff --git a/boost/common/Makefile.am b/boost/common/Makefile.am new file mode 100644 index 0000000..2b3806b --- /dev/null +++ b/boost/common/Makefile.am @@ -0,0 +1,7 @@ +# file : boost/common/Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +SUBDIRS = __path__(dirs) +EXTRA_DIST = __file__(extra_dist) diff --git a/boost/common/common-vc10.sln b/boost/common/common-vc10.sln new file mode 100644 index 0000000..9a5dc32 --- /dev/null +++ b/boost/common/common-vc10.sln @@ -0,0 +1,15 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +__projects__ +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution +__solution_configurations__ + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution +__project_configurations__ + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/boost/common/common-vc9.sln b/boost/common/common-vc9.sln new file mode 100644 index 0000000..2ec9432 --- /dev/null +++ b/boost/common/common-vc9.sln @@ -0,0 +1,15 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +__projects__ +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution +__solution_configurations__ + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution +__project_configurations__ + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/boost/common/makefile b/boost/common/makefile new file mode 100644 index 0000000..eeb083e --- /dev/null +++ b/boost/common/makefile @@ -0,0 +1,44 @@ +# file : boost/common/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make + +tests := \ +template + +all_tests := $(tests) +build_tests := $(tests) + +default := $(out_base)/ +dist := $(out_base)/.dist +test := $(out_base)/.test +clean := $(out_base)/.clean + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_tests))) + +name := $(notdir $(src_base)) +$(dist): name := $(name) +$(dist): export dirs := $(tests) +$(dist): export extra_dist := test.bat $(call vc9slns,$(name)) \ +$(call vc10slns,$(name)) +$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_tests))) + $(call meta-automake) + $(call meta-vc9slns,$(name)) + $(call meta-vc10slns,$(name)) + $(call meta-vctest,$(name)-mysql-vc10.sln,test.bat) + +$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(build_tests))) +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_tests))) + +$(call include,$(bld_root)/meta/vc9sln.make) +$(call include,$(bld_root)/meta/vc10sln.make) +$(call include,$(bld_root)/meta/vctest.make) +$(call include,$(bld_root)/meta/automake.make) + +ifneq ($(filter $(MAKECMDGOALS),dist clean),) +$(foreach t,$(all_tests),$(call import,$(src_base)/$t/makefile)) +else +$(foreach t,$(build_tests),$(call import,$(src_base)/$t/makefile)) +endif diff --git a/boost/common/template/Makefile.am b/boost/common/template/Makefile.am new file mode 100644 index 0000000..4ab6efe --- /dev/null +++ b/boost/common/template/Makefile.am @@ -0,0 +1,28 @@ +# file : boost/common/template/Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +EXTRA_DIST = __file__(extra_dist) + +noinst_PROGRAMS = driver +driver_SOURCES = driver.cxx __path__(extra_sources) __path__(extra_headers) +LDADD = $(top_builddir)/libcommon/common/libcommon.la +AM_CPPFLAGS = -I'$(top_builddir)/libcommon' -I'$(top_srcdir)/libcommon' + +TESTS=$(top_builddir)/tester +TESTS_ENVIRONMENT=top_builddir=$(top_builddir); export top_builddir; + +# ODB compilation. +# +driver_SOURCES += test.hxx +nodist_driver_SOURCES = test-odb.cxx +BUILT_SOURCES = test-odb.hxx +CLEANFILES = test-odb.hxx test-odb.ixx test-odb.cxx + +ODB = @ODB@ +ODBFLAGS = @ODBFLAGS@ +ODBCPPFLAGS = @ODBCPPFLAGS@ + +test-odb.hxx: test.hxx + $(ODB) $(AM_CPPFLAGS) $(ODBCPPFLAGS) $(CPPFLAGS) $(ODBFLAGS) __value__(odb_options) $< diff --git a/boost/common/template/driver.cxx b/boost/common/template/driver.cxx new file mode 100644 index 0000000..19ce6d8 --- /dev/null +++ b/boost/common/template/driver.cxx @@ -0,0 +1,44 @@ +// file : boost/common/template/driver.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +// PLACE TEST DESCRIPTION HERE +// + +#include // std::auto_ptr +#include +#include + +#include +#include + +#include + +#include "test.hxx" +#include "test-odb.hxx" + +using namespace std; +using namespace odb; + +int +main (int argc, char* argv[]) +{ + try + { + auto_ptr db (create_database (argc, argv)); + + // + // + cout << "test 001" << endl; + { + transaction t (db->begin ()); + t.commit (); + } + } + catch (const odb::exception& e) + { + cerr << e.what () << endl; + return 1; + } +} diff --git a/boost/common/template/makefile b/boost/common/template/makefile new file mode 100644 index 0000000..d22654e --- /dev/null +++ b/boost/common/template/makefile @@ -0,0 +1,119 @@ +# file : boost/common/template/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make + +cxx_tun := driver.cxx +odb_hdr := test.hxx +cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o)) +cxx_od := $(cxx_obj:.o=.o.d) + +common.l := $(out_root)/libcommon/common/common.l +common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options + +driver := $(out_base)/driver +dist := $(out_base)/.dist +test := $(out_base)/.test +clean := $(out_base)/.clean + +# Import. +# +$(call import,\ + $(scf_root)/import/odb/stub.make,\ + odb: odb,odb-rules: odb_rules) + +$(call import,\ + $(scf_root)/import/libodb-boost/stub.make,\ + l: odb_boost.l,cpp-options: odb_boost.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libboost/header-only/stub.make,\ + cpp-options: boost.l.cpp-options) + +# Build. +# +$(driver): $(cxx_obj) $(odb_boost.l) $(common.l) +$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) +$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \ +$(boost.l.cpp-options) + +genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql) +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): $(odb) +$(gen): odb := $(odb) +$(gen) $(dist): export odb_options += --database $(db_id) --profile boost \ +--generate-schema +$(gen): cpp_options := -I$(out_base) +$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \ +$(boost.l.cpp-options) + +$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) + +# Alias for default target. +# +$(out_base)/: $(driver) + +# Dist +# +name := $(notdir $(src_base)) + +$(dist): db_id := @database@ +$(dist): sources := $(cxx_tun) +$(dist): headers := $(odb_hdr) +$(dist): data_dist := test.std +$(dist): export name := $(name) +$(dist): export extra_dist := $(data_dist) $(call vc9projs,$(name)) \ +$(call vc10projs,$(name)) +$(dist): + $(call dist-data,$(sources) $(headers) $(data_dist)) + $(call meta-automake,../template/Makefile.am) + $(call meta-vc9projs,../template/template,$(name)) + $(call meta-vc10projs,../template/template,$(name)) + +# Test. +# +$(test): $(driver) $(src_base)/test.std + $(call message,sql $$1,$(dcf_root)/db-driver $$1, $(src_base)/test.sql) + $(call message,test $<,$< --options-file $(dcf_root)/db.options \ +>$(out_base)/test.out) + $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out) + $(call message,,rm -f $(out_base)/test.out) + +# Clean. +# +$(clean): \ + $(driver).o.clean \ + $(addsuffix .cxx.clean,$(cxx_obj)) \ + $(addsuffix .cxx.clean,$(cxx_od)) \ + $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean)) + $(call message,,rm -f $(out_base)/test.out) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := driver $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + +# How to. +# +$(call include,$(bld_root)/dist.make) +$(call include,$(bld_root)/meta/vc9proj.make) +$(call include,$(bld_root)/meta/vc10proj.make) +$(call include,$(bld_root)/meta/automake.make) + +$(call include,$(odb_rules)) +$(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/o-e.make) + +# Dependencies. +# +$(call import,$(src_root)/libcommon/makefile) diff --git a/boost/common/template/template-vc10.vcxproj b/boost/common/template/template-vc10.vcxproj new file mode 100644 index 0000000..44c2813 --- /dev/null +++ b/boost/common/template/template-vc10.vcxproj @@ -0,0 +1,177 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {__uuid__()} + Win32Proj + __value__(name) + + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + false + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + + + + true + $(Configuration)\ + driver + + + true + $(Platform)\$(Configuration)\ + driver + + + false + $(Configuration)\ + driver + + + false + $(Platform)\$(Configuration)\ + driver + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies) + Console + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib64\common-d.lib;odb-__value__(database)-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies) + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies) + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib64\common.lib;odb-__value__(database).lib;odb-boost.lib;odb.lib;%(AdditionalDependencies) + Console + true + true + true + + + +__custom_build_entry__( +test.hxx, +odb test.hxx, +odb.exe __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), @database@, __value__(database)) -DHAVE_CONFIG_VC_H -I..\..\..\libcommon)) test.hxx, +test-odb.hxx;test-odb.ixx;test-odb.cxx) + + +__header_entry__(test-odb.hxx) +__header_entry__(test-odb.ixx) +__header_entries__(extra_headers) + + +__source_entry__(driver.cxx) +__source_entry__(test-odb.cxx) +__source_entries__(extra_sources) + + + + + diff --git a/boost/common/template/template-vc10.vcxproj.filters b/boost/common/template/template-vc10.vcxproj.filters new file mode 100644 index 0000000..f3ee658 --- /dev/null +++ b/boost/common/template/template-vc10.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + {__uuid__()} + cxx + + + {__uuid__()} + h;hxx;ixx;txx + + + +__header_filter_entry__(test.hxx) +__header_filter_entry__(test-odb.hxx) +__header_filter_entry__(test-odb.ixx) +__header_filter_entries__(extra_headers) + + +__source_filter_entry__(driver.cxx) +__source_filter_entry__(test-odb.cxx) +__source_filter_entries__(extra_sources) + + \ No newline at end of file diff --git a/boost/common/template/template-vc9.vcproj b/boost/common/template/template-vc9.vcproj new file mode 100644 index 0000000..e024770 --- /dev/null +++ b/boost/common/template/template-vc9.vcproj @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +__source_entry__(driver.cxx) +__source_entry__(test-odb.cxx) +__source_entries__(extra_sources) + + +__file_entry_custom_build__( +test.hxx, +odb test.hxx, +odb.exe __xml__(__shell_quotes__(m4_patsubst(__value__(odb_options), @database@, __value__(database)) -DHAVE_CONFIG_VC_H -I..\..\..\libcommon)) test.hxx, +test-odb.hxx;test-odb.ixx;test-odb.cxx) +__file_entry__(test-odb.hxx) +__file_entry__(test-odb.ixx) +__file_entries__(extra_headers) + + + + + diff --git a/boost/common/template/test.hxx b/boost/common/template/test.hxx new file mode 100644 index 0000000..ca19cba --- /dev/null +++ b/boost/common/template/test.hxx @@ -0,0 +1,27 @@ +// file : boost/common/template/test.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef TEST_HXX +#define TEST_HXX + +#include + +#pragma db object +struct object +{ + object (unsigned long id) + : id_ (id) + { + } + + object () + { + } + + #pragma db id + unsigned long id_; +}; + +#endif // TEST_HXX diff --git a/boost/common/template/test.std b/boost/common/template/test.std new file mode 100644 index 0000000..af8d8e7 --- /dev/null +++ b/boost/common/template/test.std @@ -0,0 +1 @@ +test 001 diff --git a/boost/common/test.bat b/boost/common/test.bat new file mode 100644 index 0000000..a5f035a --- /dev/null +++ b/boost/common/test.bat @@ -0,0 +1,81 @@ +@echo off +rem file : boost/common/test.bat +rem author : Boris Kolpackov +rem copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +rem license : GNU GPL v2; see accompanying LICENSE file + +setlocal + +set "tests=__path__(dirs)" +set "confs=__path__(configurations)" +set "plats=__path__(platforms)" +set "curdir=%CD%" +set "topdir=%curdir%\..\.." +set "failed=" + +if "_%1_" == "__" ( + echo no database specified + goto usage +) + +goto start + +rem +rem %1 - test directory +rem %2 - configuration +rem %3 - platform +rem %4 - database +rem +:run_test + cd %1 + + if "_%3_" == "_Win32_" ( + set "dir=%2" + ) else ( + set "dir=%3\%2" + ) + + if exist %dir%\driver.exe ( + echo %1\%3\%2 + call %topdir%\tester.bat %4 %2 %3 + if errorlevel 1 ( + set "failed=%failed% %1\%3\%2" + ) + ) + + cd %curdir% +goto :eof + +:start + +for %%t in (%tests%) do ( + for %%c in (%confs%) do ( + for %%p in (%plats%) do ( + call :run_test %%t %%c %%p %1 + ) + ) +) + +if not "_%failed%_" == "__" goto error + +echo. +echo ALL TESTS PASSED +echo. +goto end + +:usage +echo. +echo usage: test.bat database +echo. + +:error +if not "_%failed%_" == "__" ( + echo. + for %%t in (%failed%) do echo FAILED: %%t + echo. +) +endlocal +exit /b 1 + +:end +endlocal diff --git a/boost/makefile b/boost/makefile new file mode 100644 index 0000000..8ab4602 --- /dev/null +++ b/boost/makefile @@ -0,0 +1,38 @@ +# file : boost/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make + +all_dirs := common mysql +dirs := common + +ifeq ($(db_id),mysql) +dirs += mysql +endif + +default := $(out_base)/ +dist := $(out_base)/.dist +test := $(out_base)/.test +clean := $(out_base)/.clean + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs))) + +$(dist): export extra_dist := build.bat +$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_dirs))) + $(call meta-vctest,common/common-mysql-vc10.sln,build.bat) + $(call meta-automake) + +$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(dirs))) +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(all_dirs))) + +$(call include,$(bld_root)/dist.make) +$(call include,$(bld_root)/meta/vctest.make) +$(call include,$(bld_root)/meta/automake.make) + +ifneq ($(filter $(MAKECMDGOALS),dist clean),) +$(foreach d,$(all_dirs),$(call import,$(src_base)/$d/makefile)) +else +$(foreach d,$(dirs),$(call import,$(src_base)/$d/makefile)) +endif diff --git a/boost/mysql/Makefile.am b/boost/mysql/Makefile.am new file mode 100644 index 0000000..8d1c143 --- /dev/null +++ b/boost/mysql/Makefile.am @@ -0,0 +1,7 @@ +# file : boost/mysql/Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +SUBDIRS = __path__(dirs) +EXTRA_DIST = __file__(extra_dist) diff --git a/boost/mysql/makefile b/boost/mysql/makefile new file mode 100644 index 0000000..0d3b7b4 --- /dev/null +++ b/boost/mysql/makefile @@ -0,0 +1,35 @@ +# file : boost/mysql/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make + +tests := \ +template + +default := $(out_base)/ +dist := $(out_base)/.dist +test := $(out_base)/.test +clean := $(out_base)/.clean + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests))) + +$(dist): name := $(notdir $(src_base)) +$(dist): export dirs := $(tests) +$(dist): export extra_dist := $(name)-vc9.sln $(name)-vc10.sln test.bat +$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(tests))) + $(call meta-automake) + $(call meta-vc9sln,$(name)-vc9.sln) + $(call meta-vc10sln,$(name)-vc10.sln) + $(call meta-vctest,$(name)-vc10.sln,test.bat) + +$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests))) +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests))) + +$(call include,$(bld_root)/meta/vc9sln.make) +$(call include,$(bld_root)/meta/vc10sln.make) +$(call include,$(bld_root)/meta/vctest.make) +$(call include,$(bld_root)/meta/automake.make) + +$(foreach t,$(tests),$(call import,$(src_base)/$t/makefile)) diff --git a/boost/mysql/mysql-vc10.sln b/boost/mysql/mysql-vc10.sln new file mode 100644 index 0000000..9a5dc32 --- /dev/null +++ b/boost/mysql/mysql-vc10.sln @@ -0,0 +1,15 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +__projects__ +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution +__solution_configurations__ + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution +__project_configurations__ + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/boost/mysql/mysql-vc9.sln b/boost/mysql/mysql-vc9.sln new file mode 100644 index 0000000..2ec9432 --- /dev/null +++ b/boost/mysql/mysql-vc9.sln @@ -0,0 +1,15 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +__projects__ +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution +__solution_configurations__ + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution +__project_configurations__ + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/boost/mysql/template/Makefile.am b/boost/mysql/template/Makefile.am new file mode 100644 index 0000000..29017fa --- /dev/null +++ b/boost/mysql/template/Makefile.am @@ -0,0 +1,31 @@ +# file : boost/mysql/template/Makefile.am +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +EXTRA_DIST = __file__(extra_dist) + +noinst_PROGRAMS = driver +driver_SOURCES = driver.cxx __path__(extra_sources) __path__(extra_headers) +LDADD = $(top_builddir)/libcommon/common/libcommon.la +AM_CPPFLAGS = -I'$(top_builddir)/libcommon' -I'$(top_srcdir)/libcommon' + +TESTS=$(top_builddir)/tester +TESTS_ENVIRONMENT=top_builddir=$(top_builddir); export top_builddir; + +m4_ifelse(__value__(odb_options),,, + +# ODB compilation. +# +driver_SOURCES += test.hxx +nodist_driver_SOURCES = test-odb.cxx +BUILT_SOURCES = test-odb.hxx +CLEANFILES = test-odb.hxx test-odb.ixx test-odb.cxx + +ODB = @ODB@ +ODBFLAGS = @ODBFLAGS@ +ODBCPPFLAGS = @ODBCPPFLAGS@ + +test-odb.hxx: test.hxx + $(ODB) $(AM_CPPFLAGS) $(ODBCPPFLAGS) $(CPPFLAGS) $(ODBFLAGS) __value__(odb_options) $< +) diff --git a/boost/mysql/template/driver.cxx b/boost/mysql/template/driver.cxx new file mode 100644 index 0000000..8a65b0c --- /dev/null +++ b/boost/mysql/template/driver.cxx @@ -0,0 +1,44 @@ +// file : boost/mysql/template/driver.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +// PLACE TEST DESCRIPTION HERE +// + +#include // std::auto_ptr +#include +#include + +#include +#include + +#include + +#include "test.hxx" +#include "test-odb.hxx" + +using namespace std; +using namespace odb; + +int +main (int argc, char* argv[]) +{ + try + { + auto_ptr db (create_database (argc, argv)); + + // + // + cout << "test 001" << endl; + { + transaction t (db->begin ()); + t.commit (); + } + } + catch (const odb::exception& e) + { + cerr << e.what () << endl; + return 1; + } +} diff --git a/boost/mysql/template/makefile b/boost/mysql/template/makefile new file mode 100644 index 0000000..5abc8bc --- /dev/null +++ b/boost/mysql/template/makefile @@ -0,0 +1,116 @@ +# file : boost/mysql/template/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make + +cxx_tun := driver.cxx +odb_hdr := test.hxx +cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o)) +cxx_od := $(cxx_obj:.o=.o.d) + +common.l := $(out_root)/libcommon/common/common.l +common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options + +driver := $(out_base)/driver +dist := $(out_base)/.dist +test := $(out_base)/.test +clean := $(out_base)/.clean + +# Import. +# +$(call import,\ + $(scf_root)/import/odb/stub.make,\ + odb: odb,odb-rules: odb_rules) + +$(call import,\ + $(scf_root)/import/libodb-boost/stub.make,\ + l: odb_boost.l,cpp-options: odb_boost.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libboost/header-only/stub.make,\ + cpp-options: boost.l.cpp-options) + +# Build. +# +$(driver): $(cxx_obj) $(odb_boost.l) $(common.l) +$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) +$(cxx_obj) $(cxx_od): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \ +$(boost.l.cpp-options) + +genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx) $(odb_hdr:.hxx=.sql) +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): $(odb) +$(gen): odb := $(odb) +$(gen) $(dist): export odb_options += --database mysql --profile boost \ +--generate-schema +$(gen): cpp_options := -I$(out_base) +$(gen): $(common.l.cpp-options) $(odb_boost.l.cpp-options) \ +$(boost.l.cpp-options) + +$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) + +# Alias for default target. +# +$(out_base)/: $(driver) + +# Dist +# +$(dist): sources := $(cxx_tun) +$(dist): headers := $(odb_hdr) +$(dist): data_dist := test.std +$(dist): export name := $(notdir $(src_base)) +$(dist): export extra_dist := $(data_dist) $(name)-vc9.vcproj \ +$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters +$(dist): + $(call dist-data,$(sources) $(headers) $(data_dist)) + $(call meta-automake,../template/Makefile.am) + $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) + $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) + +# Test. +# +$(test): $(driver) $(src_base)/test.std + $(call message,sql $$1,$(dcf_root)/db-driver $$1, $(src_base)/test.sql) + $(call message,test $<,$< --options-file $(dcf_root)/db.options \ +>$(out_base)/test.out) + $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out) + $(call message,,rm -f $(out_base)/test.out) + +# Clean. +# +$(clean): \ + $(driver).o.clean \ + $(addsuffix .cxx.clean,$(cxx_obj)) \ + $(addsuffix .cxx.clean,$(cxx_od)) \ + $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean)) + $(call message,,rm -f $(out_base)/test.out) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := driver $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + +# How to. +# +$(call include,$(bld_root)/dist.make) +$(call include,$(bld_root)/meta/vc9proj.make) +$(call include,$(bld_root)/meta/vc10proj.make) +$(call include,$(bld_root)/meta/automake.make) + +$(call include,$(odb_rules)) +$(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/o-e.make) + +# Dependencies. +# +$(call import,$(src_root)/libcommon/makefile) diff --git a/boost/mysql/template/template-vc10.vcxproj b/boost/mysql/template/template-vc10.vcxproj new file mode 100644 index 0000000..53f73ab --- /dev/null +++ b/boost/mysql/template/template-vc10.vcxproj @@ -0,0 +1,180 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {__uuid__()} + Win32Proj + __value__(name) + + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + false + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + + + + true + $(Configuration)\ + driver + + + true + $(Platform)\$(Configuration)\ + driver + + + false + $(Configuration)\ + driver + + + false + $(Platform)\$(Configuration)\ + driver + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies) + Console + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib64\common-d.lib;odb-mysql-d.lib;odb-boost-d.lib;odb-d.lib;%(AdditionalDependencies) + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies) + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_VC_H;%(PreprocessorDefinitions) + ..\..\..\libcommon + 4068;4355;4800;4290;%(DisableSpecificWarnings) + + + ..\..\..\libcommon\lib64\common.lib;odb-mysql.lib;odb-boost.lib;odb.lib;%(AdditionalDependencies) + Console + true + true + true + + +m4_ifelse(__value__(odb_options),,, +m4_dnl + +__custom_build_entry__( +test.hxx, +odb test.hxx, +odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -I..\..\..\libcommon)) test.hxx, +test-odb.hxx;test-odb.ixx;test-odb.cxx) + ) + +m4_ifelse(__value__(odb_options),,, +__header_entry__(test-odb.hxx) +__header_entry__(test-odb.ixx)) +__header_entries__(extra_headers) + + +__source_entry__(driver.cxx) +m4_ifelse(__value__(odb_options),,,__source_entry__(test-odb.cxx)) +__source_entries__(extra_sources) + + + + + diff --git a/boost/mysql/template/template-vc10.vcxproj.filters b/boost/mysql/template/template-vc10.vcxproj.filters new file mode 100644 index 0000000..951015b --- /dev/null +++ b/boost/mysql/template/template-vc10.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {__uuid__()} + cxx + + + {__uuid__()} + h;hxx;ixx;txx + + + +m4_ifelse(__value__(odb_options),,, +__header_filter_entry__(test.hxx) +__header_filter_entry__(test-odb.hxx) +__header_filter_entry__(test-odb.ixx)) +__header_filter_entries__(extra_headers) + + +__source_filter_entry__(driver.cxx) +m4_ifelse(__value__(odb_options),,,__source_filter_entry__(test-odb.cxx)) +__source_filter_entries__(extra_sources) + + \ No newline at end of file diff --git a/boost/mysql/template/template-vc9.vcproj b/boost/mysql/template/template-vc9.vcproj new file mode 100644 index 0000000..9d446a2 --- /dev/null +++ b/boost/mysql/template/template-vc9.vcproj @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +__source_entry__(driver.cxx) +m4_ifelse(__value__(odb_options),,,__source_entry__(test-odb.cxx)) +__source_entries__(extra_sources) + + +m4_ifelse(__value__(odb_options),,, +__file_entry_custom_build__( +test.hxx, +odb test.hxx, +odb.exe __xml__(__shell_quotes__(__value__(odb_options) -DHAVE_CONFIG_VC_H -I..\..\..\libcommon)) test.hxx, +test-odb.hxx;test-odb.ixx;test-odb.cxx) +__file_entry__(test-odb.hxx) +__file_entry__(test-odb.ixx)) +__file_entries__(extra_headers) + + + + + diff --git a/boost/mysql/template/test.hxx b/boost/mysql/template/test.hxx new file mode 100644 index 0000000..c89562b --- /dev/null +++ b/boost/mysql/template/test.hxx @@ -0,0 +1,27 @@ +// file : boost/mysql/template/test.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef TEST_HXX +#define TEST_HXX + +#include + +#pragma db object +struct object +{ + object (unsigned long id) + : id_ (id) + { + } + + object () + { + } + + #pragma db id + unsigned long id_; +}; + +#endif // TEST_HXX diff --git a/boost/mysql/template/test.std b/boost/mysql/template/test.std new file mode 100644 index 0000000..af8d8e7 --- /dev/null +++ b/boost/mysql/template/test.std @@ -0,0 +1 @@ +test 001 diff --git a/boost/mysql/test.bat b/boost/mysql/test.bat new file mode 100644 index 0000000..e9b2e5d --- /dev/null +++ b/boost/mysql/test.bat @@ -0,0 +1,70 @@ +@echo off +rem file : boost/mysql/test.bat +rem author : Boris Kolpackov +rem copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +rem license : GNU GPL v2; see accompanying LICENSE file + +setlocal + +set "tests=__path__(dirs)" +set "confs=__path__(configurations)" +set "plats=__path__(platforms)" +set "curdir=%CD%" +set "topdir=%curdir%\..\.." +set "failed=" + +goto start + +rem +rem %1 - test directory +rem %2 - configuration +rem %3 - platform +rem +:run_test + cd %1 + + if "_%3_" == "_Win32_" ( + set "dir=%2" + ) else ( + set "dir=%3\%2" + ) + + if exist %dir%\driver.exe ( + echo %1\%3\%2 + call %topdir%\tester.bat mysql %2 %3 + if errorlevel 1 ( + set "failed=%failed% %1\%3\%2" + ) + ) + + cd %curdir% +goto :eof + +:start + +for %%t in (%tests%) do ( + for %%c in (%confs%) do ( + for %%p in (%plats%) do ( + call :run_test %%t %%c %%p + ) + ) +) + +if not "_%failed%_" == "__" goto error + +echo. +echo ALL TESTS PASSED +echo. +goto end + +:error +if not "_%failed%_" == "__" ( + echo. + for %%t in (%failed%) do echo FAILED: %%t + echo. +) +endlocal +exit /b 1 + +:end +endlocal -- cgit v1.1