-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
re-organize project and add Octave-version #7
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated CMakeLists.txt to include new source files for functions: func_getmultichannelscalingtilecomposite, func_getinfo, func_getmetadataxml, and func_getscaling. Adjusted lib_VERSION_EXT for formatting consistency. In mexFunctions.cpp, added new include directives and updated funcItems array with new functions. Added implementations for new functions in respective .cpp and .h files.
Updated CMakeLists.txt to include new source and header files. Added new include directives and removed old ones in mexFunctions.cpp. Updated function mappings in mexFunctions.cpp. Added new files for Close, GetDefaultDisplaySettings, GetSingleChannelScalingTileComposite, and GetSubBlock functions. Implemented argument checking and execution functions for the new features.
Updated CMakeLists.txt to include new source files and headers for `func_createcziwriter`, `func_addsubblock`, and `func_closecziwriter`. Included new headers and removed commented-out includes in `mexFunctions.cpp`. Uncommented `CreateCziWriter`, `AddSubBlock`, and `CloseCziWriter` entries in `CMexFunctions::funcItems`. Added `func_addsubblock.cpp` and `func_addsubblock.h` for `MexFunction_AddSubBlock_CheckArguments` and `MexFunction_AddSubBlock_Execute`. Added `func_closecziwriter.cpp` and `func_closecziwriter.h` for `MexFunction_CloseCziWriter_CheckArguments` and `MexFunction_CloseCziWriter_Execute`. Added `func_createcziwriter.cpp` and `func_createcziwriter.h` for `MexFunction_CreateCziWriter_CheckArguments` and `MexFunction_CreateCziWriter_Execute`.
Added a static boolean `gIsInitialized` in `mex_function.cpp` to track initialization status. Introduced a static `Initialize` function to register a shutdown function using `mexAtExit`. Modified `mexFunction` to call `Initialize` and set `gIsInitialized` to true if not already initialized. Declared `OnShutdown` in `function.h` and implemented it in `function.cpp` to remove all instances of `CziReaderManager` and `CziWriterManager`. Included necessary headers for `CziWriterManager` and `CziReaderManager` in `function.cpp`. Removed commented-out includes for `func_addsubblock.h` and `func_closecziwriter.h` in `mexFunctions.cpp` to maintain code clarity.
Replaced `#include` directive for `mexlibczi_Config.h` with `lib_config.h`. Updated version string construction to use `LIB_VERSION_*` macros instead of `MEXLIBCZI_VERSION_*` macros. This change reflects a shift from using `mexlibczi` to `lib` for configuration and version information.
The commented-out switch-case blocks in the `matlabCreateNumericMatrixReal` and `matlabCreateNumericArrayReal` functions have been removed. These blocks were previously used to convert `AppExtensionClassId` to `mxClassID`, but this functionality is now encapsulated in the `AppExtensionClassIdToMxClassId` function. The removal of these comments helps to clean up the code and improve readability.
Added `stddef.h` to `app_api.h` for common type definitions. Reformatted function pointer declarations in `app_api.h` for consistency. Corrected case-sensitive include directive in `libraryinfo.cpp`.
Added an `endif()` statement to close the `if(WIN32)` block. Introduced a new `if(UNIX)` block to set `POSITION_INDEPENDENT_CODE` to `ON` for the `lib` target. This ensures the static library is compiled with Position Independent Code on UNIX systems, which is necessary for creating shared libraries.
Updated `CMakeLists.txt` to include `OctaveOct` subdirectory and set up Octave configuration executable path. Defined new shared library `OctaveOct` with its source files and compilation properties. Corrected function names in `app_api_implementation.c` from `matlabMaxGetInfinityDouble` and `matlabMaxGetNaNDouble` to `matlabMexGetInfinityDouble` and `matlabMexGetNaNDouble`. Updated function pointers in `IAppExtensionFunctions` structure accordingly. Added `octlibczi.cpp` with functions for handling Octave data types and operations, including a new `IAppExtensionFunctions` structure for Octave. Introduced new Octave function `helloworld` in `helloworld.cc` to print input/output argument counts and return empty matrices. Included new Octave function `octlibczi` in `octlibczi.cpp` to process input arguments and print input/output argument counts.
Added a call to `mexAtExit(pfn_OnShutdown);` in `Initialize()` to ensure `pfn_OnShutdown` is executed on program exit, providing a clean shutdown process.
Updated the `Parameter` type to `typedef void* Parameter` and refactored function signatures across multiple files to use `Parameter` by value instead of by pointer. This change affects functions in `app_api.h`, `app_api_implementation.c`, `octavelibczi.c`, `mex_function.cpp`, `function.h`, `function.cpp`, `func_getversion.cpp`, `CziReader` class, `CArgsUtils` class, `argsutils.h`, `utils.cpp`, `utils.h`, `mexFunctions.h`, and `exportedfunctions.cpp`. Key changes include: - Updated function signatures to use `Parameter` directly. - Modified method signatures in `CziReader.h` and `CziReader` methods. - Adjusted `CArgsUtils` methods to handle `Parameter` by value. - Updated `mexFunction` to reinterpret `plhs` and `prhs` as `Parameter` arrays. - Simplified memory management and improved code safety by avoiding raw pointers.
Refactored code to replace matlabMex with octaveMex function names. Updated Initialize function to dynamically load libmexlibczi.dll from the same directory as the MEX file. Added IsDynamicLibraryLoaded function to check if the library and its functions are loaded successfully. Updated mexFunction to initialize the library only once and check if the dynamic library is loaded before proceeding. Removed old and commented-out code. Updated g_appExtensionFunctions struct to use new octaveMex function names. Added error handling to ensure appropriate error messages are displayed if the library fails to load.
Comment out static linking options in CMakeLists.txt. Add Windows-specific includes and DllMain definition in DllMain.cpp. Define DLLEXPORT macro in exportedfunctions.cpp for cross-compiler compatibility.
The `build.yml` file has been updated to install and configure Octave on a Windows runner in a GitHub Actions workflow. The Octave CLI link is now captured in both Unix and Windows path formats, with the Windows path exported to the `OCTAVECLI_LINK` environment variable. A comment was added to explain the use of `cmd.exe` for executing the `.lnk` file. The command to compile the Octave mex-file now utilizes the `OCTAVECLI_LINK` environment variable. Removed the old method of setting the `OCTAVECLI_LINK` environment variable and the previous way of echoing the path.
Reintroduced and reordered steps for installing Octave and building Octave mex-files on Windows runners. The installation uses `choco install octave` and locates the Octave CLI executable link in the Windows Start Menu. The build step compiles the mex file within Octave using the found executable link, ensuring proper execution on Windows runners.
Updated the DllName variable in the Initialize function from a WCHAR array to a char array. This change modifies the data type used to store the DLL name from a wide character string to a regular character string, likely to handle the DLL name as a standard string.
Introduce conditional compilation for non-Windows platforms by defining _GNU_SOURCE and including necessary headers (dlfcn.h, limits.h, stdlib.h, unistd.h) when _WIN32 is not defined. This enhances compatibility and functionality for Unix-like systems.
Changed the type of the `dl_info` variable from `Dl_info` to `struct Dl_info` in the `Initialize` function. This ensures compatibility and correctness with the `dladdr` function call.
Moved `#define _GNU_SOURCE` to the top of the file to ensure GNU-specific features are available before any includes. Reordered `#include` directives to avoid potential conflicts by placing them after platform-specific headers. Added a new static function `octaveMexIsNanOrInfDouble` to check if a double value is NaN or infinity using `mxIsNaN` and `mxIsInf`.
Replaced fixed size allocation with dynamic calculation for `path` memory, based on the lengths of `dl_info.dli_fname` and `DllName`. This change reduces the risk of buffer overflow and improves memory efficiency. Also, replaced `strncpy` with `strcpy` as the new allocation guarantees sufficient space for the concatenated string.
The build script for the Octave mex-file on Linux has been updated to include a command that checks the Octave version (`octave --version`). This command is executed before the existing command that compiles the mex-file (`octave --eval "mkoctfile --mex octavelibczi.c"`).
The installation command for Octave on Linux has been updated to include the `-y -q` flags. These flags ensure a non-interactive and quieter installation process by automatically answering 'yes' to prompts and suppressing output.
The step to upload Octave-mex artifacts has been removed from the GitHub Actions workflow configuration file (build.yml). This step was previously conditional, running only on Windows runners, and used the actions/upload-artifact@v4 action to upload artifacts from a specified path with a given name.
The code changes in the `build.yml` file modify the naming convention for a Linux MATLAB artifact. Specifically, the artifact name is updated from `MEXlibCZI-linux-x64-$(git describe --always)` to `MATLAB-MEXlibCZI-linux-x64-$(git describe --always)`. This change ensures that the artifact name now includes a clearer indication that it is related to MATLAB.
Corrected the comment syntax from `#` to `REM` in the batch script for copying `libmexlibczi.dll`. This ensures proper recognition and execution of the script.
Replaced the `cp` command with the `copy` command in `build.yml` to ensure compatibility with Windows environments. This change ensures the `libmexlibczi.dll` file is correctly copied to the `%GITHUB_WORKSPACE%\OctaveMex` directory.
Renamed project versioning variables from `MEXCZI_*` to `MEXLIBCZI_*` to reflect the updated project scope. Updated `CMakeLists.txt` to include project version and description. Added a new CMake option `MEXLIBCZI_BUILD_MATLABMEX` to control the MATLAB mex extension build. Removed the inclusion of `libCZI.cmake` module. Nested MATLAB library setup logic under the new option and moved related debugging messages inside the conditional block. Removed commented-out Octave configuration code. Moved `add_subdirectory` command for MATLAB mex file inside the conditional block. Updated versioning variables in the `else()` block and the `get_version.sh` script to use the new `MEXLIBCZI_*` variables.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.