Skip to content

Commit

Permalink
build: Powershell script to install dependencies for MSVC (#2021)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobBuchananCompPhys authored Jan 31, 2025
1 parent 7ddf477 commit a61638e
Show file tree
Hide file tree
Showing 6 changed files with 493 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ set(CMAKE_CXX_STANDARD 20)
# Add our custom module search path
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")

# We are setting up a development environment in MSVC
option(MSVC_DEV "Configuration is for a Visual Studio 2022 dev environment" OFF)

# Install GSL (GNU Scientific Library) with Conan for Windows and Unix-like systems
option(CONAN_GSL "Use conan to find GSL" ON)

Expand Down Expand Up @@ -415,3 +418,9 @@ if(GUI)
)
install(SCRIPT ${deploy_script})
endif(GUI)

# Install for MSVC
if(MSVC_DEV)
include(msvc-dissolve-dev)
setup_msvc()
endif(MSVC_DEV)
1 change: 1 addition & 0 deletions benchmark/math/interpolator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "math/data1D.h"
#include <algorithm>
#include <benchmark/benchmark.h>
#include <numeric>
#include <random>
#include <vector>

Expand Down
45 changes: 45 additions & 0 deletions cmake/Modules/msvc-dissolve-dev.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Find and install dependencies for a Visual Studio 2022 dev environment
function(setup_msvc)
set(SEARCH_IN "${CMAKE_BINARY_DIR}")
set(INSTALLATION_DIR "${SEARCH_IN}")

set(ALL_INSTALL_FILES "")

set(CONAN_DEPS ${_conan_requires})
list(APPEND CONAN_DEPS ${EXTRA_CONAN_REQUIRES})

# Find exe, dll and lib paths from Conan packages
foreach (DEPENDENCY IN LISTS CONAN_DEPS)
string(FIND ${DEPENDENCY} "/" SUBSTRING_AT)
string(SUBSTRING ${DEPENDENCY} 0 "${SUBSTRING_AT}" SUB_DIR)

set(SEARCH_IN ${CMAKE_BINARY_DIR}/${SUB_DIR})

file(GLOB CONAN_BIN "${SEARCH_IN}/bin/*.exe" "${SEARCH_IN}/bin/*.dll")
file(GLOB CONAN_LIB "${SEARCH_IN}/lib/*.lib")

set(CONAN_FILES ${CONAN_BIN})
list(APPEND CONAN_FILES ${CONAN_LIB})

list(APPEND ALL_INSTALL_FILES ${CONAN_FILES})
endforeach()

# Find GUI dependencies (FTGL and Freetype)
if(GUI)
set(INSTALLATION_DIR "${CMAKE_BINARY_DIR}/bin")
set(GUI_DEPENDENCIES_DIR "${CMAKE_BINARY_DIR}/../dependencies")

if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
list(APPEND ALL_INSTALL_FILES "${GUI_DEPENDENCIES_DIR}/ftgl-install/bin/ftgld.dll")
list(APPEND ALL_INSTALL_FILES "${GUI_DEPENDENCIES_DIR}/freetype-install/bin/freetyped.dll")
else()
list(APPEND ALL_INSTALL_FILES "${GUI_DEPENDENCIES_DIR}/ftgl-install/bin/ftgl.dll")
list(APPEND ALL_INSTALL_FILES "${GUI_DEPENDENCIES_DIR}/freetype-install/bin/freetype.dll")
endif()
endif()

# Install all dependencies
foreach(DEPENDENCY IN LISTS ALL_INSTALL_FILES)
file(COPY ${DEPENDENCY} DESTINATION "${INSTALLATION_DIR}")
endforeach()
endfunction()
Loading

0 comments on commit a61638e

Please sign in to comment.