Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Normann Rion
preprocessor
Commits
fe8aaf44
Verified
Commit
fe8aaf44
authored
May 23, 2022
by
Willi Mutschler
Browse files
Options
Downloads
Patches
Plain Diff
provisions for Apple Silicon package
parent
c94dfb84
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ModelTree.cc
+12
-5
12 additions, 5 deletions
src/ModelTree.cc
src/ModelTree.hh
+1
-1
1 addition, 1 deletion
src/ModelTree.hh
with
13 additions
and
6 deletions
src/ModelTree.cc
+
12
−
5
View file @
fe8aaf44
...
...
@@ -1783,6 +1783,8 @@ ModelTree::matlab_arch(const string &mexext)
}
else
if
(
mexext
==
"mexmaci64"
)
return
"maci64"
;
else
if
(
mexext
==
"mexmaca64"
)
return
"maca64"
;
else
{
cerr
<<
"ERROR: 'mexext' option to preprocessor incorrectly set, needed with 'use_dll'"
<<
endl
;
...
...
@@ -1792,7 +1794,7 @@ ModelTree::matlab_arch(const string &mexext)
#ifdef __APPLE__
string
ModelTree
::
findGccOnMacos
()
ModelTree
::
findGccOnMacos
(
const
string
&
mexext
)
{
const
string
macos_gcc_version
{
"11"
};
// doc/manual/source/installation-and-configuration.rst
// should be updated when this is changed
...
...
@@ -1805,10 +1807,15 @@ ModelTree::findGccOnMacos()
local_gcc_path
=
s
.
substr
(
0
,
s
.
find_last_of
(
"/"
))
+
"/../.brew/bin/gcc-"
+
macos_gcc_version
;
}
// if user did not choose to install gcc locally via the pkg-installer then we need to find GNU gcc
// homebrew binaries are located in /usr/local/bin/ on x86_64 systems and in /opt/homebrew/bin/ on arm64 systems
if
(
filesystem
::
exists
(
local_gcc_path
))
return
local_gcc_path
;
else
if
(
string
global_gcc_path
=
"/usr/local/bin/gcc-"
+
macos_gcc_version
;
filesystem
::
exists
(
global_gcc_path
))
filesystem
::
exists
(
global_gcc_path
)
&&
mexext
==
"mexmaci64"
)
return
global_gcc_path
;
else
if
(
string
global_gcc_path
=
"/opt/homebrew/bin/gcc-"
+
macos_gcc_version
;
filesystem
::
exists
(
global_gcc_path
)
&&
mexext
==
"mexmaca64"
)
return
global_gcc_path
;
else
{
...
...
@@ -1843,7 +1850,7 @@ ModelTree::compileMEX(const string &basename, const string &funcname, const stri
#ifdef __APPLE__
/* On macOS, enforce GCC, otherwise Clang will be used, and it does not
accept our custom optimization flags (see dynare#1797) */
string
gcc_path
=
findGccOnMacos
();
string
gcc_path
=
findGccOnMacos
(
mexext
);
if
(
setenv
(
"CC"
,
gcc_path
.
c_str
(),
1
)
!=
0
)
{
cerr
<<
"Can't set CC environment variable"
<<
endl
;
...
...
@@ -1892,9 +1899,9 @@ ModelTree::compileMEX(const string &basename, const string &funcname, const stri
}
}
#ifdef __APPLE__
else
if
(
mexext
==
"mexmaci64"
)
else
if
(
mexext
==
"mexmaci64"
||
mexext
==
"mexmaca64"
)
{
compiler
=
findGccOnMacos
();
compiler
=
findGccOnMacos
(
mexext
);
flags
<<
" -fno-common -Wl,-twolevel_namespace -undefined error -bundle"
;
libs
+=
" -lm"
;
}
...
...
This diff is collapsed.
Click to expand it.
src/ModelTree.hh
+
1
−
1
View file @
fe8aaf44
...
...
@@ -398,7 +398,7 @@ private:
static
string
matlab_arch
(
const
string
&
mexext
);
#ifdef __APPLE__
//! Finds a suitable GCC compiler on macOS
static
string
findGccOnMacos
();
static
string
findGccOnMacos
(
const
string
&
mexext
);
#endif
//! Compiles a MEX file
void
compileMEX
(
const
string
&
basename
,
const
string
&
funcname
,
const
string
&
mexext
,
const
vector
<
filesystem
::
path
>
&
src_files
,
const
filesystem
::
path
&
matlabroot
,
const
filesystem
::
path
&
dynareroot
)
const
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment