Skip to content

Commit

Permalink
Updated the Mac mex compilation to use the cmake library
Browse files Browse the repository at this point in the history
  • Loading branch information
MattHazard committed Nov 21, 2024
1 parent 57df0b7 commit 675db66
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions mexSrc/compile_getImageSizeMex.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
if ~exist(releaseFolder, 'dir')
mkdir(releaseFolder);
end
mex -v -outdir ../mac -output getImageSizeMex.mexw64 CXX="/usr/local/bin/g++-13" CXXOPTIMFLAGS='-O3 -DNDEBUG' LDOPTIMFLAGS='-O3 -DNDEBUG' CXXFLAGS='-fno-common -arch x86_64 -mmacosx-version-min=10.15 -fexceptions -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -O3 -fopenmp -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -DMATLAB_MEX_FILE' LDFLAGS='$LDFLAGS -O3 -fopenmp' '-I/usr/local/include/' /usr/local/opt/gcc/lib/gcc/current/libstdc++.a -ltiff getimagesizemex.cpp ../src/helperfunctions.cpp
mex -v -outdir ../mac -output getImageSizeMex.mexw64 CXX="/usr/local/bin/g++-13" CXXOPTIMFLAGS='-O3 -DNDEBUG' LDOPTIMFLAGS='-O3 -DNDEBUG' CXXFLAGS='-fno-common -arch x86_64 -mmacosx-version-min=10.15 -fexceptions -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -O3 -fopenmp -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -DMATLAB_MEX_FILE' LDFLAGS='$LDFLAGS -O3 -fopenmp' '-I/Users/abcx86mac/c-tiff/jenkinsBuild/install/include' -L'/Users/abcx86mac/c-tiff/jenkinsBuild/install/lib' /usr/local/opt/gcc/lib/gcc/current/libstdc++.a -lcppTiff getimagesizemex.cpp

% We need to change all the current paths to be relative to the mex file
%system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libstdc++.6.dylib @loader_path/libstdc++.6.0.32.dylib ../mac/getImageSizeMex.mexmaci64');
system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libgomp.1.dylib @loader_path/libgomp.1.dylib ../mac/getImageSizeMex.mexmaci64');
system('install_name_tool -change @rpath/libtiff.6.dylib @loader_path/libtiff.6.0.1.dylib ../mac/getImageSizeMex.mexmaci64');
system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib @loader_path/libgcc_s.1.1.0.dylib ../mac/getImageSizeMex.mexmaci64');

system('install_name_tool -change @rpath/libcppTiff.dylib @loader_path/libcppTiff.dylib ../mac/getImageSizeMex.mexmaci64');

system('chmod 777 ../mac/getImageSizeMex.mexmaci64');
elseif ispc
setenv('MW_MINGW64_LOC','C:/mingw64');
Expand Down
4 changes: 2 additions & 2 deletions mexSrc/compile_parallelReadTiff.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
if ~exist(releaseFolder, 'dir')
mkdir(releaseFolder);
end
mex -v -outdir ../mac -output parallelReadTiff.mexw64 CXX="/usr/local/bin/g++-13" CXXOPTIMFLAGS='-O3 -DNDEBUG' LDOPTIMFLAGS='-O3 -DNDEBUG' CXXFLAGS='-fno-common -arch x86_64 -mmacosx-version-min=10.15 -fexceptions -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -O3 -fopenmp -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -DMATLAB_MEX_FILE' LDFLAGS='$LDFLAGS -O3 -fopenmp' '-I/usr/local/include/' /usr/local/opt/gcc/lib/gcc/current/libstdc++.a -ltiff parallelreadtiffmex.cpp ../src/helperfunctions.cpp ../src/parallelreadtiff.cpp
mex -v -outdir ../mac -output parallelReadTiff.mexw64 CXX="/usr/local/bin/g++-13" CXXOPTIMFLAGS='-O3 -DNDEBUG' LDOPTIMFLAGS='-O3 -DNDEBUG' CXXFLAGS='-fno-common -arch x86_64 -mmacosx-version-min=10.15 -fexceptions -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -O3 -fopenmp -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -DMATLAB_MEX_FILE' LDFLAGS='$LDFLAGS -O3 -fopenmp' '-I/Users/abcx86mac/c-tiff/jenkinsBuild/install/include/' -L'/Users/abcx86mac/c-tiff/jenkinsBuild/install/lib' /usr/local/opt/gcc/lib/gcc/current/libstdc++.a -lcppTiff parallelreadtiffmex.cpp

