Skip to content

Commit

Permalink
build process updated
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanschatzlmayr committed Feb 11, 2025
1 parent 74d0369 commit 0d9ce59
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 93 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ endif()

add_subdirectory(SRC)

add_executable(test_gorilla_main.x
SRC/test_gorilla_main.f90
)

target_link_libraries(test_gorilla_main.x GORILLA netcdff netcdf lapack)

message(${CMAKE_HOST_SYSTEM_PROCESSOR})
2 changes: 1 addition & 1 deletion EXAMPLES/example_1/test_gorilla_main.x
1 change: 0 additions & 1 deletion EXAMPLES/example_1/test_gorilla_main_cmake.x

This file was deleted.

2 changes: 1 addition & 1 deletion EXAMPLES/example_2/test_gorilla_main.x
1 change: 0 additions & 1 deletion EXAMPLES/example_2/test_gorilla_main_cmake.x

This file was deleted.

2 changes: 1 addition & 1 deletion EXAMPLES/example_3/test_gorilla_main.x
1 change: 0 additions & 1 deletion EXAMPLES/example_3/test_gorilla_main_cmake.x

This file was deleted.

2 changes: 1 addition & 1 deletion EXAMPLES/example_4/test_gorilla_main.x
1 change: 0 additions & 1 deletion EXAMPLES/example_4/test_gorilla_main_cmake.x

This file was deleted.

2 changes: 1 addition & 1 deletion EXAMPLES/example_5/test_gorilla_main.x
1 change: 0 additions & 1 deletion EXAMPLES/example_5/test_gorilla_main_cmake.x

This file was deleted.

2 changes: 1 addition & 1 deletion EXAMPLES/example_6/test_gorilla_main.x
1 change: 0 additions & 1 deletion EXAMPLES/example_6/test_gorilla_main_cmake.x

This file was deleted.

1 change: 0 additions & 1 deletion EXAMPLES/example_7/test_gorilla_main_cmake.x

This file was deleted.

83 changes: 17 additions & 66 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,75 +1,26 @@
FC = gfortran
OPTS ?= -J OBJS -g -fbacktrace -ffpe-trap=zero,overflow,invalid -fbounds-check -fopenmp
CONFIG ?= Release
BUILD_DIR := BUILD
BUILD_NINJA := $(BUILD_DIR)/build.ninja

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
NCINC ?= -I/usr/local/include -I/opt/homebrew/include
NCLIB ?= -L/usr/local/lib -L/opt/homebrew/lib -lnetcdff -lnetcdf -llapack
else
NCINC ?= -I/usr/include
NCLIB ?= -lnetcdff -lnetcdf -llapack
endif
.PHONY: all configure reconfigure build test install clean
all: build

SOURCES = SetWorkingPrecision.f90\
Polynomial234RootSolvers.f90 \
constants_mod.f90 \
tetra_grid_settings_mod.f90 \
gorilla_settings_mod.f90 \
various_functions_mod.f90 \
gorilla_diag_mod.f90 \
canonical_coordinates_mod.f90 \
nctools_module.f90 \
rkf45.f90 \
odeint_rkf45.f90 \
runge_kutta_mod.f90 \
magfie.f90 \
chamb_m.f90 \
vmecinm_m.f90 \
spline5_RZ.f90 \
spl_three_to_five_mod.f90 \
new_vmec_allocation_stuff.f90 \
spline_vmec_data.f90 \
binsrc.f90 \
field_divB0.f90 \
scaling_r_theta.f90\
plag_coeff.f90 \
field_line_integration_for_SYNCH.f90 \
preload_for_SYNCH.f90 \
magdata_in_symfluxcoord.f90 \
points_2d.f90\
circular_mesh.f90\
circular_mesh_SOLEDGE3X_EIRENE.f90\
tetra_grid_mod.f90 \
make_grid_rect_mod.f90 \
bdivfree.f90 \
strong_electric_field_mod.f90 \
differentiate.f90 \
tetra_physics_mod.f90 \
tetra_physics_poly_precomp_mod.f90 \
supporting_functions_mod.f90 \
pusher_tetra_func_mod.f90 \
pusher_tetra_poly.f90 \
pusher_tetra_rk.f90 \
find_tetra_mod.f90 \
get_canonical_coordinates.f90 \
orbit_timestep_gorilla.f90 \
gorilla_plot_mod.f90 \
test_gorilla_main.f90
$(BUILD_NINJA):
cmake -S . -B$(BUILD_DIR) -GNinja -DCMAKE_BUILD_TYPE=$(CONFIG) -DCMAKE_COLOR_DIAGNOSTICS=ON

OBJS = $(patsubst %.f90,OBJS/%.o,$(SOURCES))
configure: $(BUILD_NINJA)

reconfigure:
cmake -S . -B$(BUILD_DIR) -GNinja -DCMAKE_BUILD_TYPE=$(CONFIG) -DCMAKE_COLOR_DIAGNOSTICS=ON

test_gorilla_main.x: $(OBJS_CONTRIB) $(OBJS)
$(FC) $(OPTS) -o $@ $^ $(NCLIB)
build: configure
cmake --build $(BUILD_DIR) --config $(CONFIG)

OBJS/%.o: SRC/contrib/%.f90
$(FC) $(OPTS) -c $^ -o $@ $(NCINC)
test: build
cd $(BUILD_DIR) && ctest

OBJS/%.o: SRC/%.f90
$(FC) $(OPTS) -c $^ -o $@ $(NCINC)
doc: configure
cmake --build --preset default --target doc

.PHONY: clean
clean:
rm -f OBJS/*
rm -f SRC/*.mod
rm -f test_gorilla_main.x
rm -rf $(BUILD_DIR)
14 changes: 0 additions & 14 deletions build.sh

This file was deleted.

0 comments on commit 0d9ce59

Please sign in to comment.