Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use suitesparse on Windows #10

Merged
merged 3 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .ci_support/win_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ libpng:
- '1.6'
libtiff:
- 4.1.0
metis:
- 5.1.0
pin_run_as_build:
fftw:
max_pin: x
Expand All @@ -23,6 +25,8 @@ pin_run_as_build:
max_pin: x
zlib:
max_pin: x.x
suitesparse:
- '5.4'
target_platform:
- win-64
zlib:
Expand Down
5 changes: 4 additions & 1 deletion recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cmake -G"NMake Makefiles" ^
-DUSE_CUDA=0 ^
-DUSE_OPENMESH=0 ^
-DUSE_VTK=0 ^
-DUSE_SUITESPARSE=0 ^
-DUSE_SUITESPARSE=1 ^
-DUSE_FOX=0 ^
-DBUILD_FOX=0 ^
-DUSE_FFTW=1 ^
Expand All @@ -38,6 +38,9 @@ if errorlevel 1 exit 1
nmake
if errorlevel 1 exit 1

nmake test
if errorlevel 1 exit 1

nmake install
if errorlevel 1 exit 1

Expand Down
7 changes: 5 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ package:
source:
url: https://github.com/berkels/{{ name }}/archive/v{{ version }}.tar.gz
sha256: ae2c867cc721e0dccc0be2e57d03251f26a084ea522eb456efe39994dee0f0ad
patches:
- quocmesh.patch

build:
number: 0
number: 1

requirements:
build:
Expand All @@ -25,7 +27,8 @@ requirements:
- zlib
- bzip2 # [not win]
- libtiff
- suitesparse # [not win]
- suitesparse
- metis # [win]
run:

test:
Expand Down
76 changes: 76 additions & 0 deletions recipe/quocmesh.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
diff --git a/quocmesh/CMakeLists.txt b/quocmesh/CMakeLists.txt
index 6d3ec6c..338e058 100644
--- a/quocmesh/CMakeLists.txt
+++ b/quocmesh/CMakeLists.txt
@@ -1003,34 +1003,19 @@ ENDIF ( )
#! \cmakeoption{Use SuiteSparse,ON}
OPTION ( USE_SUITESPARSE "" OFF )
IF ( USE_SUITESPARSE AND BLAS_FOUND AND LAPACK_FOUND )
- IF ( NOT WIN32 )
- FIND_PACKAGE ( SUITESPARSE )
- IF ( SUITESPARSE_FOUND OR SuiteSparse_FOUND )
- IF ( SUITESPARSE_FOUND )
- INCLUDE_DIRECTORIES ( ${SUITESPARSE_INCLUDE_DIRS} )
- LINK_DIRECTORIES ( ${SUITESPARSE_LIBRARY_DIR} )
- SET ( SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${SUITESPARSE_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} )
- ELSE ( )
- INCLUDE_DIRECTORIES ( ${SuiteSparse_INCLUDE_DIRS} )
- SET ( SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${SuiteSparse_LIBRARIES} )
- ENDIF ( )
- ADD_COMPILE_DEFINITIONS ( USE_EXTERNAL_SUITESPARSE )
+ FIND_PACKAGE ( SUITESPARSE )
+ IF ( SUITESPARSE_FOUND OR SuiteSparse_FOUND )
+ IF ( SUITESPARSE_FOUND )
+ INCLUDE_DIRECTORIES ( ${SUITESPARSE_INCLUDE_DIRS} )
+ LINK_DIRECTORIES ( ${SUITESPARSE_LIBRARY_DIR} )
+ SET ( SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${SUITESPARSE_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} )
ELSE ( )
- MESSAGE ( FATAL_ERROR "Could NOT find SUITESPARSE" )
+ INCLUDE_DIRECTORIES ( ${SuiteSparse_INCLUDE_DIRS} )
+ SET ( SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${SuiteSparse_LIBRARIES} )
ENDIF ( )
+ ADD_COMPILE_DEFINITIONS ( USE_EXTERNAL_SUITESPARSE )
ELSE ( )
- # This block links SuiteSparse on Windows
- # Download from: https://github.com/jlblancoc/suitesparse-metis-for-windows
- # Build with MinGW or MSVC and set SuiteSparse_DIR to the install directory
- SET ( SuiteSparse_USE_LAPACK_BLAS ON )
- FIND_PACKAGE ( SuiteSparse NO_MODULE )
- IF ( SuiteSparse_FOUND )
- INCLUDE ( ${USE_SuiteSparse} )
- SET ( SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${SuiteSparse_LIBRARIES} ) # blas and lapack should be included with SuiteSparseWindows
- ADD_COMPILE_DEFINITIONS ( USE_EXTERNAL_SUITESPARSE )
- ELSE ( )
- MESSAGE ( STATUS "Could NOT find SUITESPARSE (hint: did you forget to specify SuiteSparse_DIR?)")
- ENDIF ( )
+ MESSAGE ( FATAL_ERROR "Could NOT find SUITESPARSE" )
ENDIF ( )
ELSE ( )
IF ( USE_SUITESPARSE AND ( NOT BLAS_FOUND ) )
diff --git a/quocmesh/cmake/FindSUITESPARSE.cmake b/quocmesh/cmake/FindSUITESPARSE.cmake
index 4397b50..0fa99aa 100644
--- a/quocmesh/cmake/FindSUITESPARSE.cmake
+++ b/quocmesh/cmake/FindSUITESPARSE.cmake
@@ -56,7 +56,7 @@ IF( WIN32 )
# Find cholmod part of the suitesparse library collection

FIND_PATH( CHOLMOD_INCLUDE_DIR cholmod.h
- PATHS "C:\\libs\\win32\\SuiteSparse\\Include" )
+ PATHS "C:\\libs\\win32\\SuiteSparse\\Include" "$ENV{CONDA_PREFIX}/../_h_env/Library/include/suitesparse" )

# Add cholmod include directory to collection include directories
IF ( CHOLMOD_INCLUDE_DIR )
@@ -67,11 +67,11 @@ IF( WIN32 )
# find path suitesparse library
FIND_PATH( SUITESPARSE_LIBRARY_DIRS
amd.lib
- PATHS "C:\\libs\\win32\\SuiteSparse\\libs" )
+ PATHS "C:\\libs\\win32\\SuiteSparse\\libs" "$ENV{CONDA_PREFIX}/../_h_env/Library/lib/" )

# if we found the library, add it to the defined libraries
IF ( SUITESPARSE_LIBRARY_DIRS )
- LIST ( APPEND SUITESPARSE_LIBRARIES optimized;amd;optimized;camd;optimized;ccolamd;optimized;cholmod;optimized;colamd;optimized;metis;optimized;spqr;optimized;umfpack;debug;amdd;debug;camdd;debug;ccolamdd;debug;cholmodd;debug;spqrd;debug;umfpackd;debug;colamdd;debug;metisd;optimized;blas;optimized;libf2c;optimized;lapack;debug;blasd;debug;libf2cd;debug;lapackd )
+ LIST ( APPEND SUITESPARSE_LIBRARIES optimized;amd;optimized;camd;optimized;ccolamd;optimized;cholmod;optimized;colamd;optimized;metis;optimized;spqr;optimized;umfpack;debug;amdd;debug;camdd;debug;ccolamdd;debug;cholmodd;debug;spqrd;debug;umfpackd;debug;colamdd;debug;metisd;optimized;blas;optimized;lapack;debug;blasd;debug;lapackd )
ENDIF( SUITESPARSE_LIBRARY_DIRS )

ELSE( WIN32 )