summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-07-05 10:46:01 +0800
committerruki <[email protected]>2020-07-05 10:46:01 +0800
commit8874de88d7cc0003c9f83042a39cc7f81a8e88ac (patch)
tree74342fcea8ed92a205b986953d413305ebb5618a
parentc0842437b9cb2116284818d56a52e1a60bc68663 (diff)
add fortran templates
-rw-r--r--xmake/templates/fortran/console/project/src/main.f903
-rw-r--r--xmake/templates/fortran/console/project/xmake.lua6
-rw-r--r--xmake/templates/fortran/console/template.lua2
-rw-r--r--xmake/templates/fortran/shared/project/src/main.f905
-rw-r--r--xmake/templates/fortran/shared/project/src/test.f908
-rw-r--r--xmake/templates/fortran/shared/project/xmake.lua11
-rw-r--r--xmake/templates/fortran/shared/template.lua2
-rw-r--r--xmake/templates/fortran/static/project/src/main.f905
-rw-r--r--xmake/templates/fortran/static/project/src/test.f908
-rw-r--r--xmake/templates/fortran/static/project/xmake.lua11
-rw-r--r--xmake/templates/fortran/static/template.lua2
11 files changed, 63 insertions, 0 deletions
diff --git a/xmake/templates/fortran/console/project/src/main.f90 b/xmake/templates/fortran/console/project/src/main.f90
new file mode 100644
index 000000000..a332e8401
--- /dev/null
+++ b/xmake/templates/fortran/console/project/src/main.f90
@@ -0,0 +1,3 @@
+program hello
+ print *, "Hello World!"
+end program hello
diff --git a/xmake/templates/fortran/console/project/xmake.lua b/xmake/templates/fortran/console/project/xmake.lua
new file mode 100644
index 000000000..b12d74cce
--- /dev/null
+++ b/xmake/templates/fortran/console/project/xmake.lua
@@ -0,0 +1,6 @@
+add_rules("mode.debug", "mode.release")
+
+target("${TARGETNAME}")
+ set_kind("binary")
+ add_files("src/*.f90")
+
diff --git a/xmake/templates/fortran/console/template.lua b/xmake/templates/fortran/console/template.lua
new file mode 100644
index 000000000..ed2e13b57
--- /dev/null
+++ b/xmake/templates/fortran/console/template.lua
@@ -0,0 +1,2 @@
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/fortran/shared/project/src/main.f90 b/xmake/templates/fortran/shared/project/src/main.f90
new file mode 100644
index 000000000..9adea3e26
--- /dev/null
+++ b/xmake/templates/fortran/shared/project/src/main.f90
@@ -0,0 +1,5 @@
+program hello
+ use test, only: print_hello
+ implicit none (type, external)
+ call print_hello()
+end program hello
diff --git a/xmake/templates/fortran/shared/project/src/test.f90 b/xmake/templates/fortran/shared/project/src/test.f90
new file mode 100644
index 000000000..b1e97a36c
--- /dev/null
+++ b/xmake/templates/fortran/shared/project/src/test.f90
@@ -0,0 +1,8 @@
+module test
+ implicit none (type, external)
+
+contains
+ subroutine print_hello()
+ print *, "Hello World!"
+ end subroutine print_hello
+end module test
diff --git a/xmake/templates/fortran/shared/project/xmake.lua b/xmake/templates/fortran/shared/project/xmake.lua
new file mode 100644
index 000000000..04bf17567
--- /dev/null
+++ b/xmake/templates/fortran/shared/project/xmake.lua
@@ -0,0 +1,11 @@
+add_rules("mode.debug", "mode.release")
+
+target("${TARGETNAME}_lib")
+ set_kind("shared")
+ add_files("src/test.f90")
+
+target("${TARGETNAME}")
+ set_kind("binary")
+ add_deps("${TARGETNAME}_lib")
+ add_files("src/main.f90")
+
diff --git a/xmake/templates/fortran/shared/template.lua b/xmake/templates/fortran/shared/template.lua
new file mode 100644
index 000000000..d7ec5bae4
--- /dev/null
+++ b/xmake/templates/fortran/shared/template.lua
@@ -0,0 +1,2 @@
+template("shared")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/fortran/static/project/src/main.f90 b/xmake/templates/fortran/static/project/src/main.f90
new file mode 100644
index 000000000..9adea3e26
--- /dev/null
+++ b/xmake/templates/fortran/static/project/src/main.f90
@@ -0,0 +1,5 @@
+program hello
+ use test, only: print_hello
+ implicit none (type, external)
+ call print_hello()
+end program hello
diff --git a/xmake/templates/fortran/static/project/src/test.f90 b/xmake/templates/fortran/static/project/src/test.f90
new file mode 100644
index 000000000..b1e97a36c
--- /dev/null
+++ b/xmake/templates/fortran/static/project/src/test.f90
@@ -0,0 +1,8 @@
+module test
+ implicit none (type, external)
+
+contains
+ subroutine print_hello()
+ print *, "Hello World!"
+ end subroutine print_hello
+end module test
diff --git a/xmake/templates/fortran/static/project/xmake.lua b/xmake/templates/fortran/static/project/xmake.lua
new file mode 100644
index 000000000..694c1d390
--- /dev/null
+++ b/xmake/templates/fortran/static/project/xmake.lua
@@ -0,0 +1,11 @@
+add_rules("mode.debug", "mode.release")
+
+target("${TARGETNAME}_lib")
+ set_kind("static")
+ add_files("src/test.f90")
+
+target("${TARGETNAME}")
+ set_kind("binary")
+ add_deps("${TARGETNAME}_lib")
+ add_files("src/main.f90")
+
diff --git a/xmake/templates/fortran/static/template.lua b/xmake/templates/fortran/static/template.lua
new file mode 100644
index 000000000..abfe91a4b
--- /dev/null
+++ b/xmake/templates/fortran/static/template.lua
@@ -0,0 +1,2 @@
+template("static")
+ add_configfiles("xmake.lua")