Skip to content
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

newBuildSystem post master merge compile fixes & updates #796

Open
wants to merge 4 commits into
base: newBuildSystem
Choose a base branch
from

Conversation

AnastaZIuk
Copy link
Member

No description provided.

foreach(NBL_TARGET IN LISTS NBL_ALL_3RDPARTY_TARGETS)
get_target_property(NBL_TARGET_SOURCE_DIR ${NBL_TARGET} SOURCE_DIR)
if(${NBL_TARGET_SOURCE_DIR} MATCHES "${NBL_ROOT_PATH}/3rdparty/dxc*" OR ${NBL_TARGET_SOURCE_DIR} MATCHES "${NBL_ROOT_PATH}/3rdparty/libjpeg-turbo*")
message("found:${NBL_TARGET}:${NBL_TARGET_SOURCE_DIR}")
Copy link
Member Author

Choose a reason for hiding this comment

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

this should be silent check, no logs

NBL_GET_ALL_TARGETS(NBL_ALL_3RDPARTY_TARGETS)
foreach(NBL_TARGET IN LISTS NBL_ALL_3RDPARTY_TARGETS)
get_target_property(NBL_TARGET_SOURCE_DIR ${NBL_TARGET} SOURCE_DIR)
if(${NBL_TARGET_SOURCE_DIR} MATCHES "${NBL_ROOT_PATH}/3rdparty/dxc*" OR ${NBL_TARGET_SOURCE_DIR} MATCHES "${NBL_ROOT_PATH}/3rdparty/libjpeg-turbo*")
Copy link
Member Author

Choose a reason for hiding this comment

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

have a NBL_3RDPARTY_IMMUTABLE_TARGET_SRC_PATTERNS list, put "${NBL_ROOT_PATH}/3rdparty/dxc*" and "${NBL_ROOT_PATH}/3rdparty/libjpeg-turbo*" into the list, & use it to perform the regex pattern check

Copy link
Member Author

@AnastaZIuk AnastaZIuk Nov 23, 2024

Choose a reason for hiding this comment

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

# you can move this util to common.cmake
function(NBL_MATCH_PATTERNS IN_STRING PATTERNS_VAR RESULT_VAR)
    set(NBL_MATCHED FALSE)

    foreach(PATTERN IN LISTS ${PATTERNS_VAR})
        if(${IN_STRING} MATCHES "${PATTERN}")
            set(NBL_MATCHED TRUE)
            break()
        endif()
    endforeach()

    set(${RESULT_VAR} ${NBL_MATCHED} PARENT_SCOPE)
endfunction()

set(NBL_3RDPARTY_IMMUTABLE_TARGET_SRC_PATTERNS
    "${NBL_ROOT_PATH}/3rdparty/dxc*"
    "${NBL_ROOT_PATH}/3rdparty/libjpeg-turbo*"
)

NBL_GET_ALL_TARGETS(NBL_ALL_3RDPARTY_TARGETS)

foreach(NBL_TARGET IN LISTS NBL_ALL_3RDPARTY_TARGETS)
    get_target_property(NBL_TARGET_SOURCE_DIR ${NBL_TARGET} SOURCE_DIR)
    NBL_MATCH_PATTERNS("${NBL_TARGET_SOURCE_DIR}" NBL_3RDPARTY_IMMUTABLE_TARGET_SRC_PATTERNS MATCH_FOUND)

    if(MATCH_FOUND)
        list(APPEND NBL_IMMUTABLE_TARGETS ${NBL_TARGET})
    else()
        list(APPEND NBL_MUTABLE_TARGETS ${NBL_TARGET})
    endif()
endforeach()

Copy link
Member Author

Choose a reason for hiding this comment

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

by the way why do we treat libjpeg-turbo as immutable?

endif()
endforeach()

NBL_GET_ALL_TARGETS(NBL_ALL_3RDPARTY_TARGETS)
Copy link
Member Author

@AnastaZIuk AnastaZIuk Nov 23, 2024

Choose a reason for hiding this comment

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

don't use this util second time here, at this point we don't add any new 3rdparty targets so you do the same job twice (its recursive function going through all processed CMakeLists.txt files so far inclusive down bellow your current node in the build tree), we should call it only once just before updating their properties/compile options, definitions or whatever

set(NBL_ALL_3RDPARTY_TARGETS
${NBL_ALL_3RDPARTY_TARGETS}
PARENT_SCOPE)
Copy link
Member Author

Choose a reason for hiding this comment

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

parent scope immutable & mutable target lists as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants