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

QoL: Buildtype variables for looping over buildtypes #7733

Closed
wants to merge 45 commits into from

Conversation

Neumann-A
Copy link
Contributor

@Neumann-A Neumann-A commented Aug 16, 2019

While working on the qt scripts I often defined those variables below to avoid unnecessary code duplication to loop over the different buildtypes

TODO:

  • Rename VCPKG_BUILD_TRIPLET_* to something different ?
  • Remove VCPKG_BUILDTREE_TRIPLET_DIR_ ?

@ras0219-msft
Copy link
Contributor

Thanks for the PR!

This in principle seems like it could be a useful abstraction, but I'd like to see it demonstrated in multiple contexts before merging.

Specifically, if it turns out to only be useful in Qt5, then it should be private to Qt5. However, if it can be used to make code significantly cleaner and clearer in more contexts, I'd like to see this PR introduce at least two of those refactorings.

@Neumann-A
Copy link
Contributor Author

Neumann-A commented Sep 7, 2019

TODO (only 2 of N):

  • Refactor vcpkg_build_cmake
  • Refactor vcpkg_build_msbuild
  • Refactor vcpkg_build_qmake
  • Refactor vcpkg_configure_cmake
  • Refactor vcpkg_configure_meson
  • Refactor vcpkg_configure_qmake
  • Refactor vcpkg_fixup_cmake_targets
  • Refactor vcpkg_install_meson (a bit short for a refactor, but consistency is important)
  • Refactor vcpkg_install_msbuild
  • Refactor an unknown number of ports which might benift from the PR (purely optional; but at least qt if the update to 5.12.4 PR is merged.)

@JackBoosY
Copy link
Contributor

Please resolve these conflicts.

Thanks.

# Conflicts:
#	ports/qt5-base/CONTROL
#	ports/qt5-base/cmake/configure_qt.cmake
#	ports/qt5-base/cmake/install_qt.cmake
#	scripts/cmake/vcpkg_build_cmake.cmake
#	scripts/cmake/vcpkg_configure_cmake.cmake
#	scripts/cmake/vcpkg_configure_qmake.cmake
@Neumann-A Neumann-A marked this pull request as ready for review May 5, 2020 18:39
@JackBoosY JackBoosY marked this pull request as draft May 6, 2020 06:21
@JackBoosY
Copy link
Contributor

Pinging @Neumann-A for response. Is work still being done for this PR?

@Neumann-A
Copy link
Contributor Author

@JackBoosY: You put the PR back into Draft?!?! I consider it finished for the time unless there is something which needs to ne fixed which I don't know of or you want some changes to it. Maybe run a full rebuild of everything to check if everything is working as intended.

@vicroms vicroms self-requested a review July 2, 2020 21:55
BillyONeal and others added 2 commits September 6, 2020 13:36
# Conflicts:
#	scripts/cmake/vcpkg_configure_cmake.cmake
#	scripts/cmake/vcpkg_configure_qmake.cmake
@JackBoosY
Copy link
Contributor

monkeys-audio regression will be fixed in another PR.

@JackBoosY JackBoosY added the depends:different-pr This PR or Issue depends on a PR which has been filed label Nov 16, 2020
@strega-nil strega-nil added requires:discussion and removed depends:different-pr This PR or Issue depends on a PR which has been filed labels Nov 18, 2020
Copy link
Contributor

@strega-nil strega-nil left a comment

Choose a reason for hiding this comment

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

Thanks @Neumann-A, just some minor last changes and a few removals/deletions.

Comment on lines 20 to 26
## VCPKG_BUILD_LIST List of VCPKG_BUILD_TYPE which the current port will build (uppercase)
## VCPKG_BUILD_SHORT_NAME_<BUILDTYPE> Short name of the buildtype (e.g. DEBUG=dbg; RELEASE=rel)
## VCPKG_BUILD_CMAKE_TYPE_<BUILDTYPE> CMAKE_BUILD_TYPE used for buildtype
## VCPKG_BUILD_QMAKE_CONFIG_<BUILDTYPE> Required QMAKE CONFIG flags for buildtype
## VCPKG_PATH_SUFFIX_<BUILDTYPE> Path suffix used for buildtype (e.g. /debug)
## VCPKG_BUILD_TRIPLET_<BUILDTYPE> Fullname of the buildtriplet e.g. ${TARGET_TRIPLET}-${VCPKG_BUILD_SHORT_NAME_<BUILDTYPE>}
## VCPKG_BUILDTREE_TRIPLET_DIR_<BUILDTYPE> Path to current buildtype buildtree (e.g. CURRENT_BUILDTREES_DIR/TRIPLET-rel )
Copy link
Contributor

