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