mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Now writes a Makefile for users to build a source
This commit is contained in:
parent
5e98373036
commit
f78d3708a7
1 changed files with 55 additions and 3 deletions
|
|
@ -406,6 +406,58 @@ install(FILES man/man1/openmc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
|||
install(FILES LICENSE DESTINATION "${CMAKE_INSTALL_DOCDIR}" RENAME copyright)
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
# Copy headers for vendored dependencies (note that all except faddeeva are handled
|
||||
# separately since they are managed by CMake)
|
||||
install(DIRECTORY vendor/faddeeva DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
#=============================
|
||||
# write the dl_open Makefile
|
||||
#=============================
|
||||
file(WRITE share/Makefile"
|
||||
# Makefile to build dynamic sources for OpenMC
|
||||
# this assumes that your source sampling filename is
|
||||
# source_sampling.cpp
|
||||
#
|
||||
# you can add fortran, c and cpp dependencies to this source
|
||||
# adding them in FC_DEPS, C_DEPS, and CXX_DEPS accordingly
|
||||
|
||||
ifeq ($(FC), f77)
|
||||
FC = gfortran
|
||||
endif
|
||||
|
||||
default: all
|
||||
|
||||
ALL = source_sampling
|
||||
# add your fortran depencies here
|
||||
FC_DEPS =
|
||||
# add your c dependencies here
|
||||
C_DEPS =
|
||||
# add your cpp dependencies here
|
||||
CPP_DEPS =
|
||||
DEPS = $(FC_DEPS) $(C_DEPS) $(CPP_DEPS)
|
||||
OPT_LEVEL = -O3
|
||||
FFLAGS = $(OPT_LEVEL) -fPIC
|
||||
C_FLAGS = -fPIC
|
||||
CXX_FLAGS = -fPIC
|
||||
|
||||
OPENMC_DIR = ${CMAKE_INSTALL_PREFIX}
|
||||
OPENMC_INC_DIR = $(OPENMC_DIR)/include
|
||||
OPENMC_LIB_DIR = $(OPENMC_DIR)/lib
|
||||
# setting the so name is important
|
||||
LINK_FLAGS = $(OPT_LEVEL) -Wall -Wl,-soname,source_sampling.so
|
||||
# setting shared is important
|
||||
LINK_FLAGS += -L$(OPENMC_LIB_DIR) -lopenmc -lgfortran -fPIC -shared
|
||||
OPENMC_INCLUDES = -I$(OPENMC_INC_DIR) -I$(OPENMC_DIR)/vendor/pugixml
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
source_sampling: $(DEPS)
|
||||
$(CXX) source_sampling.cpp $(DEPS) $(OPENMC_INCLUDES) $(LINK_FLAGS) -o $@.so
|
||||
# make any fortran objects
|
||||
%.o : %.F90
|
||||
$(FC) -c $(FFLAGS) $*.F90 -o $@
|
||||
# make any c objects
|
||||
%.o : %.c
|
||||
$(CC) -c $(FFLAGS) $*.c -o $@
|
||||
#make any cpp objects
|
||||
%.o : %.cpp
|
||||
$(CXX) -c $(FFLAGS) $*.cpp -o $@
|
||||
clean:
|
||||
rm -rf *.o *.mod
|
||||
")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue