-
Notifications
You must be signed in to change notification settings - Fork 90
Description
I have a homebrew formula which will build and “install” json-fortran, but due to the non-canonical install directory structure we currently have
/usr/local/jsonfortran-gnu-4.0.0/
├── cmake
│ ├── jsonfortran-gnu-config-version.cmake
│ ├── jsonfortran-gnu-config.cmake
│ ├── jsonfortran-gnu-targets-release.cmake
│ └── jsonfortran-gnu-targets.cmake
└── lib
├── json_module.mod
├── libjsonfortran.4.0.0.dylib
├── libjsonfortran.4.0.dylib -> libjsonfortran.4.0.0.dylib
├── libjsonfortran.a
└── libjsonfortran.dylib -> libjsonfortran.4.0.dylib
Home-brew doesn’t link anything in to /usr/local/lib
or /usr/local/include
, which seems to be the place that other home-brewed fortran projects put their .mod files. We discussed some of the installation considerations in #3.
I’m inclined to add a CMake option to use the canonical install locations IFF gfortran is being used to compile the library. The user can then set this option and the library files will be installed into /usr/local/lib by default and the .mod file will get placed in /usr/local/include (and when managed with homebrew they will be symlinked in). As for the cmake files telling cmake where to find everything the convention appears to be either copy them into /usr/local/lib/cmake (which is what scalapack does) or to copy them into /usr/local/lib// which is what cloog-isl does.
Thus, the proposed install structure would look like:
/usr/local/
├── include
│ └── json_module.mod
└── lib
├── cmake
│ └── json-fortran-4.0.0
│ ├── jsonfortran-gnu-config-version.cmake
│ ├── jsonfortran-gnu-config.cmake
│ ├── jsonfortran-gnu-targets-release.cmake
│ └── jsonfortran-gnu-targets.cmake
├── libjsonfortran.4.0.0.dylib
├── libjsonfortran.4.0.dylib
├── libjsonfortran.a
└── libjsonfortran.dylib
and this would be achieved by passing a switch to cmake
or editing an option in the cache with ccmake
or cmake-gui
to tell it to install in the canonical way rather than the current way, which installs it to /usr/local/jsonfortran-gnu-x.x.x/ as described above.
This way users could fetch and install json-fortran directly using homebrew and the brew link
step would actually link the libraries and mod files etc. to reasonable locations. Thoughts?