Skip to content

Commit e31b9f5

Browse files
authored
Merge pull request #6421 from ppenzin/cmake-build-type
Fix use of CMake build types
2 parents 0f78a54 + 9d644c5 commit e31b9f5

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

CMakeLists.txt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cmake_minimum_required(VERSION 3.2)
22
project (CHAKRACORE)
33

4+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g")
5+
46
# Keep CMake from caching static/shared library
57
# option. Otherwise, CMake fails to update cached
68
# references
@@ -402,19 +404,12 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
402404
-D_DEBUG=1 # for PAL
403405
-DDBG_DUMP=1
404406
)
405-
elseif(CMAKE_BUILD_TYPE STREQUAL Test)
407+
elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
406408
add_definitions(
407409
-DENABLE_DEBUG_CONFIG_OPTIONS=1
408410
)
409-
add_compile_options(-g)
410411
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
411412

412-
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
413-
add_compile_options(-O3)
414-
else()
415-
add_compile_options(-O0)
416-
endif(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
417-
418413
if(IS_64BIT_BUILD)
419414
add_definitions(
420415
-DBIT64=1

build.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ while [[ $# -gt 0 ]]; do
203203
;;
204204

205205
-t | --test-build)
206-
BUILD_TYPE="Test"
206+
BUILD_TYPE="RelWithDebInfo"
207207
;;
208208

209209
-j | --jobs)
@@ -579,7 +579,13 @@ if [[ $HAS_LTTNG == 1 ]]; then
579579
fi
580580

581581

582-
BUILD_DIRECTORY="${TARGET_PATH}/${BUILD_TYPE:0}"
582+
if [[ ${BUILD_TYPE} =~ "RelWithDebInfo" ]]; then
583+
BUILD_TYPE_DIR=Test
584+
else
585+
BUILD_TYPE_DIR=${BUILD_TYPE}
586+
fi
587+
588+
BUILD_DIRECTORY="${TARGET_PATH}/${BUILD_TYPE_DIR:0}"
583589
echo "Build path: ${BUILD_DIRECTORY}"
584590

585591
BUILD_RELATIVE_DIRECTORY=$("$PYTHON2_BINARY" -c "import os.path;print \

0 commit comments

Comments
 (0)