Skip to content

Commit c1de935

Browse files
committed
Dependencies using vcpkg
1 parent 08926ac commit c1de935

File tree

187 files changed

+94
-28805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+94
-28805
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ CMakeFiles
8282
CMakeCache.txt
8383
cmake_install.cmake
8484

85+
/Code.v05-00/vcpkg_installed/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Code.v05-00/submodules/vcpkg"]
2+
path = Code.v05-00/submodules/vcpkg
3+
url = https://github.com/Microsoft/vcpkg.git

Code.v05-00/CMakeLists.txt

+33-59
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
cmake_minimum_required(VERSION 3.16)
22

3+
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake"
4+
CACHE STRING "Vcpkg toolchain file")
5+
36
project(APCEMM)
47

58
# Options
@@ -27,66 +30,41 @@ execute_process(COMMAND git rev-parse --short HEAD
2730
OUTPUT_STRIP_TRAILING_WHITESPACE)
2831

2932
set(APCEMM_VERSION_BUILD_NUMBER "${APCEMM_VERSION_BUILD_NUMBER}" CACHE STRING "Git Version/Commit Hash")
30-
set(CMAKE_CXX_STANDARD 17)
33+
set(CMAKE_CXX_STANDARD 20)
3134
configure_file(${CMAKE_SOURCE_DIR}/include/APCEMM.h.in ${CMAKE_SOURCE_DIR}/include/APCEMM.h @ONLY)
3235

33-
# Include .cmake files in this directory to find the required packages
34-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
35-
36-
# Automated discovert of netCDF using netCDF config
37-
# Find nc-config and ncxx4-config
38-
find_program(NC_CONFIG NAMES "nc-config" DOC "Location of nc-config utility")
39-
find_program(NCXX_CONFIG NAMES "ncxx4-config" DOC "Location of ncxx4-config utility")
40-
41-
# A function to call nx-config with an argument, and append the resulting path to a list
42-
function(inspect_netcdf_config VAR NX_CONFIG ARG)
43-
execute_process(
44-
COMMAND ${NX_CONFIG} ${ARG}
45-
OUTPUT_VARIABLE NX_CONFIG_OUTPUT
46-
OUTPUT_STRIP_TRAILING_WHITESPACE
47-
)
48-
if(EXISTS "${NX_CONFIG_OUTPUT}")
49-
list(APPEND ${VAR} ${NX_CONFIG_OUTPUT})
50-
set(${VAR} ${${VAR}} PARENT_SCOPE)
51-
endif()
52-
endfunction()
36+
# Defines the 'main' file we want to create a binary of
37+
add_executable(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/src/Core/Main.cpp)
38+
39+
40+
# Dependencies managed by vcpkg:
41+
42+
find_package(Boost REQUIRED)
43+
# All the Boost libraries we use are header-only, so no need to link here.
44+
45+
find_package(Catch2 CONFIG REQUIRED)
46+
target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2 Catch2::Catch2WithMain)
5347

54-
# Add nc-config and ncxx4-config paths to CMAKE_PREFIX_PATH
55-
inspect_netcdf_config(CMAKE_PREFIX_PATH "${NC_CONFIG}" "--prefix")
56-
inspect_netcdf_config(CMAKE_PREFIX_PATH "${NCXX_CONFIG}" "--prefix")
48+
find_package(Eigen3 CONFIG REQUIRED)
49+
target_link_libraries(${PROJECT_NAME} PRIVATE Eigen3::Eigen)
50+
51+
find_package(FFTW3 CONFIG REQUIRED)
52+
target_link_libraries(${PROJECT_NAME} PRIVATE FFTW3::fftw3)
53+
54+
find_package(netCDFCxx CONFIG REQUIRED)
55+
target_link_libraries(${PROJECT_NAME} PRIVATE netCDF::netcdf netCDF::netcdf-cxx4)
56+
57+
find_package(yaml-cpp CONFIG REQUIRED)
58+
target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp::yaml-cpp)
59+
60+
# Other dependencies:
5761

58-
# Find packages
59-
find_package(NetCDF REQUIRED)
60-
find_package(netCDFCxx REQUIRED)
61-
find_package(FFTW REQUIRED)
6262
find_package(OpenMP REQUIRED)
63-
#find_package(Catch2 3 REQUIRED)
64-
find_package(yaml-cpp REQUIRED)
65-
find_package(Eigen3 3.3 REQUIRED)
66-
67-
# Try to get Catch2 automatically
68-
Include(FetchContent)
69-
70-
FetchContent_Declare(
71-
Catch2
72-
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
73-
GIT_TAG v3.0.1 # or a later release
74-
# FIND_PACKAGE_ARGS # No specific args - but this ensure find_package runs first
75-
)
76-
#TODO: Figure out why FIND_PACKAGE_ARGS causes chaos
77-
78-
#FetchContent_Declare(
79-
# yaml-cpp
80-
# GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
81-
# GIT_TAG 4aad2b1666a4742743b04e765a34742512915674
82-
#)
83-
84-
#set(YAML_CPP_BUILD_TESTS OFF)
85-
# This should attempt to find the package, and will download if not found
86-
FetchContent_MakeAvailable(Catch2)
87-
#FetchContent_MakeAvailable(Catch2 yaml-cpp)
63+
target_link_libraries(${PROJECT_NAME} PRIVATE OpenMP::OpenMP_CXX)
64+
8865

8966
# This ensures the header files of the necessary libraries are included
67+
include_directories(${Boost_INCLUDES})
9068
include_directories(${OpenMP_INCLUDES})
9169
include_directories(${FFTW_INCLUDES})
9270
include_directories(${NETCDF_INCLUDES})
@@ -99,13 +77,9 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
9977
# This ensures that the CMakeLists.txt in src/ gets build
10078
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
10179

102-
# Defines the 'main' file we want to create a binary of
103-
add_executable(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/src/Core/Main.cpp)
104-
10580
# Defines the libraries necessary for compiling the executable
106-
target_link_libraries(${PROJECT_NAME}
107-
${netCDFCxx_LIBRARIES} ${NETCDF_LIBRARIES} ${FFTW_LIBRARIES} ${YAML_CPP_LIBRARIES}
108-
OpenMP::OpenMP_CXX Eigen3::Eigen FVM_ANDS Util AIM KPP EPM Core YamlInputReader LAGRID)
81+
target_link_libraries(${PROJECT_NAME} PRIVATE
82+
FVM_ANDS Util AIM KPP EPM Core YamlInputReader LAGRID)
10983

11084
# Tests
11185
#if (BUILD_TEST)

Code.v05-00/cmake/FindEigen3.cmake

-107
This file was deleted.

0 commit comments

Comments
 (0)