diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 636006ea..7681cc87 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,6 +23,8 @@ jobs: if: "!contains(github.event.commits[0].message, '[debug]')" env: PDO_INTERPRETER: ${{ matrix.interpreter }} + PDO_DEBUG_BUILD: 1 + PDO_LOG_LEVEL: warning run: | # The creation of a dummy branch is necessary for the CI tests # to work on PRs. Based on empirical results, in the absence of diff --git a/build/__tools__/build.sh b/build/__tools__/build.sh index 6c324c98..5b805d14 100755 --- a/build/__tools__/build.sh +++ b/build/__tools__/build.sh @@ -58,8 +58,10 @@ fi # Build type "Debug" does not define NDEBUG, which causes sgx_urts.h to set SGX_DEBUG_FLAG to 1. if [ ${PDO_DEBUG_BUILD} == "0" ]; then MAKE_ARGS+=" CMAKE_OPTS=-DCMAKE_BUILD_TYPE=Release" + CMAKE_ARGS+=" -DCMAKE_BUILD_TYPE=Release" else MAKE_ARGS+=" CMAKE_OPTS=-DCMAKE_BUILD_TYPE=Debug" + CMAKE_ARGS+=" -DCMAKE_BUILD_TYPE=Debug" fi # ----------------------------------------------------------------- diff --git a/build/cmake/SGX.cmake b/build/cmake/SGX.cmake index f88a3eed..357bebc9 100644 --- a/build/cmake/SGX.cmake +++ b/build/cmake/SGX.cmake @@ -28,8 +28,18 @@ SET(SGX_MODE $ENV{SGX_MODE}) IF (${SGX_MODE} STREQUAL "SIM") SET(SGX_USE_SIMULATOR TRUE) + + IF (${PDO_DEBUG_BUILD} STREQUAL "0") + MESSAGE(FATAL_ERROR "SGX_MODE=SIM does not accept PDO_DEBUG_BUILD=0") + ENDIF() ELSE() SET(SGX_USE_SIMULATOR FALSE) + + IF (${CMAKE_BUILD_TYPE} STREQUAL "Release") + IF (${PDO_DEBUG_BUILD} STREQUAL "1") + MESSAGE(FATAL_ERROR "SGX_MODE=HW and CMAKE_BUILD_TYPE=Release do not accept PDO_DEBUG_BUILD=1") + ENDIF() + ENDIF() ENDIF() IF (NOT DEFINED ENV{SGX_SDK}) diff --git a/docker/Makefile b/docker/Makefile index 1063bd39..d18fab94 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -26,7 +26,7 @@ PDO_SOURCE_ROOT ?= $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../ # PDO_DEBUG_BUILD # The flag that determines the build type (debug or not). -PDO_DEBUG_BUILD ?= 0 +PDO_DEBUG_BUILD ?= ${PDO_DEBUG_BUILD:-0} # PDO_REPO -- # The URL or path to the git repository, the default uses the current repository @@ -73,12 +73,14 @@ rebuild_% : repository $(DOCKER_COMMAND) build $(DOCKER_ARGS) \ --build-arg REBUILD=$(TIMESTAMP) \ --build-arg PDO_VERSION=$(PDO_VERSION) \ + --build-arg PDO_DEBUG_BUILD=$(PDO_DEBUG_BUILD) \ --tag pdo_$*:$(PDO_VERSION) \ --file '$(DOCKER_DIR)'/pdo_$*.dockerfile . build_% : repository $(DOCKER_COMMAND) build $(DOCKER_ARGS) \ --build-arg PDO_VERSION=$(PDO_VERSION) \ + --build-arg PDO_DEBUG_BUILD=$(PDO_DEBUG_BUILD) \ --tag pdo_$*:$(PDO_VERSION) \ --file '$(DOCKER_DIR)'/pdo_$*.dockerfile .