Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [photran] fortran compiler in photran

Hani wrote:
M.R.Hadian schrieb:
[...]
4-do you have any experience of using the method of ftp://ftp.gfdl.gov/perm/vb/mkmf/mkmf.html with "Fortran Standard Make Project" on current stable version of photran?

It is easy to use Photran with mkmf. Here a example for Windows, MinGW, g95 and Photran 3.1.

1.
At the first you need the Make tool and Perl installed on your system. If you are a Linux or Cygwin user you can install it easily or it is already installed. On MinGW it is useful to download and install "msys" and "msysDTK" from www.mingw.org for that. The bin directory has to be in your path.

2.
Copy "mkmf" somewhere in your path (e.g. c:\msys\1.0\bin) Create a template file for your compiler. Here a example for g95:
  FC = g95
  LD = g95
  FFLAGS = -Ic:/msys/1.0/MinGW/include
  LDFLAGS = $(LIBS)
  LIBS = -llapack -lf77blas -lcblas -latlas -lg2c
Give a name to this file (e.g. mkmf.g95) and save it somewhere (e.g. c:\msys\1.0\bin)

3.
Now you can use "mkmf" even from the command line. To use it in Photran open Photran and click the menu "Run->External tools->External tools..." Click on the tab "main" and fill out the form as described below. You should fit the following example to your environment if necessary:
   Name: g95 make Makefile
   Location: c:\windows\system32\cmd.exe
   Working directory: c:\windows\system32
Arguments: /C "cd ${container_loc} && perl c:\msys\1.0\bin\mkmf -t c:\msys\1.0\bin\mkmf.g95"

4.
Click on the "Refresh" tab:
[x] Refresh resources ...
Click "Apply"

5.
Setup is done.



To use mkmf do the following:

1. Click on one of your source files in Navigator frame
2. Click menu "Run->External tools->External tools ..."
3. Choose (e.g.) "g95 make Makefile" and click the "Run" button. In the navigator frame you should see the "Makefile" file in your project section.(After the first run of "g95 make Makefile" it will appear in the root section of the External tools submenu or toolbar icon for easy invocation)
4. Click menu Project->Clean ...
5. Check if your project name and the checkbutton "Start a build immediately" is marked. Click "OK"
6. After compilation you should see "a.exe" in your project section.
7. Right click on "a.exe" and click "Run As->Run Local C/C++ Application"
8. VoilĂ 

If you are a Linux user you are able to adapt it to your OS. If not please notify.

Best regards,

Hani



_______________________________________________
photran mailing list
photran@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/photran

Dear Hani
I managed to solve the problem. the changes are:
1- i so not have lapack and other library as you wrote so i changed mkmf.g95 in C:\msys\1.0\bin to:
FC = g95
LD = g95
FFLAGS = -g -Wall -pedantic
3- in the "run external tools" i changed the options of "g95 make Makefile" as:
working directory: ${resource_loc}
arguments: /C "cd ${resource_loc} && perl C:\msys\1.0\bin\mkmf -t C:\msys\1.0\bin\mkmf.g95 -p ${project_name}.exe"

Now it works properly and i can run the code, however the debugging fails with the error:
mi_cmd_stack_list_frames : No stack
No symbol "auto" in currecnt content.

note that the code is a simple "hello world".

my other problem is that my code consist of many files and i do not want to have all the source files, object files and outputs of the code in one folder. how can i keep source files in a folder named "source" and object files in folder "debug" or "release" and the output of the model in the root of the project folder? this is like Microsoft Developer Studio does. the new beta version of photran has the same method for Intel compiler on Linux but not in windows and the "managed make" method does not work (or maybe i could not find it).

Thanks in advance for your attention,
Hadian


Back to the top