https://github.com/agahkarakuzu/r2017b-engine-cmake-example
Minimum viable example on compiling MATLAB API for C++ using CMake.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.0%) to scientific vocabulary
Repository
Minimum viable example on compiling MATLAB API for C++ using CMake.
Basic Info
- Host: GitHub
- Owner: agahkarakuzu
- Language: CMake
- Default Branch: master
- Size: 374 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Compile a simple code that uses MATLAB API for C++ using CMake
- Matlab version: R2017b (and newer)
- CMake version: 3.13.4
- gcc and g++ versions: 4.9 (and proper versions corresponding to MATLAB versions > R2017b)
FindMatlab.cmake implementation of the CMake version 3.13.4 assumes that MATLAB API for C++ is available as of R2018a. As described by the official release notes, MATLAB Engine API for C++ is available as of R2017b. The same R2018a assumption is sustained in the following CMake version as well.
If your MATLAB version is R2017b
Just uncomment this line in CmakeLists.txt.
This will use the FindMatlab.cmake present in the folder instead of the one located at /usr/local/share/cmake-3.13/Modules/. The file is originally copied from the next CMake version and neccesary changes were made to link C++ API libraries from R2017b to the project.
You can simply follow thsese steps for building:
- Navigate to the
r2017b-engine-cmake-examplefolder:
cd /r2017b-engine-cmake-example
* Ensure that you are using correct compilers:
export CC = /usr/bin/gcc-4.9
export CXX = /usr/bin/g++-4.9
You can change gcc/g++ versions depending on your MATLAB version.
- Build:
mkdir build
cd build
cmake ..
make
If runs smoothly, this will build example and create an executable EngineExampleCpp in /build directory.
- Run:
./EngineExampleCpp
- Expected output:
Square root of -2 is 0 + 1.41421i
Square root of 2 is 1.41421 + 0i
Square root of 6 is 2.44949 + 0i
Square root of 8 is 2.82843 + 0i
If you are running into issues, you can try adding /usr/lib/x86_64-linux-gnu/libstdc++.so.6 to LD_PRELOAD in ~/.bashrc. Note that this is a bit dirty hack.
export LD_PRELOAD = "/usr/lib/x86_64-linux-gnu/libstdc++.so.6:$LD_PRELOAD"
Owner
- Name: Agah
- Login: agahkarakuzu
- Kind: user
- Location: Montreal
- Company: @neuropoly @qMRLab @neurolibre
- Website: https://agahkarakuzu.github.io
- Twitter: agahkarakuzu
- Repositories: 114
- Profile: https://github.com/agahkarakuzu
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0