halbux / sparselizard

C++ FEM library | user-friendly | multi-physics | hp-adaptive | HPC
http://www.sparselizard.org
Other
332 stars 62 forks source link

Install target #22

Closed pointhi closed 3 years ago

pointhi commented 3 years ago

It would be nice to be able to install sparselizard inside /usr/ without any hassle. Including all the development headers. This would simplify the usage of sparselizard in applications as well as packaging.

I would propose a switch to CMake (the Makefile is quite easy right now so it shouldn't be much work) which can create Makefiles with all things correctly setup. I would further propose to add a custom CMakeModule to detect petsc and gmsh (and any other dependency) on the system (for example, on Arch, petsc is stored in /opt/petsc/linux-c-opt/ by default by the AUR package). This should allow to easily create packages for Linux distributions.

Of course, if it can be easily packaged, it would make sense to have release tags for the repo as well.

halbux commented 3 years ago

That would be nice indeed. The reason I don't use cmake is simply that I have never used it before and have no knowledge about it. It still is in my todo list to learn it but not done yet. Concerning release tags there is some progress there: since last week sparselizard comes with version numbers ("int mathop::getversion(), and getversionname()"), the version number is written in the mathop.cpp source code and I will keep on providing release numbers this way.

Have you already done software packaging for Linux distributions?

halbux commented 3 years ago

I will give a try to cmake, but any help/contribution is welcome!

matsievskiysv commented 3 years ago

If you are not settled on CMake yet, check out mesonbuild. IMHO it has the best syntax among other build systems (python-style).

halbux commented 3 years ago

Thanks, just checked it out!

matsievskiysv commented 3 years ago

Thanks, just checked it out!

@halbux I've implemented CMake. Will create PR soon.

matsievskiysv commented 3 years ago

Could you test the implementation of #23? I'm interested in location of PETSc and SLEPC libs on different systems (I've only tested on Debian). Search functions are defined in cMake/SetupPETSC.cmake and cMake/SetupSLEPC.cmake files.


EDIT And also GMSH (cMake/SetupGMSH.cmake)

halbux commented 3 years ago

All done it seems. + the lib and include folders are automatically created in build by cmake. Thanks again @matsievskiysv and @pointhi . Note: adding cmake pushed me to do a few syntax changes last week so please check the examples, they are updated.

  1. sparselizardbase.h -> sparselizard.h
  2. mathop namespace -> sl
  3. the main -> sparselizard() call and slepcinitialize/finalize are not needed anymore since I now automatically decide to slepcinitialize and finalize