Skip to content
Snippets Groups Projects
Commit c99396d4 authored by Raghunandan Netrapalli Madhusudhan's avatar Raghunandan Netrapalli Madhusudhan
Browse files

recipes suitable for cross compilation

parent 5bc05578
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ class FmiConan(ConanFile):
def build(self):
if self.settings.os == "Windows":
cmake = CMake(self, generator="MSYS Makefiles")
cmake = CMake(self)
else:
cmake = CMake(self)
cmake.configure(source_folder=self.name,
......
diff --git a/src/Import/src/FMI1/fmi1_import_capi.c b/src/Import/src/FMI1/fmi1_import_capi.c
index 842c998..eeff2b5 100644
--- a/src/Import/src/FMI1/fmi1_import_capi.c
+++ b/src/Import/src/FMI1/fmi1_import_capi.c
@@ -67,18 +67,8 @@ jm_status_enu_t fmi1_import_create_dllfmu(fmi1_import_t* fmu, fmi1_callback_func
return jm_status_error;
}
- if(jm_portability_set_current_working_directory(dllDirPath) != jm_status_success) {
- jm_log_fatal(fmu->callbacks, module, "Could not change to the DLL directory %s", dllDirPath);
- if(ENOENT == errno)
- jm_log_fatal(fmu->callbacks, module, "The FMU contains no binary for this platform.");
- else
- jm_log_fatal(fmu->callbacks, module, "System error: %s", strerror(errno));
- }
- else {
/* Allocate memory for the C-API struct */
fmu -> capi = fmi1_capi_create_dllfmu(fmu->callbacks, dllFileName, modelIdentifier, callBackFunctions, standard);
- }
-
/* Load the DLL handle */
if (fmu -> capi) {
diff --git a/src/Import/src/FMI2/fmi2_import_capi.c b/src/Import/src/FMI2/fmi2_import_capi.c
index e794775..ffca14d 100644
--- a/src/Import/src/FMI2/fmi2_import_capi.c
+++ b/src/Import/src/FMI2/fmi2_import_capi.c
@@ -88,18 +88,8 @@ jm_status_enu_t fmi2_import_create_dllfmu(fmi2_import_t* fmu, fmi2_fmu_kind_enu_
callBackFunctions = &defaultCallbacks;
}
- if(jm_portability_set_current_working_directory(dllDirPath) != jm_status_success) {
- jm_log_fatal(fmu->callbacks, module, "Could not change to the DLL directory %s", dllDirPath);
- if(ENOENT == errno)
- jm_log_fatal(fmu->callbacks, module, "The FMU contains no binary for this platform.");
- else
- jm_log_fatal(fmu->callbacks, module, "System error: %s", strerror(errno));
- }
- else {
/* Allocate memory for the C-API struct */
fmu -> capi = fmi2_capi_create_dllfmu(fmu->callbacks, dllFileName, modelIdentifier, callBackFunctions, fmuKind);
- }
-
/* Load the DLL handle */
if (fmu -> capi) {
diff --git a/src/Util/include/JM/jm_portability.h b/src/Util/include/JM/jm_portability.h
index 82e472a..605dff9 100644
--- a/src/Util/include/JM/jm_portability.h
+++ b/src/Util/include/JM/jm_portability.h
@@ -65,6 +65,7 @@ jm_status_enu_t jm_portability_get_current_working_directory(char* buffer, size_
jm_status_enu_t jm_portability_set_current_working_directory(const char* cwd);
/** \brief Get system-wide temporary directory */
+FMILIB_EXPORT
const char* jm_get_system_temp_dir();
/**
@@ -118,6 +119,7 @@ jm_status_enu_t jm_mkdir(jm_callbacks* cb, const char* dir);
/**
\brief Remove directory and all it contents.
*/
+FMILIB_EXPORT
jm_status_enu_t jm_rmdir(jm_callbacks* cb, const char* dir);
/**
diff --git a/src/Import/src/FMI1/fmi1_import_capi.c b/src/Import/src/FMI1/fmi1_import_capi.c
index 842c998..eeff2b5 100644
--- a/src/Import/src/FMI1/fmi1_import_capi.c
+++ b/src/Import/src/FMI1/fmi1_import_capi.c
@@ -67,18 +67,8 @@ jm_status_enu_t fmi1_import_create_dllfmu(fmi1_import_t* fmu, fmi1_callback_func
return jm_status_error;
}
- if(jm_portability_set_current_working_directory(dllDirPath) != jm_status_success) {
- jm_log_fatal(fmu->callbacks, module, "Could not change to the DLL directory %s", dllDirPath);
- if(ENOENT == errno)
- jm_log_fatal(fmu->callbacks, module, "The FMU contains no binary for this platform.");
- else
- jm_log_fatal(fmu->callbacks, module, "System error: %s", strerror(errno));
- }
- else {
/* Allocate memory for the C-API struct */
fmu -> capi = fmi1_capi_create_dllfmu(fmu->callbacks, dllFileName, modelIdentifier, callBackFunctions, standard);
- }
-
/* Load the DLL handle */
if (fmu -> capi) {
diff --git a/src/Import/src/FMI2/fmi2_import_capi.c b/src/Import/src/FMI2/fmi2_import_capi.c
index e794775..ffca14d 100644
--- a/src/Import/src/FMI2/fmi2_import_capi.c
+++ b/src/Import/src/FMI2/fmi2_import_capi.c
@@ -88,18 +88,8 @@ jm_status_enu_t fmi2_import_create_dllfmu(fmi2_import_t* fmu, fmi2_fmu_kind_enu_
callBackFunctions = &defaultCallbacks;
}
- if(jm_portability_set_current_working_directory(dllDirPath) != jm_status_success) {
- jm_log_fatal(fmu->callbacks, module, "Could not change to the DLL directory %s", dllDirPath);
- if(ENOENT == errno)
- jm_log_fatal(fmu->callbacks, module, "The FMU contains no binary for this platform.");
- else
- jm_log_fatal(fmu->callbacks, module, "System error: %s", strerror(errno));
- }
- else {
/* Allocate memory for the C-API struct */
fmu -> capi = fmi2_capi_create_dllfmu(fmu->callbacks, dllFileName, modelIdentifier, callBackFunctions, fmuKind);
- }
-
/* Load the DLL handle */
if (fmu -> capi) {
diff --git a/src/Util/include/JM/jm_portability.h b/src/Util/include/JM/jm_portability.h
index 82e472a..605dff9 100644
--- a/src/Util/include/JM/jm_portability.h
+++ b/src/Util/include/JM/jm_portability.h
@@ -65,6 +65,7 @@ jm_status_enu_t jm_portability_get_current_working_directory(char* buffer, size_
jm_status_enu_t jm_portability_set_current_working_directory(const char* cwd);
/** \brief Get system-wide temporary directory */
+FMILIB_EXPORT
const char* jm_get_system_temp_dir();
/**
@@ -118,6 +119,7 @@ jm_status_enu_t jm_mkdir(jm_callbacks* cb, const char* dir);
/**
\brief Remove directory and all it contents.
*/
+FMILIB_EXPORT
jm_status_enu_t jm_rmdir(jm_callbacks* cb, const char* dir);
/**
......@@ -39,7 +39,7 @@ class MantleAPIConan(ConanFile):
if self.settings.os == "Windows":
del self.options.fPIC
if not self.options.cmake_generator:
self.options.cmake_generator = self.env.get("CONAN_CMAKE_GENERATOR", "MSYS Makefiles")
self.options.cmake_generator = self.env.get("CONAN_CMAKE_GENERATOR", "Unix Makefiles")
else:
if not self.options.cmake_generator:
self.options.cmake_generator = self.env.get("CONAN_CMAKE_GENERATOR", "Unix Makefiles")
......
......@@ -51,7 +51,7 @@ class YaseConan(ConanFile):
def build(self):
if self.settings.os == "Windows":
cmake = CMake(self, generator="MSYS Makefiles")
cmake = CMake(self)
cmake.configure(source_folder=self.name, defs={"Yase_BUILD_TESTS":False})
else:
cmake = CMake(self)
......@@ -60,7 +60,7 @@ class YaseConan(ConanFile):
def package(self):
if self.settings.os == "Windows":
cmake = CMake(self, generator="MSYS Makefiles")
cmake = CMake(self)
else:
cmake = CMake(self)
cmake.install()
......
......@@ -47,14 +47,14 @@ class OpenSimulationInterfaceConan(ConanFile):
return "build_subfolder"
def requirements(self):
if self.settings.os == "Linux":
self.requires("protobuf/3.20.0@")
self.options["protobuf"].shared = True
# if self.settings.os == "Linux":
self.requires("protobuf/3.20.0@")
self.options["protobuf"].shared = True
def build_requirements(self):
if self.settings.os == "Windows":
self.requires("protobuf/3.20.0@")
self.options["protobuf"].shared = True
# self.requires("protobuf/3.20.0@")
# self.options["protobuf"].shared = True
self.tool_requires("protobuf/3.20.0@")
self.options["protobuf"].shared = True
......@@ -69,21 +69,28 @@ class OpenSimulationInterfaceConan(ConanFile):
def build(self):
if self.settings.os == "Windows":
cmake = CMake(self, generator="MSYS Makefiles")
PROTOBUF_PROTOC_EXECUTABLE = os.path.join(self.deps_cpp_info["protobuf"].bin_paths[0], "protoc")
PROTOBUF_LIBRARY = os.path.join(self.deps_cpp_info["protobuf"].lib_paths[0], "libprotobuf.dll.a")
print("protobuf_protoc_exec: ", PROTOBUF_PROTOC_EXECUTABLE)
print("PROTOBUF_LIBRARY: ", PROTOBUF_LIBRARY)
print("PROTOBUF_INCLUDE_DIR: ", self.deps_cpp_info["protobuf"].include_paths[0])
cmake = CMake(self, generator="Unix Makefiles")
cmake.configure(source_folder=self._repo_source,
defs={"CMAKE_BUILD_TYPE":"Release",
"CMAKE_INSTALL_PREFIX":"osi3.5.0"})
"PROTOBUF_INCLUDE_DIR":self.deps_cpp_info["protobuf"].include_paths[0],
"CMAKE_INSTALL_PREFIX":"osi3.5.0",
"PROTOBUF_LIBRARY":PROTOBUF_LIBRARY})
else:
cmake = CMake(self)
PROTOBUF_PROTOC_EXECUTABLE = os.path.join(self.deps_cpp_info["protobuf"].bin_paths[0], "protoc")
PROTOBUF_LIBRARY = os.path.join(self.deps_cpp_info["protobuf"].lib_paths[0], "libprotobuf.so")
cmake.configure(source_folder=self._repo_source,
defs={"CMAKE_GENERATOR_ARG":"Unix Makefiles",
"CMAKE_BUILD_TYPE":"Release",
"CMAKE_INSTALL_PREFIX":"osi3.5.0",
"PROTOBUF_INCLUDE_DIR":self.deps_cpp_info["protobuf"].include_paths[0],
"PROTOBUF_PROTOC_EXECUTABLE":PROTOBUF_PROTOC_EXECUTABLE,
"PROTOBUF_LIBRARY":PROTOBUF_LIBRARY})
defs={"CMAKE_GENERATOR_ARG":"Unix Makefiles",
"CMAKE_BUILD_TYPE":"Release",
"CMAKE_INSTALL_PREFIX":"osi3.5.0",
"PROTOBUF_INCLUDE_DIR":self.deps_cpp_info["protobuf"].include_paths[0],
"PROTOBUF_PROTOC_EXECUTABLE":PROTOBUF_PROTOC_EXECUTABLE,
"PROTOBUF_LIBRARY":PROTOBUF_LIBRARY})
cmake.build()
cmake.install()
......
......@@ -49,10 +49,10 @@ class OpenScenarioApiConan(ConanFile):
def _patch_sources(self):
os.chdir(self.name)
if self.settings.os == "Windows":
os.system('git apply ../patches/v1.3.1.patch')
else:
os.system('git apply ../patches/rpath.patch')
# if self.settings.os == "Windows":
# os.system('git apply ../patches/v1.3.1.patch')
# else:
os.system('git apply ../patches/rpath.patch')
def source(self):
url, sha256 = self._get_url_sha()
......@@ -66,8 +66,8 @@ class OpenScenarioApiConan(ConanFile):
def build(self):
if self.settings.os == "Windows":
os.chdir(os.path.join(self._repo_source, "cpp"))
os.system('cmake -Wno-dev --preset="MSYS-shared-release"')
os.system('cmake --build --preset="Build-MSYS-shared-release"')
os.system('cmake -G "Unix Makefiles" -Wno-dev ')
os.system('cmake --build .')
else:
os.chdir(self._artifact_path)
os.system('chmod +x generateLinux.sh')
......
......@@ -39,7 +39,7 @@ class UnitsConan(ConanFile):
del self.options.fPIC
if not self.options.cmake_generator:
self.options.cmake_generator = self.env.get(
"CONAN_CMAKE_GENERATOR", "MSYS Makefiles")
"CONAN_CMAKE_GENERATOR", "Unix Makefiles")
else:
if not self.options.cmake_generator:
self.options.cmake_generator = self.env.get(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment