Skip to content

Commit

Permalink
Merge branch 'conda-build' into 'master'
Browse files Browse the repository at this point in the history
Some CMake logic for building with conda

See merge request ogs/ogs!5029
  • Loading branch information
bilke committed Jun 27, 2024
2 parents 2d0109b + 427416f commit 259e948
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 29 deletions.
11 changes: 4 additions & 7 deletions MeshToolsLib/MeshGenerators/AddFaultToVoxelGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
* http://www.opengeosys.org/project/license
*/

#include "MeshToolsLib/MeshGenerators/AddFaultToVoxelGrid.h"

#include <Eigen/Geometry>
#include <algorithm>
#include <memory>
#include <string>
#include <vector>

// ThirdParty
#include <tclap/CmdLine.h>

#include <Eigen/Geometry>

#include "GeoLib/AABB.h"
#include "InfoLib/GitInfo.h"
#include "MathLib/Point3d.h"
Expand All @@ -25,7 +23,6 @@
#include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
#include "MeshToolsLib/MeshGenerators/AddFaultToVoxelGrid.h"

namespace
{
Expand Down Expand Up @@ -228,4 +225,4 @@ bool addFaultToVoxelGrid(MeshLib::Mesh* mesh,

return true;
}
} // namespace MeshToolsLib::MeshGenerator::AddFaultToVoxelGrid
} // namespace MeshToolsLib::MeshGenerator::AddFaultToVoxelGrid
42 changes: 26 additions & 16 deletions scripts/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ else()
)
endif()

