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

Move to VCPKG #155

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

Move to VCPKG #155

wants to merge 4 commits into from

Conversation

Holt59
Copy link
Member

@Holt59 Holt59 commented Jul 7, 2024

Move to VCPKG

Note: I consider this branch the next master branch for (hopefully) 2.6.0 release. Once everything is stable, this branch will replace the master branch.

Here are the changes integrated (or to be integrated) into this branch:


Move to VCPKG

Use vcpkg instead of mob to obtain dependencies for uibase.

  • Bring mo2-cmake (CMake utilities, old cmake_common), spdlog and gtest from VCPKG
    • spdlog from MO2 registry to remove fmt dependency and force use of std::format
  • The dependency on boost-algorithm has been removed because
    • the only two functions used were iequals and ireplace_all,
    • adding boost-algorithm to VCPKG dependency requires ~100 packages due to the way Boost is packaged with VCPKG, so this was substantially increasing build time for uibase.
    • iequals and ireplace_all have been implemented and encapsulated.

Proper CMake Targets

Refactor code to generate proper CMake targets, the goal is to be able to do find_package(mo2-uibase) to obtain proper targets to link to.

In order to obtain "clean" targets, the following has been done:

  • Move headers file to include/uibase directory at root
  • Add CMake stuff to generate config files for uibase

The following can be used to configure, build and install uibase without external dependencies (except Qt):

# - QT_ROOT_DIR should be set/replaced to match actual Qt installation
# - UIBASE_TESTING will add tests
# - CMAKE_INSTALL_PREFIX can be set to anything where the target should be installed
cmake --preset vs2022-windows `
            "-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" `
            "-DCMAKE_INSTALL_PREFIX=install" -DUIBASE_TESTING=ON

# it is possible to build targets in all configurations
cmake --build vsbuild --config Debug --target uibase-tests --verbose
cmake --build vsbuild --config RelWithDebInfo --target uibase-tests --verbose

# tests can be run without any extra configurations (Qt DLLs, etc.)
ctest --test-dir vsbuild -C Debug --output-on-failure
ctest --test-dir vsbuild -C RelWithDebInfo --output-on-failure

# targets can be installed properly
cmake --install vsbuild --config Debug
cmake --install vsbuild --config RelWithDebInfo

To use uibase in a CMake project, one can simply:

  1. Add install/lib/cmake to CMAKE_PREFIX_PATH (where install is the location set when configuring uibase).
  2. Use find_package(mo2-uibase CONFIG REQUIRED) to find uibase
  3. Link to uibase with target_link_libraries(mytarget PRIVATE mo2::uibase)

Note: Since header files have bee reorganized, one should use #include <uibase/XXX.h> instead of #include <XXX.h> (or #include <uibase/game_features/FFF.h> for game features). To avoid having to update all existing projects, one can use set(MO2_CMAKE_DEPRECATED_UIBASE_INCLUDE ON) before find_package(mo2-uibase) to make all headers available.

Automated Release on Tag

When a Github tag is published, a new release will automatically be made.

  • Use these release in VCPKG registry to fetch uibase.
  • Check the tag against version.rc or something like that.

@Holt59 Holt59 changed the title WIP: Tentative move to standalone with VCPKG. WIP: Move to VCPKG Jul 10, 2024
@Holt59 Holt59 force-pushed the dev/vcpkg branch 3 times, most recently from 55b17a8 to 530d4f5 Compare July 11, 2024 15:21
@Holt59 Holt59 changed the title WIP: Move to VCPKG Move to VCPKG Jul 12, 2024
@Holt59 Holt59 force-pushed the dev/vcpkg branch 4 times, most recently from f3e4dd3 to 5b12135 Compare July 14, 2024 18:56
@Holt59 Holt59 force-pushed the dev/vcpkg branch 3 times, most recently from 0548932 to d7faaf8 Compare August 9, 2024 09:19
* Add proper CMake packaging for UIBase.
* Install pdb to pdb subfolder instead of lib.
* Add alias mo2::uibase target for uibase.
* Use spdlog from MO2 registry.
* Generate translations for UIBase.
* Publish release on tag.
* Add a few string methods to remove boost dependencies.
* Create standalone feature for mo2-cmake.
* Setup a QCoreApplication in tests main.
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.

1 participant