Skip to content

Commit b479797

Browse files
authored
Merge pull request #1 from zoziha/master
add cmake support.
2 parents 01d2c7d + 744af30 commit b479797

File tree

6 files changed

+71
-7
lines changed

6 files changed

+71
-7
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project(
4+
"SPH"
5+
LANGUAGES "Fortran"
6+
VERSION "0.0.1"
7+
)
8+
9+
# Collect source of the project
10+
add_subdirectory("src")
11+
12+
# Collect source of the application
13+
add_subdirectory("app")
14+
15+
# Include test suite
16+
#enable_testing()
17+
#add_subdirectory("test")

app/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
set(prog
2+
sph.f
3+
)
4+
5+
add_executable(
6+
"${PROJECT_NAME}-exe"
7+
"${prog}"
8+
)
9+
10+
target_link_libraries(
11+
"${PROJECT_NAME}-exe"
12+
PRIVATE
13+
"${PROJECT_NAME}-lib"
14+
)

app/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ all: sph
33
# Orginal test
44
sph: sph.o
55
$(FC) $(FFLAGS) $< -L../src -l$(LIB) -I../src -o $@.x
6-
cd .. && time ./app/sph.x
6+
cd .. && time ./app/sph.x
7+
8+
clean:
9+
rm -f -r *.o *.x *.so *.mod *.smod

fpm.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
name = "sph_code"
1+
name = "SPH"
22

33
[build]
44
auto-executables = false
5-
auto-tests = false
6-
auto-examples = false
5+
auto-tests = false
6+
auto-examples = false
77

88
[library]
99
include-dir = "src"
1010

1111
[[executable]]
12-
name = "sph"
13-
source-dir = "app"
14-
main = "sph.f"
12+
name = "sph"
13+
source-dir = "app"
14+
main = "sph.f"

src/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
set(SRC
2+
art_heat.f
3+
art_visc.f
4+
av_vel.f
5+
density.f
6+
direct_find.f
7+
eos.f
8+
external_force.f
9+
grid_geom.f
10+
hsml.f
11+
init_grid.f
12+
input.f
13+
internal_force.f
14+
kernel.f
15+
link_list.f
16+
output.f
17+
single_step.f
18+
time_integration.f
19+
virt_part.f
20+
viscosity.f
21+
time_elapsed.f90
22+
time_print.f90
23+
)
24+
25+
add_library(${PROJECT_NAME}-lib ${SRC})

test/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
2+
3+
set(
4+
""
5+
)

0 commit comments

Comments
 (0)