diff --git a/recipes/fmilib/all/conandata.yml b/recipes/fmilib/all/conandata.yml new file mode 100644 index 0000000000000..3d742017fb100 --- /dev/null +++ b/recipes/fmilib/all/conandata.yml @@ -0,0 +1,30 @@ +sources: + "2.4.1": + url: + - "https://github.com/modelon-community/fmi-library/archive/refs/tags/2.4.1.tar.gz" + sha256: "8199d3e9423494b714b9c4e42f055248457a7c9162df3d4652000aa9a10b8316" +patches: + "2.4.1": + - patch_file: "patches/2.4.1-001-static-c99snprintf.patch" + patch_description: "Always build c99snprintf as static library" + patch_type: "bugfix" + patch_source: "https://github.com/open-simulation-platform/conan-fmilibrary/blob/master/build-static-c99snprintf.patch" + - patch_file: "patches/2.4.1-002-add-minizip-tools-as-functions.patch" + patch_description: "Add minizip and miniunz as functions instead of executables" + patch_type: "conan" + - patch_file: "patches/2.4.1-003-use-expat-from-conan.patch" + patch_description: "Use expat from conan instead of internal" + patch_type: "conan" + - patch_file: "patches/2.4.1-004-use-minizip-and-zlib-from-conan.patch" + patch_description: "Use minizip (and zlib) from conan instead of internal" + patch_type: "conan" + - patch_file: "patches/2.4.1-005-ensure-conan-friendly-cmakelists.patch" + patch_description: "Do minor changes to CMakeLists for conan friendliness" + patch_type: "conan" + - patch_file: "patches/2.4.1-006-link-external-targets.patch" + patch_description: "Link external targets no longer merged in fmilib" + patch_type: "conan" + - patch_file: "patches/2.4.1-007-add-missing-stdlib.h-include.patch" + patch_description: "exit() is defined in stdlib.h" + patch_type: "bugfix" + patch_source: "https://github.com/modelon-community/fmi-library/issues/95" diff --git a/recipes/fmilib/all/conanfile.py b/recipes/fmilib/all/conanfile.py new file mode 100644 index 0000000000000..c39ef7d8b0ed5 --- /dev/null +++ b/recipes/fmilib/all/conanfile.py @@ -0,0 +1,186 @@ +from os import path +import posixpath +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.files import ( + apply_conandata_patches, export_conandata_patches, + get, copy, rm, rmdir, replace_in_file + ) +from conan.tools.scm import Version +from conan.tools.env import VirtualRunEnv +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "fmilib" + description = "C library for importing FMUs" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/modelon-community/fmi-library" + topics = ("fmi", "fmi-standard", "fmu") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_fmus": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_fmus": False + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("fmi1/1.0.1") + self.requires("fmi2/2.0.4") + if self.version >= Version("3.0a2"): + self.requires("fmi3/3.0.1") + self.requires("expat/2.6.2") + self.requires("minizip/[>1.2.13 <2]") + self.requires("zlib/[>=1.2.13 <2]") + # c99_snprintf -> should be externalised + + def validate(self): + # https://github.com/modelon-community/fmi-library/issues/93 + if self.settings.arch not in ["x86", "x86_64"] and Version(self.version).major < 3: + raise ConanInvalidConfiguration( + f"{self.ref} does not support architecture " + f"'{self.settings.arch}' on {self.settings.os}") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + + tc = CMakeToolchain(self) + tc.variables["FMILIB_BUILD_STATIC_LIB"] = not self.options.shared + tc.variables["FMILIB_BUILD_SHARED_LIB"] = self.options.shared + tc.variables["FMILIB_BUILD_TESTS"] = self.options.with_fmus + tc.variables["FMILIB_FMI_STANDARD_HEADERS"] = posixpath.join(self.source_folder, "src", "fmis").replace("\\", "/") + tc.variables["FMILIB_GENERATE_DOXYGEN_DOC"] = False + + # The variable is an option only if the following condition is true + if not self.options.shared and not self.settings.os in ["Windows", "Macos"]: + tc.variables["FMILIB_BUILD_FOR_SHARED_LIBS"] = self.options.get_safe("fPIC", False) + + if is_msvc(self): + tc.variables["FMILIB_BUILD_WITH_STATIC_RTLIB"] = is_msvc_static_runtime(self) + + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0026"] = "OLD" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0045"] = "OLD" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0046"] = "OLD" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + tc.generate() + + cd = CMakeDeps(self) + cd.set_property("expat", "cmake_target_name", "expat") + cd.set_property("minizip", "cmake_target_name", "minizip") + cd.generate() + + # This is needed if with_fmus=True + vre = VirtualRunEnv(self) + vre.generate(scope="build") + + minizip_version = str(self.dependencies["minizip"].ref.version) + get(self, + **self.dependencies["minizip"].conan_data["sources"][minizip_version], + pattern="*/minizip/*", + strip_root=True, destination=path.join(self.build_folder)) + minizip_src = path.join(self.build_folder, "contrib", "minizip") + minizip_dest = path.join(self.source_folder, "src", "ZIP", "src") + copy(self, "minizip.c", minizip_src, minizip_dest) + copy(self, "miniunz.c", minizip_src, minizip_dest) + + def _patch_sources(self): + apply_conandata_patches(self) + minizip = path.join(self.source_folder, "src", "ZIP", "src", "minizip.c") + miniunz = path.join(self.source_folder, "src", "ZIP", "src", "miniunz.c") + replace_in_file(self, minizip, "printf", "minizip_printf") + replace_in_file(self, minizip, "// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions", "") + replace_in_file(self, minizip, "// base filename follows last slash.", "") + replace_in_file(self, miniunz, "printf", "minizip_printf") + replace_in_file(self, minizip, '#include "zip.h"', + '#include "zip.h"\n static int minizip_printf( const char * format, ... ){ return 1; }') + replace_in_file(self, miniunz, '#include "unzip.h"', + '#include "unzip.h"\n static int minizip_printf( const char * format, ... ){ return 1; }') + + if Version(self.dependencies["minizip"].ref.version) < Version("1.3.0"): + replace_in_file(self, minizip, "main(argc,argv)", "minizip(argc, argv)") + replace_in_file(self, miniunz, "main(argc,argv)", "miniunz(argc, argv)") + else: + replace_in_file(self, minizip, "main(int argc", "minizip(int argc") + replace_in_file(self, miniunz, "main(int argc", "miniunz(int argc") + + def build(self): + self._patch_sources() + + copy(self, "fmiModel*.h", self.dependencies["fmi1"].cpp_info.components["modex"].includedirs[0], + path.join(self.source_folder, "src", "fmis", "FMI1")) + copy(self, "fmiPlatformTypes.h", self.dependencies["fmi1"].cpp_info.components["cosim"].includedirs[0], + path.join(self.source_folder, "src", "fmis", "FMI1")) + copy(self, "fmiFunctions.h", self.dependencies["fmi1"].cpp_info.components["cosim"].includedirs[0], + path.join(self.source_folder, "src", "fmis", "FMI1")) + copy(self, "*.h", self.dependencies["fmi2"].cpp_info.includedirs[0], + path.join(self.source_folder, "src", "fmis", "FMI2")) + + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.md", dst=path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, pattern="FMILIB_Acknowledgements.txt", + dst=path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, pattern="*.fmu", dst=path.join(self.package_folder, "res", "fmus"), + src=path.join(self.build_folder, "Testing"), keep_path=False) + + cmake = CMake(self) + cmake.install() + + copy(self, pattern="*.dll", dst=path.join(self.package_folder, "bin"), + src=path.join(self.package_folder, "lib"), keep_path=False) + rm(self, "*.dll", path.join(self.package_folder, "lib")) + + fix_apple_shared_install_name(self) + + rmdir(self, path.join(self.package_folder, "doc")) + + def package_info(self): + if self.options.shared: + self.cpp_info.libs = ["fmilib_shared"] + else: + self.cpp_info.libs = ["fmilib"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("dl") + + if self.settings.os in ["Windows"]: + self.cpp_info.system_libs.append("shlwapi") + + self.cpp_info.resdirs = ["res"] + self.cpp_info.set_property("cmake_target_aliases", ["fmilibrary::fmilibrary"]) diff --git a/recipes/fmilib/all/patches/2.4.1-001-static-c99snprintf.patch b/recipes/fmilib/all/patches/2.4.1-001-static-c99snprintf.patch new file mode 100644 index 0000000000000..e9a53020cb3cc --- /dev/null +++ b/recipes/fmilib/all/patches/2.4.1-001-static-c99snprintf.patch @@ -0,0 +1,25 @@ +From e4ad54090e455289ac23a45867b17c8dca88e704 Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Tue, 19 Sep 2023 08:59:53 +0200 +Subject: [PATCH] Link c99snprintf statically + +--- + ThirdParty/c99_snprintf/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ThirdParty/c99_snprintf/CMakeLists.txt b/ThirdParty/c99_snprintf/CMakeLists.txt +index 6f513b4..6c9b676 100644 +--- a/ThirdParty/c99_snprintf/CMakeLists.txt ++++ b/ThirdParty/c99_snprintf/CMakeLists.txt +@@ -119,7 +119,7 @@ add_definitions(${DEFINES}) + + file(WRITE ${CMAKE_BINARY_DIR}/c99snprintf_defs "${DEFINES}") + +-add_library(c99snprintf c99-snprintf_1.1/snprintf.c) ++add_library(c99snprintf STATIC c99-snprintf_1.1/snprintf.c) + + if(CYGWIN) + message("not tested") +-- +2.30.2 + diff --git a/recipes/fmilib/all/patches/2.4.1-002-add-minizip-tools-as-functions.patch b/recipes/fmilib/all/patches/2.4.1-002-add-minizip-tools-as-functions.patch new file mode 100644 index 0000000000000..688ca2bf8c98a --- /dev/null +++ b/recipes/fmilib/all/patches/2.4.1-002-add-minizip-tools-as-functions.patch @@ -0,0 +1,50 @@ +From 150530fed42e0193f0ccac73971bdce2d277b368 Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Thu, 7 Dec 2023 15:42:49 +0100 +Subject: [PATCH 1/6] add minizip tools as functions + +--- + src/ZIP/include/miniunz.h | 11 + + src/ZIP/include/minizip.h | 12 + + 2 files changed, 23 insertions(+) + create mode 100644 src/ZIP/include/miniunz.h + create mode 100644 src/ZIP/include/minizip.h + +diff --git a/src/ZIP/include/miniunz.h b/src/ZIP/include/miniunz.h +new file mode 100644 +index 0000000..d958b3d +--- /dev/null ++++ b/src/ZIP/include/miniunz.h +@@ -0,0 +1,11 @@ ++#ifndef MINIUNZ_H ++#define MINIUNZ_H ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ int miniunz(int argc , char *argv[]); /* Renamed the main function */ ++#ifdef __cplusplus ++} ++#endif ++#endif /* End of header file MINIUNZ_H */ +diff --git a/src/ZIP/include/minizip.h b/src/ZIP/include/minizip.h +new file mode 100644 +index 0000000..767dbde +--- /dev/null ++++ b/src/ZIP/include/minizip.h +@@ -0,0 +1,12 @@ ++#ifndef MINIZIP_H ++#define MINIZIP_H ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ int minizip(int argc , char *argv[]); /* Renamed the main function */ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* End of header file MINIZIP_H */ +-- +2.30.2 + diff --git a/recipes/fmilib/all/patches/2.4.1-003-use-expat-from-conan.patch b/recipes/fmilib/all/patches/2.4.1-003-use-expat-from-conan.patch new file mode 100644 index 0000000000000..f8bd979c5a82d --- /dev/null +++ b/recipes/fmilib/all/patches/2.4.1-003-use-expat-from-conan.patch @@ -0,0 +1,34 @@ +From 4f28a90cce17e37bfd93ffc647f8ce6d5578d07c Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Wed, 19 Jun 2024 14:11:41 +0200 +Subject: [PATCH] Expat + +--- + Config.cmake/fmixml.cmake | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Config.cmake/fmixml.cmake b/Config.cmake/fmixml.cmake +index ddd3c1f..e59135c 100644 +--- a/Config.cmake/fmixml.cmake ++++ b/Config.cmake/fmixml.cmake +@@ -137,6 +137,7 @@ set(FMIXMLSOURCE + src/FMI2/fmi2_xml_variable.c + ) + ++if(FALSE) + include(ExternalProject) + + # The *_POSTFIX variables are set because it makes it easier to determine the name of +@@ -214,6 +215,9 @@ endif() + set(EXPAT_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/ExpatEx/install/include) + + include_directories("${EXPAT_INCLUDE_DIRS}" "${FMILIB_THIRDPARTYLIBS}/FMI/" "${FMIXMLGENDIR}/FMI1" "${FMIXMLGENDIR}/FMI2") ++endif() ++find_package(expat REQUIRED) ++include_directories("${FMILIB_THIRDPARTYLIBS}/FMI/" "${FMIXMLGENDIR}/FMI1" "${FMIXMLGENDIR}/FMI2") + + PREFIXLIST(FMIXMLSOURCE ${FMIXMLDIR}/) + PREFIXLIST(FMIXMLHEADERS ${FMIXMLDIR}/) +-- +2.39.2 + diff --git a/recipes/fmilib/all/patches/2.4.1-004-use-minizip-and-zlib-from-conan.patch b/recipes/fmilib/all/patches/2.4.1-004-use-minizip-and-zlib-from-conan.patch new file mode 100644 index 0000000000000..923166d5be665 --- /dev/null +++ b/recipes/fmilib/all/patches/2.4.1-004-use-minizip-and-zlib-from-conan.patch @@ -0,0 +1,53 @@ +From e006938706d06379f899edbe3fc8fe2367fec1f6 Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Thu, 7 Dec 2023 15:44:54 +0100 +Subject: [PATCH 3/6] use minizip and zlib from conan + +--- + Config.cmake/fmizip.cmake | 17 +++++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/Config.cmake/fmizip.cmake b/Config.cmake/fmizip.cmake +index 091fc4d..213b5f8 100644 +--- a/Config.cmake/fmizip.cmake ++++ b/Config.cmake/fmizip.cmake +@@ -19,28 +19,30 @@ if(NOT FMIZIPDIR) + # set(DOXYFILE_EXTRA_SOURCES "${DOXYFILE_EXTRA_SOURCES} \"${FMIZIPDIR}/include\"") + + set(FMIZIP_LIBRARIES fmizip) +- +- add_subdirectory(Config.cmake/Minizip) +- +- include_directories("${FMIZIPDIR}/include" "${FMILIB_THIRDPARTYLIBS}/Minizip/minizip" "${FMILIB_THIRDPARTYLIBS}/FMI" "${FMILIB_THIRDPARTYLIBS}/Zlib/zlib-1.2.6" "${FMILibrary_BINARY_DIR}/zlib") ++ include_directories("${FMIZIPDIR}/include" "${FMILIB_THIRDPARTYLIBS}/FMI") + + set(FMIZIPSOURCE + ${FMIZIPDIR}/src/fmi_zip_unzip.c + ${FMIZIPDIR}/src/fmi_zip_zip.c ++ ${FMIZIPDIR}/src/minizip.c ++ ${FMIZIPDIR}/src/miniunz.c + ) + + set(FMIZIPHEADERS + # src/fmi_zip_unzip_impl.h + ${FMIZIPDIR}/include/FMI/fmi_zip_unzip.h + ${FMIZIPDIR}/include/FMI/fmi_zip_zip.h ++ ${FMIZIPDIR}/include/minizip.h ++ ${FMIZIPDIR}/include/miniunz.h + ) + + #include_directories("${FMILIB_THIRDPARTYLIBS}/zlib/lib/VS2005/win32") + +-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DZLIB_STATIC") ++find_package(minizip REQUIRED) ++find_package(ZLIB REQUIRED) + + add_library(fmizip ${FMILIBKIND} ${FMIZIPSOURCE} ${FMIZIPHEADERS}) + +-target_link_libraries(fmizip minizip jmutils) ++target_link_libraries(fmizip minizip ZLIB::ZLIB jmutils) + + endif(NOT FMIZIPDIR) +-- +2.30.2 + diff --git a/recipes/fmilib/all/patches/2.4.1-005-ensure-conan-friendly-cmakelists.patch b/recipes/fmilib/all/patches/2.4.1-005-ensure-conan-friendly-cmakelists.patch new file mode 100644 index 0000000000000..5aceb3534d9ab --- /dev/null +++ b/recipes/fmilib/all/patches/2.4.1-005-ensure-conan-friendly-cmakelists.patch @@ -0,0 +1,34 @@ +From 698a0134e382e3f82d8ae3f06cbbeb3ad7fc9873 Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Thu, 7 Dec 2023 15:45:38 +0100 +Subject: [PATCH 4/6] ensure conan friendly cmakelists + +--- + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b01aba5..56ca3ee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -200,7 +200,7 @@ endif() + + add_subdirectory(ThirdParty/c99_snprintf) + +-SET(CMAKE_MODULE_PATH ${FMILIBRARYHOME}/Config.cmake) ++list(APPEND CMAKE_MODULE_PATH ${FMILIBRARYHOME}/Config.cmake) + + include(jmutil) + include(fmixml) +@@ -230,7 +230,7 @@ configure_file ( + "${FMILibrary_BINARY_DIR}/fmilib_config.h" + ) + +-set(FMILIB_SHARED_SUBLIBS ${FMIXML_LIBRARIES} ${FMIZIP_LIBRARIES} ${FMICAPI_LIBRARIES} expat minizip zlib c99snprintf) ++set(FMILIB_SHARED_SUBLIBS ${FMIXML_LIBRARIES} ${FMIZIP_LIBRARIES} ${FMICAPI_LIBRARIES} c99snprintf) + set(FMILIB_SUBLIBS ${FMIIMPORT_LIBRARIES} ${JMUTIL_LIBRARIES} ${FMILIB_SHARED_SUBLIBS}) + set(FMILIB_SHARED_SRC ${FMIIMPORTSOURCE} ${JMUTILSOURCE} ${FMIIMPORTHEADERS}) + +-- +2.30.2 + diff --git a/recipes/fmilib/all/patches/2.4.1-006-link-external-targets.patch b/recipes/fmilib/all/patches/2.4.1-006-link-external-targets.patch new file mode 100644 index 0000000000000..116d32b47eb79 --- /dev/null +++ b/recipes/fmilib/all/patches/2.4.1-006-link-external-targets.patch @@ -0,0 +1,47 @@ +From 306cb206e8a62c82e6cb66e6c2e545980e1a2546 Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Thu, 7 Dec 2023 15:46:12 +0100 +Subject: [PATCH 5/6] link external targets + +--- + Config.cmake/runtime_test.cmake | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Config.cmake/runtime_test.cmake b/Config.cmake/runtime_test.cmake +index d61137f..0765268 100644 +--- a/Config.cmake/runtime_test.cmake ++++ b/Config.cmake/runtime_test.cmake +@@ -26,7 +26,7 @@ endif() + + #Create function that zipz the dummy FMUs + add_executable (compress_test_fmu_zip ${RTTESTDIR}/compress_test_fmu_zip.c) +-target_link_libraries (compress_test_fmu_zip ${FMIZIP_LIBRARIES}) ++target_link_libraries (compress_test_fmu_zip ${FMIZIP_LIBRARIES} minizip) + + set_target_properties( + jm_vector_test jm_locale_test compress_test_fmu_zip +@@ -116,7 +116,7 @@ function(compress_fmu OUTPUT_FOLDER_T MODEL_IDENTIFIER_T FILE_NAME_CS_ME_EXT_T T + + endfunction(compress_fmu) + +-set(FMILIBFORTEST fmilib) ++set(FMILIBFORTEST fmilib minizip expat) + + if(FMILIB_BUILD_SHARED_LIB AND (FMILIB_LINK_TEST_TO_SHAREDLIB OR NOT FMILIB_BUILD_STATIC_LIB)) + set(FMILIBFORTEST fmilib_shared) +@@ -128,10 +128,10 @@ endif() + message(STATUS "Tests will be linked with ${FMILIBFORTEST}" ) + + add_executable (fmi_zip_zip_test ${RTTESTDIR}/FMI1/fmi_zip_zip_test.c ) +-target_link_libraries (fmi_zip_zip_test ${FMIZIP_LIBRARIES}) ++target_link_libraries (fmi_zip_zip_test ${FMIZIP_LIBRARIES} minizip) + + add_executable (fmi_zip_unzip_test ${RTTESTDIR}/FMI1/fmi_zip_unzip_test.c ) +-target_link_libraries (fmi_zip_unzip_test ${FMIZIP_LIBRARIES}) ++target_link_libraries (fmi_zip_unzip_test ${FMIZIP_LIBRARIES} minizip) + + add_executable (fmi_import_test + ${RTTESTDIR}/fmi_import_test.c +-- +2.30.2 + diff --git a/recipes/fmilib/all/patches/2.4.1-007-add-missing-stdlib.h-include.patch b/recipes/fmilib/all/patches/2.4.1-007-add-missing-stdlib.h-include.patch new file mode 100644 index 0000000000000..8d8ce9b7910c1 --- /dev/null +++ b/recipes/fmilib/all/patches/2.4.1-007-add-missing-stdlib.h-include.patch @@ -0,0 +1,23 @@ +From af5133fa4eba5c9eb8338bb4284383183d1ef3cd Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Thu, 7 Dec 2023 15:46:39 +0100 +Subject: [PATCH 6/6] add missing stdlib.h include + +--- + Test/jm_locale_test.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Test/jm_locale_test.c b/Test/jm_locale_test.c +index 5970c65..40f711d 100644 +--- a/Test/jm_locale_test.c ++++ b/Test/jm_locale_test.c +@@ -1,5 +1,6 @@ + #include + #include ++#include + #include + #include + +-- +2.30.2 + diff --git a/recipes/fmilib/all/test_package/CMakeLists.txt b/recipes/fmilib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c2ddba84ccd74 --- /dev/null +++ b/recipes/fmilib/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES C) + +find_package(fmilib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE fmilibrary::fmilibrary) diff --git a/recipes/fmilib/all/test_package/conanfile.py b/recipes/fmilib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/fmilib/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fmilib/all/test_package/test_package.c b/recipes/fmilib/all/test_package/test_package.c new file mode 100644 index 0000000000000..a1f640d88c5c5 --- /dev/null +++ b/recipes/fmilib/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main() { + fmi_import_context_t* c = fmi_import_allocate_context(jm_get_default_callbacks()); + int e = (c == NULL) ? 1 : 0; + fmi_import_free_context(c); + return e; +} diff --git a/recipes/fmilib/config.yml b/recipes/fmilib/config.yml new file mode 100644 index 0000000000000..3dd5d6d4b289d --- /dev/null +++ b/recipes/fmilib/config.yml @@ -0,0 +1,3 @@ +versions: + "2.4.1": + folder: all