Skip to content

Commit

Permalink
Add option to build unoptimized in Python client build script and bui…
Browse files Browse the repository at this point in the history
…ld-wheels workflow
  • Loading branch information
juliannguyen4 committed Feb 20, 2024
1 parent 88f92d2 commit 95ef334
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ on:
type: boolean
default: false
description: 'Test macOS x86 wheels (unstable)'
build-for-debugging:
required: true
type: boolean
default: false
description: 'Apply -O0 when building C client and Python client? (Linux)'
workflow_call:
inputs:
# The "dev" tests test the artifacts against a server release
Expand All @@ -41,7 +46,7 @@ on:
ref:
type: string
required: false
# Calling workflow doesn't actually use the 2 options below
# Calling workflow doesn't actually use the options below
# But we need to set default values for workflow calls to use
use-server-rc:
required: false
Expand All @@ -55,6 +60,10 @@ on:
required: false
type: boolean
default: false
build-for-debugging:
required: false
type: boolean
default: false
secrets:
DOCKER_HUB_BOT_USERNAME:
required: false
Expand Down Expand Up @@ -151,9 +160,13 @@ jobs:
if: ${{ !inputs.run_tests }}
run: echo "TEST_COMMAND=python -c 'import aerospike'" >> $GITHUB_ENV

- name: Set environment variables for building
run: echo "UNOPTIMIZED=${{ inputs.build-for-debugging }}" >> $GITHUB_ENV

- name: Build wheel
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ENVIRONMENT_PASS_LINUX: ${{ env.UNOPTIMIZED }}
CIBW_BUILD: ${{ matrix.python }}-manylinux_${{ matrix.platform }}
CIBW_BUILD_FRONTEND: build
CIBW_BEFORE_ALL_LINUX: >
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
# Not for developers to use, unless you know what the workflow is doing!
COVERAGE = os.getenv('COVERAGE')

# Applies no optimizations on both the C client and Python client
UNOPTIMIZED = os.getenv('UNOPTIMIZED')

################################################################################
# GENERIC BUILD SETTINGS
################################################################################
Expand Down Expand Up @@ -107,13 +110,8 @@
extra_compile_args.append('-ftest-coverage')
extra_link_args.append('-lgcov')

# TODO: this conflicts with the C client's DEBUG mode when building it
# DEBUG = os.getenv('DEBUG')
# if DEBUG:
# extra_compile_args.append("-O0")
# else:
# # Release build
# extra_compile_args.append("-O1")
if UNOPTIMIZED:
extra_compile_args.append('-O0')

################################################################################
# STATIC SSL LINKING BUILD SETTINGS
Expand Down Expand Up @@ -228,6 +226,8 @@ def clean():
'make',
'V=' + str(self.verbose),
]
if UNOPTIMIZED:
cmd.append('-O0')

def compile():
print(cmd, library_dirs, libraries)
Expand Down

0 comments on commit 95ef334

Please sign in to comment.