% We need to change all the current paths to be relative to the mex file
%system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libstdc++.6.dylib @loader_path/libstdc++.6.0.32.dylib ../mac/parallelReadTiff.mexmaci64');
system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libgomp.1.dylib @loader_path/libgomp.1.dylib ../mac/parallelReadTiff.mexmaci64');
system('install_name_tool -change @rpath/libtiff.6.dylib @loader_path/libtiff.6.0.1.dylib ../mac/parallelReadTiff.mexmaci64');
system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib @loader_path/libgcc_s.1.1.0.dylib ../mac/parallelReadTiff.mexmaci64');
system('install_name_tool -change @rpath/libcppTiff.dylib @loader_path/libcppTiff.dylib ../mac/parallelReadTiff.mexmaci64');

system('chmod 777 ../mac/parallelReadTiff.mexmaci64');
elseif ispc
Expand Down
4 changes: 2 additions & 2 deletions mexSrc/compile_parallelWriteTiff.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
if ~exist(releaseFolder, 'dir')
mkdir(releaseFolder);
end
mex -v -outdir ../mac -output parallelWriteTiff.mexw64 CXX="/usr/local/bin/g++-13" CXXOPTIMFLAGS='-O3 -DNDEBUG' LDOPTIMFLAGS='-O3 -DNDEBUG' CXXFLAGS='-fno-common -arch x86_64 -mmacosx-version-min=10.15 -fexceptions -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -O3 -fopenmp -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -DMATLAB_MEX_FILE' LDFLAGS='$LDFLAGS -O3 -fopenmp' '-I/usr/local/include/' /usr/local/opt/gcc/lib/gcc/current/libstdc++.a -ltiff parallelwritetiffmex.cpp ../src/lzwencode.cpp ../src/helperfunctions.cpp ../src/parallelwritetiff.cpp
mex -v -outdir ../mac -output parallelWriteTiff.mexw64 CXX="/usr/local/bin/g++-13" CXXOPTIMFLAGS='-O3 -DNDEBUG' LDOPTIMFLAGS='-O3 -DNDEBUG' CXXFLAGS='-fno-common -arch x86_64 -mmacosx-version-min=10.15 -fexceptions -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -O3 -fopenmp -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -DMATLAB_MEX_FILE' LDFLAGS='$LDFLAGS -O3 -fopenmp' '-I/Users/abcx86mac/c-tiff/jenkinsBuild/install/include' -L'/Users/abcx86mac/c-tiff/jenkinsBuild/install/lib' /usr/local/opt/gcc/lib/gcc/current/libstdc++.a -lcppTiff parallelwritetiffmex.cpp

% We need to change all the current paths to be relative to the mex file
%system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libstdc++.6.dylib @loader_path/libstdc++.6.0.32.dylib ../mac/parallelWriteTiff.mexmaci64');
system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libgomp.1.dylib @loader_path/libgomp.1.dylib ../mac/parallelWriteTiff.mexmaci64');
system('install_name_tool -change @rpath/libtiff.6.dylib @loader_path/libtiff.6.0.1.dylib ../mac/parallelWriteTiff.mexmaci64');
system('install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib @loader_path/libgcc_s.1.1.0.dylib ../mac/parallelWriteTiff.mexmaci64');
system('install_name_tool -change @rpath/libcppTiff.dylib @loader_path/libcppTiff.dylib ../mac/parallelWriteTiff.mexmaci64');

system('chmod 777 ../mac/parallelWriteTiff.mexmaci64');
elseif ispc
Expand Down

0 comments on commit 675db66

Please sign in to comment.