zerothi/fdict

CMake install

Closed this issue · 11 comments

Thank you zerothi, for making this awesome library. This is exactly what I need for a project. Unfortunately, I'm new to both Fortran and CMake. I've reviewed as much as I can on CMake for Windows, but I'm struggling to install and link this library to my VS Code project. Please could you outline what you mean by the normal CMake procedure?

Thanks again!

I have never tried on windows, but would be happy to ensure it works on Win.

Are you using WSL, or pure Win?

The general cmake procedure would be:

cmake -Bbuild_dir -S.
cmake --build build_dir

or something similar.

I have no experience with coupling a CMake project into a VS Code?

Thank you for the ultrafast reply. I'm on a pure Win system. Should I generate my own CMakeLists.txt file before using the following lines?

cmake -Bbuild_dir -S
cmake --build build_dir

no, cmake should be part of this directory, so checkout the repo, then issue the above commands. (remember the . in front of S

(Typo) So, would I be correct in stating that I should

1.) download and extract the fdict library to my project,
2.) run
cmake -Bbuild_dir -S.
cmake --build build_dir

with no other changes?

Thanks again!

well, ideally you should just install the library somewhere, how do you otherwise add dependencies in your VS Code project?

But the above will compile fdict in and you should find a libfdict.dll in your build_dir directory.
If you want to install it somewhere, you should specify so with -DCMAKE_INSTALL_PREFIX

I'll have another look into this. After installation, you mentioned linking via:

FDICT_PATH = /path/to/fdict/parent
FDICT_LIBS = -L$(FDICT_PATH) -lfdict
FDICT_INC = -I$(FDICT_PATH)

Would this be written in the main Fortran file?

No, this is how to link against external dependencies. Have you ever tried to link another library into an executable? :-D

This may be the first time I've had to do this.

Ok, you should definitely read up on how to link libraries/depedencies against a small project.

I would advice you to play around with this on a smaller scale before going into dependencies as you are doing now.
I would highly suggest you to ask around your local department for members who knows about this stuff.

Here is a minimal description of libraries and how to link them (works the same for fortran).
https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_C_libraries.html

Thanks for all the help zerothi!

This seems a bit off to fdict, I'll close for now.