From 8fd08ef4ac41edca59ca03ba39924ad5e4f4dbb6 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 11 Mar 2020 21:30:43 +0100 Subject: [PATCH] Download prebuilt CGNS library on MacOS --- .gitlab-ci.yml | 1 + CMakeLists.txt | 4 ++-- cmake/SuperBuild.cmake | 13 ++++++------- cmake/external_projects/cgns.cmake | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc4d724e..c50d4eb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -243,6 +243,7 @@ build_mac: -DENABLE_UNIT_TESTS=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk + -DUSE_CGNS=ON -DUSE_OCC=ON -DOCC_LIBRARY=/usr/local/opt/opencascade-7.4.0/lib/libTKernel.a -DOCC_INCLUDE_DIR=/usr/local/opt/opencascade-7.4.0/include/opencascade diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f26e0dd..fa5450aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -396,10 +396,10 @@ if(USE_CGNS) target_compile_definitions(netgen_cgns INTERFACE NG_CGNS) target_include_directories(netgen_cgns INTERFACE ${CGNS_INCLUDE_DIR}) target_link_libraries(netgen_cgns INTERFACE ${CGNS_LIBRARY}) - if(NOT WIN32) # hdf5 is statically linked into cgns in Windows binaries + if(NOT WIN32 AND NOT APPLE) # hdf5 is statically linked into cgns in Windows amd MacOS binaries find_library(HDF5_LIBRARY NAMES hdf5 hdf5_serial) target_link_libraries(netgen_cgns INTERFACE ${HDF5_LIBRARY}) - endif(NOT WIN32) + endif(NOT WIN32 AND NOT APPLE) endif(USE_CGNS) add_subdirectory(libsrc) diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index 36232df2..e28c034b 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -15,13 +15,12 @@ macro(set_vars VAR_OUT) endforeach() endmacro() ####################################################################### -if(WIN32) - set (DEPS_DOWNLOAD_URL "https://github.com/NGSolve/ngsolve_dependencies/releases/download/v1.0.0" CACHE STRING INTERNAL) - set (OCC_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/occ_win64.zip" CACHE STRING INTERNAL) - set (TCLTK_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/tcltk_win64.zip" CACHE STRING INTERNAL) - set (ZLIB_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/zlib_win64.zip" CACHE STRING INTERNAL) - set (CGNS_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/cgns_win64.zip" CACHE STRING INTERNAL) -endif(WIN32) +set (DEPS_DOWNLOAD_URL "https://github.com/NGSolve/ngsolve_dependencies/releases/download/v1.0.0" CACHE STRING INTERNAL) +set (OCC_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/occ_win64.zip" CACHE STRING INTERNAL) +set (TCLTK_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/tcltk_win64.zip" CACHE STRING INTERNAL) +set (ZLIB_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/zlib_win64.zip" CACHE STRING INTERNAL) +set (CGNS_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/cgns_win64.zip" CACHE STRING INTERNAL) +set (CGNS_DOWNLOAD_URL_MAC "${DEPS_DOWNLOAD_URL}/cgns_mac.zip" CACHE STRING INTERNAL) if(UNIX) message("Checking for write permissions in install directory...") diff --git a/cmake/external_projects/cgns.cmake b/cmake/external_projects/cgns.cmake index fa5fce72..f7e74987 100644 --- a/cmake/external_projects/cgns.cmake +++ b/cmake/external_projects/cgns.cmake @@ -13,3 +13,18 @@ if(WIN32) list(APPEND NETGEN_DEPENDENCIES project_win_cgns) endif(WIN32) +if(APPLE) + ExternalProject_Add(project_mac_cgns + URL ${CGNS_DOWNLOAD_URL_MAC} + UPDATE_COMMAND "" # Disable update + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${CMAKE_INSTALL_PREFIX} + LOG_DOWNLOAD 1 + ) + + list(APPEND NETGEN_DEPENDENCIES project_mac_cgns) + list(APPEND NETGEN_CMAKE_ARGS "-DCGNS_INCLUDE_DIR=${CMAKE_INSTALL_PREFIX}/Contents/Resources/include") + list(APPEND NETGEN_CMAKE_ARGS "-DCGNS_LIBRARY=${CMAKE_INSTALL_PREFIX}/Contents/MacOS/libcgns.dylib") +endif(APPLE)