Skip to content

Commit 0afc08d

Browse files
committed
CDRIVER-2772 default build type to RelWithDebInfo
1 parent 8b18fc4 commit 0afc08d

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

.evergreen/compile-unix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ if [ ! -z "$SNAPPY" ]; then
8787
fi
8888

8989
DEBUG_FLAGS="${DEBUG_AND_RELEASE_FLAGS} -DCMAKE_BUILD_TYPE=Debug"
90-
RELEASE_FLAGS="${DEBUG_AND_RELEASE_FLAGS} -DCMAKE_BUILD_TYPE=Release"
90+
RELEASE_FLAGS="${DEBUG_AND_RELEASE_FLAGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo"
9191

9292
DIR=$(dirname $0)
9393
. $DIR/find-cmake.sh

.evergreen/compile-windows.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,14 @@ case "$CC" in
112112
esac
113113

114114
if [ "$RELEASE" ]; then
115-
CONFIGURE_FLAGS="$CONFIGURE_FLAGS -DCMAKE_BUILD_TYPE=Release"
116-
BUILD_FLAGS="$BUILD_FLAGS /p:Configuration=Release"
117-
TEST_PATH="./src/libmongoc/Release/test-libmongoc.exe"
118-
export PATH=$PATH:`pwd`/tests:`pwd`/Release:`pwd`/src/libbson/Release:`pwd`/src/libmongoc/Release
115+
BUILD_FLAGS="$BUILD_FLAGS /p:Configuration=RelWithDebInfo"
116+
TEST_PATH="./src/libmongoc/RelWithDebInfo/test-libmongoc.exe"
117+
export PATH=$PATH:`pwd`/src/libbson/RelWithDebInfo:`pwd`/src/libmongoc/RelWithDebInfo
119118
else
120-
CONFIGURE_FLAGS="$CONFIGURE_FLAGS -DCMAKE_BUILD_TYPE=Debug"
119+
CONFIGURE_FLAGS="$CONFIGURE_FLAGS"
121120
BUILD_FLAGS="$BUILD_FLAGS /p:Configuration=Debug"
122121
TEST_PATH="./src/libmongoc/Debug/test-libmongoc.exe"
123-
export PATH=$PATH:`pwd`/tests:`pwd`/Debug:`pwd`/src/libbson/Debug:`pwd`/src/libmongoc/Debug
122+
export PATH=$PATH:`pwd`/src/libbson/Debug:`pwd`/src/libmongoc/Debug
124123
fi
125124

126125
"$CMAKE" -G "$CC" "-DCMAKE_PREFIX_PATH=${INSTALL_DIR}/lib/cmake" $CONFIGURE_FLAGS

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ set (ENABLE_ICU AUTO CACHE STRING "Enable ICU support, necessary to use non-ASCI
5353

5454
project (mongo-c-driver C)
5555

56+
if (NOT CMAKE_BUILD_TYPE)
57+
set (CMAKE_BUILD_TYPE "RelWithDebInfo")
58+
message (
59+
STATUS "No CMAKE_BUILD_TYPE selected, defaulting to ${CMAKE_BUILD_TYPE}"
60+
)
61+
endif ()
62+
5663
set (CMAKE_MODULE_PATH
5764
${CMAKE_MODULE_PATH}
5865
${PROJECT_SOURCE_DIR}/build/cmake

src/libmongoc/doc/installing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Building on Windows with Visual Studio
235235

236236
Building on Windows requires Windows Vista or newer and Visual Studio 2010 or newer. Additionally, ``cmake`` is required to generate Visual Studio project files.
237237

238-
Let's start by generating Visual Studio project files. The following assumes we are compiling for 64-bit Windows using Visual Studio 2015 Express, which can be freely downloaded from Microsoft. We will be utilizing ``cmake``'s out-of-source build feature to keep build artifacts separate from source files. The default build type is ``Debug``, so a release build is specified as you see below.
238+
Let's start by generating Visual Studio project files. The following assumes we are compiling for 64-bit Windows using Visual Studio 2015 Express, which can be freely downloaded from Microsoft. We will be utilizing ``cmake``'s out-of-source build feature to keep build artifacts separate from source files.
239239

240240
.. parsed-literal::
241241
@@ -249,13 +249,13 @@ Let's start by generating Visual Studio project files. The following assumes we
249249
250250
(Run ``cmake -LH ..`` for a list of other options.)
251251

252-
Now that we have project files generated, we can either open the project in Visual Studio or compile from the command line. Let's build using the command line program ``msbuild.exe``
252+
Now that we have project files generated, we can either open the project in Visual Studio or compile from the command line. Let's build using the command line program ``msbuild.exe``:
253253

254254
.. code-block:: none
255255
256-
msbuild.exe ALL_BUILD.vcxproj
256+
msbuild.exe /p:Configuration=RelWithDebInfo ALL_BUILD.vcxproj
257257
258-
Now that libmongoc and libbson are compiled, let's install them using msbuild. It will be installed to the path specified by ``CMAKE_INSTALL_PREFIX``.
258+
Visual Studio's default build type is ``Debug``, but we recommend a release build with debug info for production use. Now that libmongoc and libbson are compiled, let's install them using msbuild. It will be installed to the path specified by ``CMAKE_INSTALL_PREFIX``.
259259

260260
.. code-block:: none
261261

0 commit comments

Comments
 (0)