Skip to content

[flatbuffers] fix executable remaining in bin folder#4294

Merged
ras0219-msft merged 2 commits intomicrosoft:masterfrom
edmBernard:fix_flatbuffer_linux
Oct 16, 2018
Merged

[flatbuffers] fix executable remaining in bin folder#4294
ras0219-msft merged 2 commits intomicrosoft:masterfrom
edmBernard:fix_flatbuffer_linux

Conversation

@edmBernard
Copy link
Copy Markdown
Contributor

fix for this message at build time :

There should be no bin\ directory in a static build, but /home/user/Documents/tools/vcpkg/packages/flatbuffers_x64-linux/bin is present.
If the creation of bin\ and/or debug\bin\ cannot be disabled, use this in the portfile to remove them

    if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
        file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
    endif()

Found 1 error(s). Please correct the portfile:
    /home/user/Documents/tools/vcpkg/ports/flatbuffers/portfile.cmake
-- Performing post-build validation done
Error: Building package flatbuffers:x64-linux failed with: POST_BUILD_CHECKS_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: flatbuffers:x64-linux
  Vcpkg version: 0.0.113-unknownhash

@SalvoVirga
Copy link
Copy Markdown

You could avoid to manually handle the executable extension and let CMake do the magic instead, for instance:

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/flatbuffers")

file(GLOB flatc_path ${CURRENT_PACKAGES_DIR}/bin/flatc*)
if(flatc_path)
    make_directory(${CURRENT_PACKAGES_DIR}/tools/flatbuffers)
    get_filename_component(flatc_executable ${flatc_path} NAME)
    file(
        RENAME
        ${flatc_path}
        ${CURRENT_PACKAGES_DIR}/tools/flatbuffers/${flatc_executable}
    )
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/flatbuffers)
endif()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)

Note that I would also remove completely the check to remove the bin directories (last line of the code above), since it is required for static builds and the flatbuffers is forced to be build statically (first 4 lines of the portfile).

@edmBernard
Copy link
Copy Markdown
Contributor Author

@SalvoVirga I update with your changes. It's indeed a better solution. thanks

@edmBernard edmBernard force-pushed the fix_flatbuffer_linux branch from 6df60e0 to 0422155 Compare October 4, 2018 06:07
@edmBernard
Copy link
Copy Markdown
Contributor Author

update the base after this PR #3873

@ras0219-msft ras0219-msft merged commit d798fd3 into microsoft:master Oct 16, 2018
@ras0219-msft
Copy link
Copy Markdown
Contributor

Thanks for the PR and for dealing with the rebase!

@edmBernard edmBernard deleted the fix_flatbuffer_linux branch October 16, 2018 12:22
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.

3 participants