Find us on…
ForCompile: A Fortran library to access the Compiler Explorer API.
Prerequisites:
On Ubuntu, you need to install the curl development headers. Use the following command:
sudo apt install -y libcurl4-openssl-dev
Clone the repository:
You can clone the ForCompile repository from GitHub using the following command:
git clone https://github.com/gha3mi/forcompile.git
cd forcompile
program test_1
use forcompile, only: compiler_explorer
implicit none
type(compiler_explorer) :: ce
call ce%list_compilers()
end program test_1
program test_2
use forcompile, only: compiler_explorer
implicit none
type(compiler_explorer) :: ce
call ce%list_languages()
end program test_2
program test_3
use forcompile, only: compiler_explorer
implicit none
type(compiler_explorer) :: ce
call ce%list_compilers(language_id='fortran')
end program test_3
program test_4
use forcompile, only: compiler_explorer
implicit none
type(compiler_explorer) :: ce
call ce%list_libraries()
end program test_4
program test_5
use forcompile, only: compiler_explorer
implicit none
type(compiler_explorer) :: ce
call ce%list_libraries(language_id='fortran')
end program test_5
program test_6
use forcompile, only: compiler_explorer
implicit none
type(compiler_explorer) :: ce
call ce%list_formatters()
end program test_6
program test_7
use forcompile, only: compiler_explorer
implicit none
type(compiler_explorer) :: ce
call ce%set_source("&
program hello;&
write(*,*) 'Hello World';&
end program hello&
")
call ce%set_compiler_id('gfortran132')
call ce%options%set_userArguments('-O3')
call ce%options%set_compilerOptions(skipAsm=.false., executorRequest=.false.)
call ce%options%set_filters(&
binary=.false.,&
binaryObject=.false.,&
commentOnly=.true.,&
demangle=.true.,&
directives=.true.,&
execute=.true.,&
intel=.true.,&
labels=.true.,&
libraryCode=.false.,&
trim=.false.,&
debugCalls=.false.)
call ce%set_lang('fortran')
call ce%set_allowStoreCodeDebug(.true.)
call ce%compile()
call ce%finalize()
end program test_7
If you want to use ForCompile
as a dependency in your own fpm project,
you can easily include it by adding the following line to your fpm.toml
file:
[dependencies]
forcompile = {git="https://github.com/gha3mi/forcompile.git"}
The most up-to-date API documentation for the master branch is available
here.
To generate the API documentation for ForCompile
using
ford run the following
command:
ford ford.yml
Contributions to ForCompile
are welcome!
If you find any issues or would like to suggest improvements, please open an issue.