Cleanup and improvement to build script

- no googletest on appveyor as cloning this submodule does not wordk
This commit is contained in:
Sébastien Rombauts 2015-03-20 13:05:35 +01:00
parent ef974c2be6
commit 9d4829ab1e
6 changed files with 290 additions and 279 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2012-2015 Sébastien Rombauts (sebastien.rombauts@gmail.com) # Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com)
language: cpp language: cpp
@ -10,15 +10,16 @@ compiler:
before_install: before_install:
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq cppcheck - sudo apt-get install -qq cppcheck
# scripts to run before build # scripts to run before build
# using a symbolic link to get the "make test" to work as if launched from the root directorys # using a symbolic link to get the "make test" to work as if launched from the root directorys
before_script: before_script:
- mkdir build - mkdir build
- cd build - cd build
- cmake -DSQLITECPP_RUN_CPPLINT=ON -DSQLITECPP_RUN_CPPCHECK=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON .. - cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_RUN_DOXYGEN=OFF ..
- ln -s ../examples examples - ln -s ../examples examples
# build and run tests # build examples, and run tests (ie make & make test)
script: make && ctest --output-on-failure script:
- cmake --build .
- ctest --output-on-failure

View File

@ -1,4 +1,5 @@
IF(BIICODE) if (BIICODE)
include(${CMAKE_HOME_DIRECTORY}/biicode.cmake) include(${CMAKE_HOME_DIRECTORY}/biicode.cmake)
# Initializes block variables # Initializes block variables
INIT_BIICODE_BLOCK() INIT_BIICODE_BLOCK()
@ -13,8 +14,9 @@ IF(BIICODE)
ENDIF() ENDIF()
ENDIF() ENDIF()
ELSE() else (BIICODE)
# Main CMake file for compiling the library itself, examples and tests.
# Main CMake file for compiling the library itself, examples and tests.
# #
# Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com) # Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com)
# #
@ -121,6 +123,8 @@ source_group(doc FILES ${SQLITECPP_DOC})
# list of script files of the library # list of script files of the library
set(SQLITECPP_SCRIPT set(SQLITECPP_SCRIPT
.travis.yml .travis.yml
appveyor.yml
biicode.conf
build.bat build.bat
build.sh build.sh
cpplint.py cpplint.py
@ -154,7 +158,7 @@ endif (WIN32)
# Optional additional targets: # Optional additional targets:
option(SQLITECPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." OFF) option(SQLITECPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." ON)
if (SQLITECPP_RUN_CPPLINT) if (SQLITECPP_RUN_CPPLINT)
# add a cpplint target to the "all" target # add a cpplint target to the "all" target
add_custom_target(SQLiteCpp_cpplint add_custom_target(SQLiteCpp_cpplint
@ -165,7 +169,7 @@ else (SQLITECPP_RUN_CPPLINT)
message(STATUS "SQLITECPP_RUN_CPPLINT OFF") message(STATUS "SQLITECPP_RUN_CPPLINT OFF")
endif (SQLITECPP_RUN_CPPLINT) endif (SQLITECPP_RUN_CPPLINT)
option(SQLITECPP_RUN_CPPCHECK "Run cppcheck C++ static analysis tool." OFF) option(SQLITECPP_RUN_CPPCHECK "Run cppcheck C++ static analysis tool." ON)
if (SQLITECPP_RUN_CPPCHECK) if (SQLITECPP_RUN_CPPCHECK)
find_program(CPPCHECK_EXECUTABLE NAMES cppcheck) find_program(CPPCHECK_EXECUTABLE NAMES cppcheck)
if (CPPCHECK_EXECUTABLE) if (CPPCHECK_EXECUTABLE)
@ -181,7 +185,7 @@ else (SQLITECPP_RUN_CPPCHECK)
message(STATUS "SQLITECPP_RUN_CPPCHECK OFF") message(STATUS "SQLITECPP_RUN_CPPCHECK OFF")
endif (SQLITECPP_RUN_CPPCHECK) endif (SQLITECPP_RUN_CPPCHECK)
option(SQLITECPP_RUN_DOXYGEN "Run Doxygen C++ documentation tool." OFF) option(SQLITECPP_RUN_DOXYGEN "Run Doxygen C++ documentation tool." ON)
if (SQLITECPP_RUN_DOXYGEN) if (SQLITECPP_RUN_DOXYGEN)
find_package(Doxygen) find_package(Doxygen)
if (DOXYGEN_FOUND) if (DOXYGEN_FOUND)
@ -234,4 +238,5 @@ if (SQLITECPP_BUILD_TESTS)
else (SQLITECPP_BUILD_TESTS) else (SQLITECPP_BUILD_TESTS)
message(STATUS "SQLITECPP_BUILD_TESTS OFF") message(STATUS "SQLITECPP_BUILD_TESTS OFF")
endif (SQLITECPP_BUILD_TESTS) endif (SQLITECPP_BUILD_TESTS)
ENDIF()
endif (BIICODE)

506
README.md
View File

@ -1,253 +1,253 @@
SQLiteC++ SQLiteC++
--------- ---------
![SQLiteCpp build status](https://api.travis-ci.org/SRombauts/SQLiteCpp.png "SQLiteCpp build status") ![SQLiteCpp build status](https://api.travis-ci.org/SRombauts/SQLiteCpp.png "SQLiteCpp build status")
SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper. SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper.
See SQLiteC++ website http://srombauts.github.com/SQLiteCpp on GitHub. See SQLiteC++ website http://srombauts.github.com/SQLiteCpp on GitHub.
Keywords: sqlite, sqlite3, C, library, wrapper C++ Keywords: sqlite, sqlite3, C, library, wrapper C++
### About SQLite: ### About SQLite:
SQLite is a library that implements a serverless transactional SQL database engine. SQLite is a library that implements a serverless transactional SQL database engine.
It is the most widely deployed SQL database engine in the world. It is the most widely deployed SQL database engine in the world.
The source code for SQLite is in the public domain. The source code for SQLite is in the public domain.
http://www.sqlite.org/about.html http://www.sqlite.org/about.html
### About SQLiteC++: ### About SQLiteC++:
SQLiteC++ offers an encapsulation arround the native C APIs of sqlite, SQLiteC++ offers an encapsulation arround the native C APIs of sqlite,
with a few intuitive and well documented C++ class. with a few intuitive and well documented C++ class.
### The goals of SQLiteC++ are: ### The goals of SQLiteC++ are:
- to offer the best of existing simple C++ SQLite wrappers - to offer the best of existing simple C++ SQLite wrappers
- to be elegantly written with good C++ design, STL, exceptions and RAII idiom - to be elegantly written with good C++ design, STL, exceptions and RAII idiom
- to keep dependencies to a minimum (STL and SQLite3) - to keep dependencies to a minimum (STL and SQLite3)
- to be portable - to be portable
- to be light and fast - to be light and fast
- to be thread-safe only as much as SQLite "Multi-thread" mode (see below) - to be thread-safe only as much as SQLite "Multi-thread" mode (see below)
- to have a good unit test coverage - to have a good unit test coverage
- to use API names sticking with those of the SQLite library - to use API names sticking with those of the SQLite library
- to be well documented with Doxygen tags, and with some good examples - to be well documented with Doxygen tags, and with some good examples
- to be well maintained - to be well maintained
- to use a permissive MIT license, similar to BSD or Boost, for proprietary/commercial usage - to use a permissive MIT license, similar to BSD or Boost, for proprietary/commercial usage
It is designed using the Resource Acquisition Is Initialization (RAII) idom It is designed using the Resource Acquisition Is Initialization (RAII) idom
(see http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization), (see http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization),
and throwing exceptions in case of SQLite errors (exept in destructors, and throwing exceptions in case of SQLite errors (exept in destructors,
where assert() are used instead). where assert() are used instead).
Each SQLiteC++ object must be constructed with a valid SQLite database connection, Each SQLiteC++ object must be constructed with a valid SQLite database connection,
and then is always valid until destroyed. and then is always valid until destroyed.
### Supported platforms: ### Supported platforms:
Developements and tests are done under the following OSs: Developements and tests are done under the following OSs:
- Debian 7 - Debian 7
- Ubuntu 12.10 - Ubuntu 12.10
- Windows XP/7/8 - Windows XP/7/8
And following IDEs/Compilers And following IDEs/Compilers
- GCC 4.7.2 with a provided Makefile - GCC 4.7.2 with a provided Makefile
- Eclipse CDT under Linux, using the provided Makefile - Eclipse CDT under Linux, using the provided Makefile
- Visual Studio Express 2008/2010/2012/2013 for testing compatibility purpose - Visual Studio Express 2008/2010/2012/2013 for testing compatibility purpose
### Dependencies ### Dependencies
- a STL implementation (even an old one, like the one provided with VC6 should work) - a STL implementation (even an old one, like the one provided with VC6 should work)
- exception support (the class Exception inherit from std::runtime_error) - exception support (the class Exception inherit from std::runtime_error)
- the SQLite library, either by linking to it dynamicaly or staticaly (install the libsqlite3-dev package under Debian/Ubuntu/Mint Linux), - the SQLite library, either by linking to it dynamicaly or staticaly (install the libsqlite3-dev package under Debian/Ubuntu/Mint Linux),
or by adding its source file in your project code base (source code provided in src/sqlite3 for Windows), or by adding its source file in your project code base (source code provided in src/sqlite3 for Windows),
with the SQLITE_ENABLE_COLUMN_METADATA macro defined (see http://www.sqlite.org/compile.html#enable_column_metadata). with the SQLITE_ENABLE_COLUMN_METADATA macro defined (see http://www.sqlite.org/compile.html#enable_column_metadata).
### Installation ### Installation
To use this wrappers, you need to add the 10 SQLiteC++ source files from the src/ directory To use this wrappers, you need to add the 10 SQLiteC++ source files from the src/ directory
in your project code base, and compile/link against the sqlite library. in your project code base, and compile/link against the sqlite library.
The easiest way to do this is to add the wrapper as a library. The easiest way to do this is to add the wrapper as a library.
The proper "CMakeLists.txt" file defining the static library is provided in the src/ subdirectory, The proper "CMakeLists.txt" file defining the static library is provided in the src/ subdirectory,
so you simply have to add_directory(SQLiteCpp/src) to you main CMakeLists.txt so you simply have to add_directory(SQLiteCpp/src) to you main CMakeLists.txt
and link to the "SQLiteCpp" wrapper library. and link to the "SQLiteCpp" wrapper library.
Thus this SQLiteCpp repository can directly be used as a Git submoldule. Thus this SQLiteCpp repository can directly be used as a Git submoldule.
Under Debian/Ubuntu/Mint Linux, install the libsqlite3-dev package. Under Debian/Ubuntu/Mint Linux, install the libsqlite3-dev package.
### Building the examples: ### Building the examples:
#### CMake and test #### CMake and test
A CMake configuration file is also provided for multiplatform support and testing. A CMake configuration file is also provided for multiplatform support and testing.
Typical generic build (see also "build.bat" or "./build.sh"): Typical generic build (see also "build.bat" or "./build.sh"):
```bash ```bash
mkdir build mkdir build
cd build cd build
cmake .. # cmake .. -G "Visual Studio 10" # for Visual Studio 2010 cmake .. # cmake .. -G "Visual Studio 10" # for Visual Studio 2010
cmake --build . # make cmake --build . # make
ctest . # make test ctest . # make test
``` ```
Generating the Linux Makefile, building in Debug and executing the tests: Generating the Linux Makefile, building in Debug and executing the tests:
```bash ```bash
mkdir Debug mkdir Debug
cd Debug cd Debug
cmake .. -DCMAKE_BUILD_TYPE=Debug cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . # make cmake --build . # make
ln -s ../examples examples ln -s ../examples examples
ctest . # make test ctest . # make test
``` ```
#### Troubleshooting #### Troubleshooting
Under Linux, if you get muliple linker errors like "undefined reference to sqlite3_xxx", Under Linux, if you get muliple linker errors like "undefined reference to sqlite3_xxx",
it's that you lack the "sqlite3" library: install the libsqlite3-dev package. it's that you lack the "sqlite3" library: install the libsqlite3-dev package.
If you get a single linker error "Column.cpp: undefined reference to sqlite3_column_origin_name", If you get a single linker error "Column.cpp: undefined reference to sqlite3_column_origin_name",
it's that your "sqlite3" library was not compiled with it's that your "sqlite3" library was not compiled with
the SQLITE_ENABLE_COLUMN_METADATA macro defined (see http://www.sqlite.org/compile.html#enable_column_metadata). the SQLITE_ENABLE_COLUMN_METADATA macro defined (see http://www.sqlite.org/compile.html#enable_column_metadata).
You can either recompile it yourself (seek help online) or you can comment out the following line in src/Column.h: You can either recompile it yourself (seek help online) or you can comment out the following line in src/Column.h:
```C++ ```C++
#define SQLITE_ENABLE_COLUMN_METADATA #define SQLITE_ENABLE_COLUMN_METADATA
``` ```
### Continuous Integration ### Continuous Integration
This project is continuously tested under Ubuntu Linux with the gcc and clang compilers This project is continuously tested under Ubuntu Linux with the gcc and clang compilers
using the Travis CI community service with the above CMake building and testing procedure. using the Travis CI community service with the above CMake building and testing procedure.
Detailed results can be seen online: https://travis-ci.org/SRombauts/SQLiteCpp Detailed results can be seen online: https://travis-ci.org/SRombauts/SQLiteCpp
### Thread-safety ### Thread-safety
SQLite supports three mode of thread safety, as describe in "SQLite And Multiple Threads" : SQLite supports three mode of thread safety, as describe in "SQLite And Multiple Threads" :
see http://www.sqlite.org/threadsafe.html see http://www.sqlite.org/threadsafe.html
This SQLiteC++ wrapper does no add any lock (no mutexes) nor any other thread-safety mecanism This SQLiteC++ wrapper does no add any lock (no mutexes) nor any other thread-safety mecanism
above the SQLite library itself, by design, for lightness and speed. above the SQLite library itself, by design, for lightness and speed.
Thus, SQLiteC++ naturally supports the "Multi Thread" mode of SQLite ; Thus, SQLiteC++ naturally supports the "Multi Thread" mode of SQLite ;
"In this mode, SQLite can be safely used by multiple threads "In this mode, SQLite can be safely used by multiple threads
provided that no single database connection is used simultaneously in two or more threads." provided that no single database connection is used simultaneously in two or more threads."
But SQLiteC++ does not support the fully thread-safe "Serialized" mode of SQLite, But SQLiteC++ does not support the fully thread-safe "Serialized" mode of SQLite,
because of the way it shares the underling SQLite precompiled statement because of the way it shares the underling SQLite precompiled statement
in a custom shared pointer (See the inner class "Statement::Ptr"). in a custom shared pointer (See the inner class "Statement::Ptr").
### License ### License
Copyright (c) 2012-2015 Sébastien Rombauts (sebastien.rombauts@gmail.com) Copyright (c) 2012-2015 Sébastien Rombauts (sebastien.rombauts@gmail.com)
Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
or copy at http://opensource.org/licenses/MIT) or copy at http://opensource.org/licenses/MIT)
## Getting started ## Getting started
### First sample demonstrates how to query a database and get results: ### First sample demonstrates how to query a database and get results:
```C++ ```C++
try try
{ {
// Open a database file // Open a database file
SQLite::Database db("example.db3"); SQLite::Database db("example.db3");
// Compile a SQL query, containing one parameter (index 1) // Compile a SQL query, containing one parameter (index 1)
SQLite::Statement query(db, "SELECT * FROM test WHERE size > ?"); SQLite::Statement query(db, "SELECT * FROM test WHERE size > ?");
// Bind the integer value 6 to the first parameter of the SQL query // Bind the integer value 6 to the first parameter of the SQL query
query.bind(1, 6); query.bind(1, 6);
// Loop to execute the query step by step, to get rows of result // Loop to execute the query step by step, to get rows of result
while (query.executeStep()) while (query.executeStep())
{ {
// Demonstrate how to get some typed column value // Demonstrate how to get some typed column value
int id = query.getColumn(0); int id = query.getColumn(0);
const char* value = query.getColumn(1); const char* value = query.getColumn(1);
int size = query.getColumn(2); int size = query.getColumn(2);
std::cout << "row: " << id << ", " << value << ", " << size << std::endl; std::cout << "row: " << id << ", " << value << ", " << size << std::endl;
} }
} }
catch (std::exception& e) catch (std::exception& e)
{ {
std::cout << "exception: " << e.what() << std::endl; std::cout << "exception: " << e.what() << std::endl;
} }
``` ```
### Second sample shows how to manage a transaction: ### Second sample shows how to manage a transaction:
```C++ ```C++
try try
{ {
SQLite::Database db("transaction.db3", SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE); SQLite::Database db("transaction.db3", SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
db.exec("DROP TABLE IF EXISTS test"); db.exec("DROP TABLE IF EXISTS test");
// Begin transaction // Begin transaction
SQLite::Transaction transaction(db); SQLite::Transaction transaction(db);
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)"); db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
int nb = db.exec("INSERT INTO test VALUES (NULL, \"test\")"); int nb = db.exec("INSERT INTO test VALUES (NULL, \"test\")");
std::cout << "INSERT INTO test VALUES (NULL, \"test\")\", returned " << nb << std::endl; std::cout << "INSERT INTO test VALUES (NULL, \"test\")\", returned " << nb << std::endl;
// Commit transaction // Commit transaction
transaction.commit(); transaction.commit();
} }
catch (std::exception& e) catch (std::exception& e)
{ {
std::cout << "exception: " << e.what() << std::endl; std::cout << "exception: " << e.what() << std::endl;
} }
``` ```
### How to handle in assertion in SQLiteC++: ### How to handle in assertion in SQLiteC++:
Exceptions shall not be used in destructors, so SQLiteC++ use SQLITECPP_ASSERT() to check for errors in destructors. Exceptions shall not be used in destructors, so SQLiteC++ use SQLITECPP_ASSERT() to check for errors in destructors.
If you don't want assert() to be called, you have to enable and define an assert handler as shown below, If you don't want assert() to be called, you have to enable and define an assert handler as shown below,
and by setting the flag SQLITECPP_ENABLE_ASSERT_HANDLER when compiling the lib. and by setting the flag SQLITECPP_ENABLE_ASSERT_HANDLER when compiling the lib.
```C++ ```C++
#ifdef SQLITECPP_ENABLE_ASSERT_HANDLER #ifdef SQLITECPP_ENABLE_ASSERT_HANDLER
namespace SQLite namespace SQLite
{ {
/// definition of the assertion handler enabled when SQLITECPP_ENABLE_ASSERT_HANDLER is defined in the project (CMakeList.txt) /// definition of the assertion handler enabled when SQLITECPP_ENABLE_ASSERT_HANDLER is defined in the project (CMakeList.txt)
void assertion_failed(const char* apFile, const long apLine, const char* apFunc, const char* apExpr, const char* apMsg) void assertion_failed(const char* apFile, const long apLine, const char* apFunc, const char* apExpr, const char* apMsg)
{ {
// Print a message to the standard error output stream, and abort the program. // Print a message to the standard error output stream, and abort the program.
std::cerr << apFile << ":" << apLine << ":" << " error: assertion failed (" << apExpr << ") in " << apFunc << "() with message \"" << apMsg << "\"\n"; std::cerr << apFile << ":" << apLine << ":" << " error: assertion failed (" << apExpr << ") in " << apFunc << "() with message \"" << apMsg << "\"\n";
std::abort(); std::abort();
} }
} }
#endif #endif
``` ```
## How to contribute ## How to contribute
### GitHub website ### GitHub website
The most efficient way to help and contribute to this wrapper project is to The most efficient way to help and contribute to this wrapper project is to
use the tools provided by GitHub: use the tools provided by GitHub:
- please fill bug reports and feature requests here: https://github.com/SRombauts/SQLiteCpp/issues - please fill bug reports and feature requests here: https://github.com/SRombauts/SQLiteCpp/issues
- fork the repository, make some small changes and submit them with pull-request - fork the repository, make some small changes and submit them with pull-request
### Contact ### Contact
You can also email me directly, I will answer any questions and requests. You can also email me directly, I will answer any questions and requests.
### Coding Style Guidelines ### Coding Style Guidelines
The source code use the CamelCase naming style variant where : The source code use the CamelCase naming style variant where :
- type names (class, struct, typedef, enums...) begins with a capital letter - type names (class, struct, typedef, enums...) begins with a capital letter
- files (.cpp/.h) are named like the class they contains - files (.cpp/.h) are named like the class they contains
- function and variable names begins with a lower case letter - function and variable names begins with a lower case letter
- member variables begins with a 'm', function arguments begins with a 'a', boolean with a 'b', pointers with a 'p' - member variables begins with a 'm', function arguments begins with a 'a', boolean with a 'b', pointers with a 'p'
- each file, class, method and member variable is documented using Doxygen tags - each file, class, method and member variable is documented using Doxygen tags
See also http://www.appinf.com/download/CppCodingStyleGuide.pdf for good guidelines See also http://www.appinf.com/download/CppCodingStyleGuide.pdf for good guidelines
## See also - Some other simple C++ SQLite wrappers: ## See also - Some other simple C++ SQLite wrappers:
See also the file WRAPPERS.md offering a more complete comparison of other wrappers. See also the file WRAPPERS.md offering a more complete comparison of other wrappers.
- [sqdbcpp](http://code.google.com/p/sqdbcpp/): RAII design, simple, no dependencies, UTF-8/UTF-16, new BSD license - [sqdbcpp](http://code.google.com/p/sqdbcpp/): RAII design, simple, no dependencies, UTF-8/UTF-16, new BSD license
- [sqlite3cc](http://ed.am/dev/sqlite3cc): uses boost, modern design, LPGPL - [sqlite3cc](http://ed.am/dev/sqlite3cc): uses boost, modern design, LPGPL
- [sqlite3pp](http://code.google.com/p/sqlite3pp/): uses boost, but never updated since initial publication in may 2012, MIT License - [sqlite3pp](http://code.google.com/p/sqlite3pp/): uses boost, but never updated since initial publication in may 2012, MIT License
- [SQLite++](http://sqlitepp.berlios.de/): uses boost build system, Boost License 1.0 - [SQLite++](http://sqlitepp.berlios.de/): uses boost build system, Boost License 1.0
- [CppSQLite](http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite/): famous Code Project but old design, BSD License - [CppSQLite](http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite/): famous Code Project but old design, BSD License
- [easySQLite](http://code.google.com/p/easysqlite/): manages table as structured objects, complex - [easySQLite](http://code.google.com/p/easysqlite/): manages table as structured objects, complex
- [sqlite_modern_cpp](https://github.com/keramer/sqlite_modern_cpp): modern C++11, all in one file, MIT license - [sqlite_modern_cpp](https://github.com/keramer/sqlite_modern_cpp): modern C++11, all in one file, MIT license

View File

@ -1,13 +1,14 @@
# Copyright (c) 2012-2015 Sébastien Rombauts (sebastien.rombauts@gmail.com) # Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com)
# build format # build format
version: "{build}" version: "{build}"
# scripts that run after cloning repository # scripts that run after cloning repository
# NOTE : not updating submodule as cloning googletest does not work on AppVeyor
install: install:
- git submodule update --init --recursive
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq cppcheck - sudo apt-get install -qq cppcheck
# - git submodule update --init --recursive
# configurations to add to build matrix # configurations to add to build matrix
configuration: configuration:
@ -16,13 +17,14 @@ configuration:
# scripts to run before build # scripts to run before build
# using a symbolic link to get the "make test" to work as if launched from the root directorys # using a symbolic link to get the "make test" to work as if launched from the root directorys
# NOTE : no unit tests as cloning googletest does not work on AppVeyor
before_build: before_build:
- mkdir build - mkdir build
- cd build - cd build
- cmake -DSQLITECPP_RUN_CPPLINT=ON -DSQLITECPP_RUN_CPPCHECK=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON .. - cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=OFF -DSQLITECPP_RUN_DOXYGEN=OFF ..
- ln -s ../examples examples - ln -s ../examples examples
# build examples, and run tests (ie make & make test) # build examples, and run tests (ie make & make test)
build_script: build_script:
- cmake --build . - cmake --build .
- ctest --output-on-failure # - ctest --output-on-failure

View File

@ -1,12 +1,14 @@
@REM Copyright (c) 2012-2015 Sébastien Rombauts (sebastien.rombauts@gmail.com) @REM Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com)
@REM @REM
@REM Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt @REM Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
@REM or copy at http://opensource.org/licenses/MIT) @REM or copy at http://opensource.org/licenses/MIT)
mkdir build mkdir build
cd build cd build
@REM generate solution for Visual Studio, and build it
cmake -DSQLITECPP_RUN_CPPLINT=ON -DSQLITECPP_RUN_CPPCHECK=ON -DSQLITECPP_RUN_DOXYGEN=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON .. @REM Generate a Visual Studio solution for latest version found
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
@REM Build default configuration (ie 'Debug')
cmake --build . cmake --build .
@REM prepare and launch tests @REM prepare and launch tests

View File

@ -2,14 +2,15 @@
# #
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
# or copy at http://opensource.org/licenses/MIT) # or copy at http://opensource.org/licenses/MIT)
mkdir -p build mkdir -p build
cd build cd build
# generate solution for GCC
cmake -DSQLITECPP_RUN_CPPLINT=ON -DSQLITECPP_RUN_CPPCHECK=ON -DSQLITECPP_RUN_DOXYGEN=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON .. # Generate a Makefile for GCC (or Clang, depanding on CC/CXX envvar)
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
# Build (ie 'make')
cmake --build . cmake --build .
# prepare and launch tests # Prepare and run unit-tests (ie 'make test')
mkdir -p examples/example1 mkdir -p examples/example1
cp ../examples/example1/example.db3 examples/example1 cp ../examples/example1/example.db3 examples/example1
cp ../examples/example1/logo.png examples/example1 cp ../examples/example1/logo.png examples/example1