-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
cmake_minimum_required(VERSION 3.18) | ||
project( | ||
squadgen | ||
VERSION $ENV{PKG_VERSION} | ||
LANGUAGES C CXX) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | ||
|
||
include("${CMAKE_SOURCE_DIR}/cmake_macros/gnu.cmake") | ||
|
||
find_package(NETCDF REQUIRED) | ||
|
||
message(STATUS "netcdf_c_incdir=${netcdf_c_incdir}") | ||
message(STATUS "netcdf_c_libs=${netcdf_c_libs}") | ||
|
||
find_package(PNG REQUIRED) | ||
message(STATUS "PNG_INCLUDE_DIR=${PNG_INCLUDE_DIR}") | ||
message(STATUS "PNG_LIBRARIES=${PNG_LIBRARIES}") | ||
|
||
SET(SRC ${CMAKE_SOURCE_DIR}/src) | ||
set(SQUADGEN_SRC ${SRC}/SQuadGen.cpp | ||
${SRC}/GridElements.cpp | ||
${SRC}/CSRefinementMap.cpp | ||
${SRC}/CubedSphereGrid.cpp | ||
${SRC}/IcosahedralFlagGrid.cpp | ||
${SRC}/RefineGrid.cpp | ||
${SRC}/RefinementTemplateCUBIT.cpp | ||
${SRC}/RefinementTemplateLOWCONN.cpp | ||
${SRC}/RefinementTemplateLOWCONNOLD.cpp | ||
${SRC}/SpringDynamics.cpp | ||
${SRC}/MeshUtilities.cpp | ||
${SRC}/Tessellate.cpp | ||
${SRC}/lodepng.cpp | ||
${SRC}/netcdf.cpp | ||
${SRC}/ncvalues.cpp) | ||
|
||
include_directories(${PNG_INCLUDE_DIR}) | ||
include_directories(${netcdf_c_incdir}) | ||
|
||
include_directories(${SRC}) | ||
add_executable(SQuadGen ${SQUADGEN_SRC}) | ||
target_link_libraries(SQuadGen ${netcdf_c_libs} ${PNG_LIBRARIES}) | ||
|
||
install(TARGETS SQuadGen DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set -e | ||
|
||
cp -r ${RECIPE_DIR}/cmake ${RECIPE_DIR}/cmake_macros ${RECIPE_DIR}/CMakeLists.txt . | ||
|
||
rm -rf build | ||
mkdir build | ||
cd build | ||
cmake \ | ||
-D CMAKE_INSTALL_PREFIX="${PREFIX}" \ | ||
-D NETCDF_PATH="${PREFIX}" \ | ||
-D CMAKE_BUILD_TYPE=Release \ | ||
.. | ||
cmake --build . | ||
cmake --install . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# - Try to find Netcdf | ||
|
||
function(get_netcdf_libs ncpath) | ||
|
||
set(ncconfig ${ncpath}/bin/nc-config) | ||
|
||
# Get C libs | ||
if (EXISTS ${ncconfig}) | ||
execute_process(COMMAND ${ncconfig} --libs OUTPUT_VARIABLE nclibs OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
endif() | ||
|
||
# Fall back to find_library | ||
if (NOT nclibs) | ||
find_library(nclibs_temp netcdf REQUIRED HINTS ${ncpath}/lib ${ncpath}/lib64) | ||
set(nclibs ${nclibs_temp}) | ||
endif() | ||
|
||
|
||
set(netcdf_c_libs ${nclibs} PARENT_SCOPE) | ||
endfunction() | ||
|
||
function(create_netcdf_target) | ||
|
||
# Grab things from env | ||
set(NETCDF_PATH $ENV{NETCDF_PATH}) | ||
set(NETCDF_C_PATH $ENV{NETCDF_C_PATH}) | ||
|
||
if (NETCDF_C_PATH) | ||
# Sanity checks | ||
if (NOT EXISTS ${NETCDF_C_PATH}/lib AND NOT EXISTS ${NETCDF_C_PATH}/lib64) | ||
message(FATAL_ERROR "NETCDF_C_PATH does not contain a lib or lib64 directory") | ||
endif () | ||
|
||
get_netcdf_libs(${NETCDF_C_PATH}) | ||
find_path (netcdf_c_incdir netcdf.h REQUIRED HINTS ${NETCDF_C_PATH}/include) | ||
|
||
elseif (NETCDF_FORTRAN_PATH) | ||
message(FATAL_ERROR "NETCDF_FORTRAN_PATH specified without NETCDF_C_PATH") | ||
|
||
elseif (NETCDF_PATH) | ||
# Sanity checks | ||
if (NOT EXISTS ${NETCDF_PATH}/lib AND NOT EXISTS ${NETCDF_PATH}/lib64) | ||
message(FATAL_ERROR "NETCDF_PATH does not contain a lib or lib64 directory") | ||
endif () | ||
|
||
get_netcdf_libs(${NETCDF_PATH}) | ||
find_path(netcdf_c_incdir netcdf.h REQUIRED HINTS ${NETCDF_PATH}/include) | ||
|
||
else() | ||
message(FATAL_ERROR "NETCDF not found: Define NETCDF_PATH or NETCDF_C_PATH") | ||
endif() | ||
|
||
set(netcdf_c_incdir ${netcdf_c_incdir}) | ||
set(netcdf_c_libs ${netcdf_c_libs} PARENT_SCOPE) | ||
endfunction() | ||
|
||
create_netcdf_target() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
string(APPEND CMAKE_Fortran_FLAGS " -fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none") | ||
if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10) | ||
string(APPEND CMAKE_Fortran_FLAGS " -fallow-argument-mismatch") | ||
endif() | ||
string(APPEND CMAKE_Fortran_FORMAT_FIXED_FLAG " -ffixed-form") | ||
string(APPEND CMAKE_Fortran_FORMAT_FREE_FLAG " -ffree-form") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{% set name = "squadgen" %} | ||
{% set version = "1.2.1" %} | ||
|
||
package: | ||
name: {{ name|lower }} | ||
version: {{ version }} | ||
|
||
source: | ||
url: https://github.com/ClimateGlobalChange/squadgen/archive/refs/tags/v{{ version }}.tar.gz | ||
sha256: a39f9f467563e796c1b0a53c7bf7d046f50110a030d92350754a60ada4eda053 | ||
|
||
build: | ||
skip: true # [not linux] | ||
number: 0 | ||
ignore_run_exports: | ||
# I don't really understand why these dynamic libraries aren't being linked in... | ||
- libpng | ||
- zlib | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- {{ stdlib("c") }} | ||
- cmake | ||
- make | ||
host: | ||
- libnetcdf | ||
- libnetcdf * nompi_* | ||
- libpng | ||
- zlib | ||
|
||
test: | ||
files: | ||
- test/grid.png | ||
commands: | ||
- > | ||
SQuadGen --refine_file test/grid.png --refine_level 5 | ||
--refine_type LOWCONN --resolution 30 --smooth_type SPRING | ||
--smooth_dist 3 --smooth_iter 20 --output grid.g | ||
- test -f "grid.g" | ||
|
||
about: | ||
home: https://github.com/ClimateGlobalChange/squadgen | ||
license: GPL-2.0-or-later and CUSTOM | ||
license_family: GPL | ||
license_file: | ||
- LICENSE.md | ||
- src/netcdf-cxx-4.2.COPYRIGHT | ||
summary: Spherical Quadrilateral Mesh Generator (SQuadGen) | ||
doc_url: https://github.com/ClimateGlobalChange/squadgen/blob/master/README.md | ||
dev_url: https://github.com/ClimateGlobalChange/squadgen | ||
|
||
extra: | ||
recipe-maintainers: | ||
- xylar |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.