Skip to content

Commit bd78ffc

Browse files
authored
Set -DBUILD_SHARED_LIBS=ON by default on scripts and CI/CD (SRombauts#442)
set CMAKE_RUNTIME_OUTPUT_DIRECTORY so that executables and dlls share the bin/ directory
2 parents 6bc108b + 3bdd13a commit bd78ffc

File tree

4 files changed

+32
-30
lines changed

4 files changed

+32
-30
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
set(ENV{CC} ${{ matrix.config.cc }})
5757
set(ENV{CXX} ${{ matrix.config.cxx }})
5858
- run: mkdir build
59-
- run: cmake -G "${{ matrix.config.generator }}" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_RUN_CPPCHECK=OFF -DSQLITECPP_RUN_CPPLINT=OFF ..
59+
- run: cmake -G "${{ matrix.config.generator }}" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DBUILD_SHARED_LIBS=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_RUN_CPPCHECK=OFF -DSQLITECPP_RUN_CPPLINT=OFF ..
6060
working-directory: build
6161
- run: cmake --build build --config ${{ matrix.config.build_type }}
6262
- run: ctest --verbose --output-on-failure --test-dir build

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ option(SQLITECPP_BUILD_TESTS "Build and run tests." OFF)
2525
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make it prominent
2626
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
2727

28+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
29+
2830
# Define useful variables to handle OS differences:
2931
if (WIN32)
3032
set(DEV_NULL "NUL")
@@ -485,11 +487,11 @@ if (SQLITECPP_BUILD_TESTS)
485487
enable_testing()
486488

487489
# does the tests pass?
488-
add_test(UnitTests SQLiteCpp_tests)
490+
add_test(UnitTests bin/SQLiteCpp_tests)
489491

490492
if (SQLITECPP_BUILD_EXAMPLES)
491493
# does the example1 runs successfully?
492-
add_test(Example1Run SQLiteCpp_example1)
494+
add_test(Example1Run bin/SQLiteCpp_example1)
493495
endif (SQLITECPP_BUILD_EXAMPLES)
494496
else (SQLITECPP_BUILD_TESTS)
495497
message(STATUS "SQLITECPP_BUILD_TESTS OFF")

build.bat

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
@REM Copyright (c) 2012-2023 Sebastien Rombauts ([email protected])
2-
@REM
3-
@REM Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
4-
@REM or copy at http://opensource.org/licenses/MIT)
5-
mkdir build
6-
cd build
7-
8-
@REM Generate a Visual Studio solution for latest version found
9-
REM -DPYTHON_EXECUTABLE=D:\workspace\Corvus\UnrealEngine\Engine\Binaries\ThirdParty\Python\Win64\python.exe
10-
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_RUN_CPPLINT=OFF ..
11-
@if ERRORLEVEL 1 goto onError
12-
13-
@REM Build default configuration (ie 'Debug')
14-
cmake --build .
15-
@if ERRORLEVEL 1 goto onError
16-
17-
@REM Build and run tests
18-
ctest --output-on-failure
19-
@if ERRORLEVEL 1 goto onError
20-
21-
@goto onSuccess
22-
23-
:onError
24-
@echo An error occured!
25-
:onSuccess
26-
@cd ..
1+
@REM Copyright (c) 2012-2023 Sebastien Rombauts ([email protected])
2+
@REM
3+
@REM Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
4+
@REM or copy at http://opensource.org/licenses/MIT)
5+
mkdir build
6+
cd build
7+
8+
@REM Generate a Visual Studio solution for latest version found
9+
REM -DPYTHON_EXECUTABLE=D:\workspace\Corvus\UnrealEngine\Engine\Binaries\ThirdParty\Python\Win64\python.exe
10+
cmake -DBUILD_SHARED_LIBS=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_RUN_CPPLINT=OFF ..
11+
@if ERRORLEVEL 1 goto onError
12+
13+
@REM Build default configuration (ie 'Debug')
14+
cmake --build .
15+
@if ERRORLEVEL 1 goto onError
16+
17+
@REM Build and run tests
18+
ctest --output-on-failure
19+
@if ERRORLEVEL 1 goto onError
20+
21+
@goto onSuccess
22+
23+
:onError
24+
@echo An error occured!
25+
:onSuccess
26+
@cd ..

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mkdir -p build
1111
cd build
1212

1313
# Generate a Makefile for GCC (or Clang, depending on CC/CXX envvar)
14-
cmake -DCMAKE_BUILD_TYPE=Debug -DSQLITECPP_USE_ASAN=ON -DSQLITECPP_USE_GCOV=OFF -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
14+
cmake -DCMAKE_BUILD_TYPE=Debug -DSQLITECPP_USE_ASAN=ON -DSQLITECPP_USE_GCOV=OFF -DBUILD_SHARED_LIBS=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_BUILD_EXAMPLES=ON ..
1515

1616
# Build (ie 'make')
1717
cmake --build .

0 commit comments

Comments
 (0)