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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ add_library(lzma STATIC
lzma/C/LzFind.c
lzma/C/LzmaDec.c
lzma/C/LzmaEnc.c
lzma/C/LzFind.c
lzma/C/LzFindMt.c
lzma/C/LzFindOpt.c
lzma/C/CpuArch.c
lzma/C/Threads.c
)
target_compile_definitions(lzma PRIVATE _7ZIP_ST)

Expand Down Expand Up @@ -578,8 +583,17 @@ function(NBL_ADJUST_FOLDER NBL_TARGET NBL_PREFIX KEEP_PRESENT_PREFIX)
endif()
endfunction()

NBL_GET_ALL_TARGETS(NBL_ALL_TARGETS)
foreach(NBL_TARGET IN LISTS NBL_ALL_TARGETS)
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?

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

list(APPEND NBL_IMMUTABLE_TARGETS NBL_TARGET)
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

foreach(NBL_TARGET IN LISTS NBL_ALL_3RDPARTY_TARGETS)
NBL_ADJUST_FOLDER(${NBL_TARGET} 3rdparty/excluded ON) # first pass to group all targets in IDE
set_target_properties(${NBL_TARGET} PROPERTIES EXCLUDE_FROM_ALL TRUE) # in case somebody forgots to exclude subdirectory force all as excluded
endforeach()
Expand Down Expand Up @@ -646,4 +660,8 @@ if(NBL_3RDPARTY_EXPORT_TO_BUILD_TREE)
export(TARGETS extensions APPEND FILE "${NBL_EXTENSIONS_EXPORT_INCLUDE}")
endif()

# nbl_install_dir("${CMAKE_CURRENT_SOURCE_DIR}/parallel-hashmap/parallel_hashmap") # TODO: THIS SHOULD NOT BE EXPOSED
# nbl_install_dir("${CMAKE_CURRENT_SOURCE_DIR}/parallel-hashmap/parallel_hashmap") # TODO: THIS SHOULD NOT BE EXPOSED

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