Skip to content

Commit

Permalink
move vcpkg config to setup file, rename options
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz-h committed May 16, 2023
1 parent c498b84 commit a68450e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
22 changes: 5 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
#
cmake_minimum_required(VERSION 3.15...3.26 FATAL_ERROR)

# Vcpkg setup
set(MEGAMOL_VCPKG_VERSION "2023.04.15") # Update default-registry baseline in vcpkg-configuration.json when changing!

include(cmake/megamol_vcpkg_setup.cmake)
include(cmake/megamol_feature_option.cmake)
include(cmake/megamol_vcpkg_empty_port.cmake)

# MegaMol vcpkg features
megamol_feature_option(CGAL "Enable CGAL support" OFF)
megamol_feature_option(CUDA "Enable CUDA support" OFF)
megamol_feature_option(MPI "Enable MPI support" OFF)
Expand All @@ -19,26 +22,11 @@ megamol_feature_option(PROFILING "Enable profiling support" OFF)
megamol_feature_option(STACKTRACE "Enable Boost.Stacktrace support" OFF)
megamol_feature_option(TRACY "Enable tracy support" OFF)
megamol_feature_option(VTKM "Enable VTK-m support" OFF)
# dependent options
# MegaMol vcpkg features (dependent options)
megamol_feature_option(CUESDK "Enable Corsair CUESDK support" OFF "WIN32")
megamol_feature_option(OPENGL_DEBUGGROUPS "Automatically inject OpenGL debug groups into MegaMol Call callback invocations" OFF "MEGAMOL_USE_OPENGL")
megamol_feature_option(VR_INTEROP "Enable MegaMol-Unity VR Interop via Spout2" OFF "MEGAMOL_USE_OPENGL")

# option(X_VCPKG_APPLOCAL_DEPS_INSTALL "" ON) # Does currently not not work as expected, see comment on manual install below!
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/vcpkg_ports")
set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/vcpkg_triplets") # We are using triplets with VCPKG_DISABLE_COMPILER_TRACKING set (on Windows).
set(VCPKG_BOOTSTRAP_OPTIONS "-disableMetrics") # Disable Telemetry
set(VCPKG_INSTALL_OPTIONS "--clean-after-build" "--no-print-usage") # Build dirs get quite large and are usually only needed for debugging new ports.
set(CMAKE_TOOLCHAIN_FILE "${MEGAMOL_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")

set(ENV{VCPKG_FORCE_DOWNLOADED_BINARIES} ON) # Vcpkg should always download tools (i.e. CMake) to have consistent versions over all systems.
option(MEGAMOL_DOWNLOAD_VCPKG_CACHE "Download prebuilt dependency binaries if available" OFF)
if (MEGAMOL_DOWNLOAD_VCPKG_CACHE)
set(ENV{VCPKG_BINARY_SOURCES} "clear;default,readwrite;http,https://vcpkg-cache.megamol.org/{triplet}-{name}-{sha},read")
endif ()

include(cmake/megamol_vcpkg_empty_port.cmake)

# Disable in source build
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
Expand Down Expand Up @@ -130,7 +118,7 @@ megamol_extra_repo(tests

# Install vcpkg libraries
# X_VCPKG_APPLOCAL_DEPS_INSTALL currently does only work for windows, in addition only actually used dll's are
# installed. This is a problem for libraries that load dll's dynamically on runtime (.i.e. ospray).
# installed. This is a problem for libraries that load dll's dynamically on runtime (i.e. ospray).
# Therefore, we just copy all vcpkg libraries to our install dir, until vcpkg may has a better option in future.
if (WIN32)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-windows/$<$<CONFIG:Debug>:debug/>bin/
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ pr:

variables:
defaultConfig: >-
-DMEGAMOL_DOWNLOAD_VCPKG_CACHE=ON
-DMEGAMOL_VCPKG_DOWNLOAD_CACHE=ON
-DMEGAMOL_WARNING_LEVEL="Off"
-DMEGAMOL_PLUGIN_MEGAMOL101_GL=ON
-DMEGAMOL_USE_CGAL=ON
-DMEGAMOL_USE_PROFILING=ON
-DMEGAMOL_USE_VTKM=ON
nonGlConfig: >-
-DMEGAMOL_DOWNLOAD_VCPKG_CACHE=ON
-DMEGAMOL_VCPKG_DOWNLOAD_CACHE=ON
-DMEGAMOL_WARNING_LEVEL="Off"
-DMEGAMOL_USE_OPENGL=OFF
Expand Down
13 changes: 13 additions & 0 deletions cmake/megamol_vcpkg_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,16 @@ if (NOT IS_DIRECTORY "${MEGAMOL_VCPKG_DIR}")
FETCHCONTENT_UPDATES_DISCONNECTED_VCPKG-DOWNLOAD)
endif ()
endif ()

# vcpkg config
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/vcpkg_ports")
set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/vcpkg_triplets") # Disable compiler tracking on Windows.
set(VCPKG_BOOTSTRAP_OPTIONS "-disableMetrics")
set(VCPKG_INSTALL_OPTIONS "--clean-after-build" "--no-print-usage")
set(CMAKE_TOOLCHAIN_FILE "${MEGAMOL_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")
set(ENV{VCPKG_FORCE_DOWNLOADED_BINARIES} ON) # Always download tools (i.e. CMake) to have consistent versions on all systems.

option(MEGAMOL_VCPKG_DOWNLOAD_CACHE "Download prebuilt dependency binaries if available." OFF)
if (MEGAMOL_VCPKG_DOWNLOAD_CACHE)
set(ENV{VCPKG_BINARY_SOURCES} "clear;default,readwrite;http,https://vcpkg-cache.megamol.org/{triplet}-{name}-{sha},read")
endif ()
2 changes: 1 addition & 1 deletion docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ See the plugins' [readme](https://github.com/UniStuttgart-VISUS/megamol/blob/mas
1. You have to install [CMake](https://cmake.org/), and load the `CMakeLists.txt` present in the root directory of the repository.
2. Create a new `build` directory.
3. As generator, it is recommended to use the latest version of [Visual Studio](https://visualstudio.microsoft.com/downloads/) (Community Edition is free to use) with default native compilers and for the platform x64.
4. If you want to download prebuild binaries for required third party libraries enable the option `MEGAMOL_DOWNLOAD_VCPKG_CACHE` before configure. Otherwise, libraries will be built during configure.
4. If you want to download prebuild binaries for required third party libraries enable the option `MEGAMOL_VCPKG_DOWNLOAD_CACHE` before configure. Otherwise, libraries will be built during configure.
5. Next, click `Configure` a few times (until all red entries disappear).
6. Change the `CMAKE_INSTALL_PREFIX` in order to change the destination directory of the installed files and configure once more.
7. Then click `Generate` to generate the build files.
Expand Down

0 comments on commit a68450e

Please sign in to comment.