GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — re: Build debug libraries when CMAKE_BUILD_TYPE is set to Debug by jcfr · Pull Request #241 · python-cmake-buildsystem/python-cmake-buildsystem

Conversation

@jcfr

@jcfr jcfr commented Dec 13, 2018

Copy link
Copy Markdown
Contributor

Supersede PR #151

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
dbrnz added 4 commits December 13, 2018 01:30
@dbrnz @jcfr
Add _d postfix to MS Windows library names for CMake debug builds.
127ec49
@dbrnz @jcfr
Debug builds can't have Py_LIMITED_API set.
ad9fe66
@dbrnz @jcfr
Only add _d postfix to Windows debug builds when using Microsoft's …
defd5f4
…compilers.
@dbrnz @jcfr
Remove redundant test on CMAKE_BUILD_TYPE.
8cc39fe
jcfr
jcfr commented Dec 13, 2018
View reviewed changes
Comment thread CMakeLists.txt
cmake_minimum_required(VERSION 3.3) # Version introducing CROSSCOMPILING_EMULATOR
endif()

if(MSVC)

@jcfr jcfr Dec 13, 2018

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be WIN32, that way building in Debug on windows using Ninja will work as expected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread cmake/extensions/CMakeLists.txt
add_python_extension(_tracemalloc BUILTIN REQUIRES IS_PY3 SOURCES hashtable.c _tracemalloc.c)
add_python_extension(_weakref BUILTIN REQUIRES IS_PY3 SOURCES _weakref.c)
math(EXPR _limited_api_version "${PY_VERSION_MAJOR} * 100 + ${PY_VERSION_MINOR}")
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")

@jcfr jcfr Dec 13, 2018

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be something like :

set(_limited_definition)
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
    math(EXPR _limited_api_version "${PY_VERSION_MAJOR} * 100 + ${PY_VERSION_MINOR}")
    set(_limited_definition "Py_LIMITED_API=0x${_limited_api_version}0000")
endif()

That said, the approach should still be tweaked to handle the case of Visual Studio where CMAKE_CONFIGURATION_TYPES is defined

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jcfr jcfr Dec 13, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbrnz I had an other look at this, and if Py_LIMITED_API must not be defined when doing Debug build, relying on a newer version of CMake supporting generator expression would be the way to go.

That way, we will be able to do something like this:

math(EXPR _limited_api_version "${PY_VERSION_MAJOR} * 100 + ${PY_VERSION_MINOR}")
target_compile_definition(xxlimited PRIVATE $<$<NOT:$<CONFIG:Debug>>:${_limited_definition}>)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@jcfr @dbrnz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.