diff --git a/CMakeLists.txt b/CMakeLists.txt index 4004170e..4e2909f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,9 +78,18 @@ add_library(oms::3rd::sundials::kinsol ALIAS sundials_kinsol_static) ######################################################################### ## zlib. message(STATUS "##### 3rdParty zlib") -set(ZLIB_BUILD_SHARED OFF CACHE BOOL "Disable zlib shared library") -set(ZLIB_BUILD_TESTING OFF CACHE BOOL "Disable zlib's own test suite; it registers global ctest targets (zlib_install, zlib_find_package_*, ...) that don't apply when zlib is only vendored as a static-lib dependency") -add_subdirectory(zlib EXCLUDE_FROM_ALL) +option(OM_USE_SYSTEM_ZLIB "Use system zlib" OFF) +if (OM_USE_SYSTEM_ZLIB) + set(ZLIB_USE_STATIC_LIBS ON) + find_package(ZLIB MODULE REQUIRED) + unset(ZLIB_USE_STATIC_LIBS) + add_library(zlibstatic INTERFACE) + target_link_libraries(zlibstatic INTERFACE ZLIB::ZLIB) +else () + set(ZLIB_BUILD_SHARED OFF CACHE BOOL "Disable zlib shared library") + set(ZLIB_BUILD_TESTING OFF CACHE BOOL "Disable zlib's own test suite; it registers global ctest targets (zlib_install, zlib_find_package_*, ...) that don't apply when zlib is only vendored as a static-lib dependency") + add_subdirectory(zlib EXCLUDE_FROM_ALL) +endif () add_library(oms::3rd::zlib ALIAS zlibstatic) # Expose zlibstatic as ZLIB::ZLIB so libzip's find_package(ZLIB) resolves to our # in-tree build without requiring a system zlib (e.g. Alpine, Windows). diff --git a/fmi4c/src/fmi4c.c b/fmi4c/src/fmi4c.c index f27445ab..e45d9edb 100644 --- a/fmi4c/src/fmi4c.c +++ b/fmi4c/src/fmi4c.c @@ -24,14 +24,20 @@ #include #endif -#if defined(__x86_64__) || defined(_M_X64) - #define arch_str "x86_64" +#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) #define bits_str "64" #else - #define arch_str "x86" #define bits_str "32" #endif +#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) + #define arch_str "aarch64" +#elif defined(__x86_64__) || defined(_M_X64) + #define arch_str "x86_64" +#else + #define arch_str "x86" +#endif + #if defined(__CYGWIN__) #define dirsep_str "/" #elif defined(_WIN32) @@ -44,6 +50,10 @@ #define dllext_str ".dll" #define fmi12_system_str "win" #define fmi3_system_str "windows" +#elif defined(__APPLE__) + #define dllext_str ".dylib" + #define fmi12_system_str "darwin" + #define fmi3_system_str "darwin" #else #define dllext_str ".so" #define fmi12_system_str "linux"