if(GUIX_BUILD)
add_library(tclap INTERFACE IMPORTED) # header-only, nothing else to do
if(GUIX_BUILD OR CONDA_BUILD)
find_path(_tclap_include UnlabeledValueArg.h PATH_SUFFIXES tclap REQUIRED)
add_library(tclap INTERFACE IMPORTED)
target_include_directories(
tclap SYSTEM INTERFACE ${_tclap_include} ${_tclap_include}/..
)
else()
CPMFindPackage(
NAME tclap
Expand All @@ -65,11 +69,15 @@ if(GUIX_BUILD)
find_program(TETGEN_EXECUTABLE tetgen REQUIRED)
install(PROGRAMS ${TETGEN_EXECUTABLE} DESTINATION bin)
else()
if(CONDA_BUILD)
set(_tegen_options OPTIONS "TETGEN_SKIP_INSTALL ON")
endif()
CPMAddPackage(
NAME tetgen GITHUB_REPOSITORY ufz/tetgen
GIT_TAG 213548f5bca1ec00269603703f0fec1272181587 SYSTEM TRUE
GIT_TAG 3f75905af7407ab0de1cd1dc92a1b77d6bdacbb7 SYSTEM TRUE
${_tegen_options}
)
if(tetgen_ADDED)
if(tetgen_ADDED AND NOT CONDA_BUILD)
install(PROGRAMS $<TARGET_FILE:tetgen> DESTINATION bin)
endif()
list(APPEND DISABLE_WARNINGS_TARGETS tet tetgen)
Expand Down Expand Up @@ -153,7 +161,7 @@ if(Eigen3_ADDED)
endif()

if(OGS_USE_MFRONT)
if(GUIX_BUILD)
if(GUIX_BUILD OR CONDA_BUILD)
find_package(MFrontGenericInterface REQUIRED)
else()
set(CMAKE_REQUIRE_FIND_PACKAGE_TFEL TRUE)
Expand Down Expand Up @@ -316,7 +324,7 @@ endif()
# find_package(ParaView REQUIRED)
# endif()
# ~~~
if(GUIX_BUILD)
if(GUIX_BUILD OR CONDA_BUILD)
add_library(exprtk INTERFACE IMPORTED)
else()
CPMAddPackage(
Expand All @@ -331,7 +339,7 @@ else()
endif()
endif()

if(GUIX_BUILD)
if(GUIX_BUILD OR CONDA_BUILD)
find_package(range-v3 REQUIRED)
else()
CPMFindPackage(
Expand All @@ -343,13 +351,15 @@ else()
)
endif()

if((OGS_BUILD_TESTING OR OGS_BUILD_UTILS) AND NOT GUIX_BUILD)
CPMAddPackage(
NAME vtkdiff GITHUB_REPOSITORY ufz/vtkdiff
GIT_TAG 9754b4da43c6adfb65d201ed920b5f6ea27b38b9
)
if(vtkdiff_ADDED)
install(PROGRAMS $<TARGET_FILE:vtkdiff> DESTINATION bin)
if(NOT (GUIX_BUILD OR CONDA_BUILD))
if((OGS_BUILD_TESTING OR OGS_BUILD_UTILS))
CPMAddPackage(
NAME vtkdiff GITHUB_REPOSITORY ufz/vtkdiff
GIT_TAG 9754b4da43c6adfb65d201ed920b5f6ea27b38b9
)
if(vtkdiff_ADDED)
install(PROGRAMS $<TARGET_FILE:vtkdiff> DESTINATION bin)
endif()
endif()
endif()

Expand Down Expand Up @@ -419,7 +429,7 @@ if(MSVC)
endif()

if(OGS_BUILD_UTILS)
if(NOT GUIX_BUILD)
if(NOT GUIX_BUILD AND NOT CONDA_BUILD)
set(_metis_options "MSVC ${WIN32}")
if(WIN32)
list(APPEND _metis_options "BUILD_SHARED_LIBS OFF")
Expand Down Expand Up @@ -469,7 +479,7 @@ if(OGS_BUILD_UTILS)
endif()

if(OGS_USE_NETCDF)
if(NOT GUIX_BUILD)
if(NOT GUIX_BUILD AND NOT CONDA_BUILD)
find_package(netCDF CONFIG REQUIRED)
find_library(NETCDF_LIBRARIES_CXX NAMES netcdf_c++4 netcdf-cxx4)
if(NOT NETCDF_LIBRARIES_CXX)
Expand Down
2 changes: 1 addition & 1 deletion scripts/cmake/DependenciesExternalProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ set(_vtk_source_file
)
if(EXISTS ${_vtk_source_file})
set(_vtk_source URL ${_vtk_source_file})
elseif(NOT OGS_BUILD_VTK AND (NOT OGS_USE_MKL OR GUIX_BUILD))
elseif(NOT OGS_BUILD_VTK AND (NOT OGS_USE_MKL OR GUIX_BUILD OR CONDA_BUILD))
# Typically VTK also pulls in libgomp dependency when found on system
unset(VTK_COMPONENTS)
foreach(opt ${VTK_OPTIONS})
Expand Down
12 changes: 7 additions & 5 deletions scripts/cmake/packaging/Pack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,18 @@ if(WIN32)
file(COPY ${PYTHON_RUNTIME_LIBS}
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
elseif(NOT GUIX_BUILD)
elseif(NOT GUIX_BUILD AND NOT CONDA_BUILD)
install(FILES ${Python_LIBRARIES} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

configure_file(Documentation/README.txt.in ${PROJECT_BINARY_DIR}/README.txt)
install(FILES ${PROJECT_BINARY_DIR}/README.txt DESTINATION .)

if(NOT GUIX_BUILD)
if(NOT GUIX_BUILD AND NOT CONDA_BUILD)
# May contain machine specific content, e.g. MPIEXEC_MAX_NUMPROCS
install(FILES ${PROJECT_BINARY_DIR}/CMakeCache.txt TYPE INFO)
install(FILES ${PROJECT_BINARY_DIR}/cmake_args TYPE INFO OPTIONAL)
endif()
if(NOT CONDA_BUILD)
install(FILES ${PROJECT_BINARY_DIR}/third_party_licenses.txt TYPE INFO)
install(FILES ${PROJECT_BINARY_DIR}/README.txt DESTINATION .)
endif()
install(FILES ${PROJECT_BINARY_DIR}/cmake_args TYPE INFO OPTIONAL)
install(FILES ${PROJECT_BINARY_DIR}/third_party_licenses.txt TYPE INFO)

0 comments on commit 259e948

Please sign in to comment.