Choose a reason for hiding this comment

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

In discussion, we have agreed on the following things:

  1. We probably shouldn't define VCPKG_BUILD_CMAKE_TYPE_* and VCPKG_BUILD_QMAKE_CONFIG_*, since they're build-system specific.
  2. We should remove VCPKG_BUILDTREE_TRIPLET_DIR_*, since that's not a concept we want to codify.
  3. We need to rename these:
  • VCPKG_BUILD_LIST -> VCPKG_BUILD_TYPES
  • VCPKG_BUILD_SHORT_NAME_* -> VCPKG_BUILD_TYPE_SHORT_NAME_*
  • VCPKG_BUILD_TRIPLET_* -> VCPKG_LOGNAME_STEM_* or something similar

VCPKG_PATH_SUFFIX_* is good as it is.

Additionally, we want to lowercase the build types in these, so that VCPKG_BUILD_TYPES becomes release;debug,
and the different variables are VCPKG_PATH_SUFFIX_release, VCPKG_PATH_SUFFIX_debug, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please re-discuss the following or give arguments:

Additionally, we want to lowercase the build types in these

uppercase is the way to go since cmake variables itself are uppercase. If I don't use uppercase build types I always have to use a string(UPPER) for VCPKG_DETECTED_<SOMELANGUAGE>_FLAGS_<SOMEBUILDTYPE_UPPER> . I don't see any good reason to stick to lowercase build types here. (I mean I can also introduce VCPKG_BUILD_TYPE_UPPER_<config> if you plan to stick to lowercase configs but it will get complicated to access flags: MY_C_FLAGS_${VCPKG_BUILD_TYPE_UPPER_${config}} instead of MY_C_FLAGS_${config})

We should remove VCPKG_BUILDTREE_TRIPLET_DIR_*, since that's not a concept we want to codify.

The path is used so often and even inside portfiles. I can rename it to _VCPKG_INTERNAL_BUILDTREE_TRIPLET_DIR_

VCPKG_BUILD_TRIPLET_* -> VCPKG_LOGNAME_STEM_* or something similar

although often used for the logname it is not only used there. It is also used in messages and paths/folders.

We probably shouldn't define VCPKG_BUILD_CMAKE_TYPE_* and VCPKG_BUILD_QMAKE_CONFIG_*, since they're build-system specific.

TODO: I'll move them to the configure scripts.

Copy link
Contributor

@strega-nil strega-nil Nov 20, 2020

Choose a reason for hiding this comment

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

The thing is, release and debug aren't necessarily related to the CMake stuff, they're related to the vcpkg BUILD_TYPE stuff; even though the words are the same between VCPKG_BUILD_TYPE = release and CMAKE_BUILD_TYPE = Release, they're not necessarily the same thing, and we shouldn't use RELEASE just because CMake does for a related but different concept. It's important to understand that our usecase of CMake is not as a build system -- we are simply using CMake as a language for writing descriptions of existing build systems.

The big reason we want to do this is we wish to tie this to VCPKG_BUILD_TYPE. I think this would be a really unfortunate and weird feature if it weren't tied to VCPKG_BUILD_TYPE.

ports/3fd/portfile.cmake Outdated Show resolved Hide resolved
ports/libqglviewer/portfile.cmake Outdated Show resolved Hide resolved
ports/ocilib/portfile.cmake Outdated Show resolved Hide resolved
ports/ocilib/CONTROL Outdated Show resolved Hide resolved
ports/qcustomplot/portfile.cmake Outdated Show resolved Hide resolved
add VCPKG_COPY_EXE to 0 in the debug case.
rename VCPKG_BUILD_SHORT_NAME_ to VCPKG_BUILD_TYPE_SHORT_NAME_
move VCPKG_BUILD_CMAKE_TYPE_ and VCPKG_BUILD_QMAKE_CONFIG_ into the the appropiate functions
# Conflicts:
#	scripts/cmake/vcpkg_configure_cmake.cmake
Comment on lines +22 to +23
## VCPKG_BUILD_CMAKE_TYPE_<BUILDTYPE> CMAKE_BUILD_TYPE used for buildtype
## VCPKG_BUILD_QMAKE_CONFIG_<BUILDTYPE> Required QMAKE CONFIG flags for buildtype
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
## VCPKG_BUILD_CMAKE_TYPE_<BUILDTYPE> CMAKE_BUILD_TYPE used for buildtype
## VCPKG_BUILD_QMAKE_CONFIG_<BUILDTYPE> Required QMAKE CONFIG flags for buildtype

@JackBoosY
Copy link
Contributor

Closing this PR since it seems that no progress is being made. Please reopen if work is still being done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants