-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Windows cmake debug build #976
Merged
acolwell
merged 2 commits into
NatronGitHub:RB-2.5
from
acolwell:fix_windows_cmake_debug_build
Jul 8, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,15 @@ set(CMAKE_CXX_STANDARD 14) | |
option(NATRON_SYSTEM_LIBS "use system versions of dependencies instead of bundled ones" OFF) | ||
option(NATRON_BUILD_TESTS "build the Natron test suite" ON) | ||
|
||
set(IS_DEBUG_BUILD OFF) | ||
if(CMAKE_BUILD_TYPE MATCHES "^(debug|Debug|DEBUG)$") | ||
set(IS_DEBUG_BUILD ON) | ||
add_definitions(-DDEBUG) | ||
|
||
if(WIN32) | ||
# Debug builds need minimal optimizations to avoid excessive link times and link errors related to Eigen. | ||
add_compile_options(-O) | ||
endif() | ||
else() | ||
add_definitions(-DQT_NO_DEBUG_OUTPUT) | ||
endif() | ||
|
@@ -49,7 +56,21 @@ if(WIN32) | |
endif() | ||
find_package(Python3 COMPONENTS Interpreter Development) | ||
find_package(Qt5 5.15 CONFIG REQUIRED COMPONENTS Core Gui Network Widgets Concurrent) | ||
|
||
if(IS_DEBUG_BUILD AND WIN32) | ||
# Explicitly setting SHIBOKEN_PYTHON_LIBRARIES variable to avoid PYTHON_DEBUG_LIBRARY-NOTFOUND | ||
# link errors on Windows debug builds. | ||
set(SHIBOKEN_PYTHON_LIBRARIES ${Python3_LIBRARIES}) | ||
endif() | ||
find_package(Shiboken2 5.15 CONFIG REQUIRED COMPONENTS libshiboken2 shiboken2) | ||
|
||
if(IS_DEBUG_BUILD AND WIN32) | ||
# Remove NDEBUG from Shiboken2 INTERFACE_COMPILE_DEFINITIONS so it is not inherited in debug builds. | ||
get_property(ShibokenInterfaceDefs TARGET Shiboken2::libshiboken PROPERTY INTERFACE_COMPILE_DEFINITIONS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed because /mingw64/lib/cmake/Shiboken2-5.15.13/Shiboken2Targets.cmake has code that unconditionally sets NDEBUG. :( |
||
list(REMOVE_ITEM ShibokenInterfaceDefs NDEBUG) | ||
set_property(TARGET Shiboken2::libshiboken PROPERTY INTERFACE_COMPILE_DEFINITIONS ShibokenInterfaceDefs) | ||
endif() | ||
|
||
find_package(PySide2 5.15 CONFIG REQUIRED COMPONENTS pyside2) | ||
set(QT_VERSION_MAJOR 5) | ||
get_target_property(PYSIDE_INCLUDE_DIRS PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
This option is set in the qmake builds used to build the installer. That is where I got the idea to do this.
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.
Is it only useful on WIN32?
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.
It doesn't appear to be required on Linux. The Eigen linking errors I'm seeing on Windows do not appear to occur on Linux. I'm not entirely sure why. My guess is that Windows is not inlining the Eigen code for some reason but Linux is.
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.
There are no linking issues on Linux with CMake.