"vscode:/vscode.git/clone" did not exist on "a29596c70119ffc5ddbd81e46472cf80989f2137"
Commit 38d2bc15 authored by Michael Sherman's avatar Michael Sherman
Browse files

Fix NMakefile for examples.

parent dd9f905a
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Makefile for OpenMM Preview Release 3 workshop "hello world" examples. # Microsoft NMakefile for OpenMM Preview Release 4 "hello world" examples.
# June 24, 2009. # August 19, 2009.
# See https://simtk.org/home/openmm. # See https://simtk.org/home/openmm.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# This assumes you have gcc compilers for whatever language you are # This assumes you have gcc compilers for whatever language you are
# using: cl for C++ and C, ifort for Fortran 95. # using: cl for C++ and C, ifort for Fortran 95.
# #
# Note: the C Wrappers and Fortran Module are just prototypes. They are
# incomplete but have enough functionality to get through these examples.
# We would like more complete and better-thought-out interfaces; if you
# have code or ideas please post to the OpenMM forum at the above URL
# (select "Advanced/Public Forums").
#
# This has had only minimal testing, although it has been known to
# work. It is likely to work fine for C and C++. For Fortran, you
# may need to add some of the C/C++ libraries:
# -lc -lm -lstdc++ (or -lstdc++.6) -lgcc -lgcc_s
# but this wasn't required for these examples on Centos 5.2 using
# gcc 4.1.2.
# Check whether this is the right capitalization for your install directory.
OpenMM_INSTALL_DIR="C:/Program Files/OpenMM" OpenMM_INSTALL_DIR="C:/Program Files/OpenMM"
CC = cl CC = cl
FC = ifort FC = ifort
...@@ -27,9 +14,6 @@ CFLAGS = /MD /EHsc ...@@ -27,9 +14,6 @@ CFLAGS = /MD /EHsc
FFLAGS = /MD FFLAGS = /MD
# Extra libraries required when ifort links with a C++ module. # Extra libraries required when ifort links with a C++ module.
# If this doesn't work, look in /usr/lib to
# see what versions of libstdc++.so you have and try different
# versions.
FCPPLIBS = FCPPLIBS =
LIB_DIR=$(OpenMM_INSTALL_DIR)/lib LIB_DIR=$(OpenMM_INSTALL_DIR)/lib
...@@ -53,36 +37,26 @@ cc: $(ALL_C_EXAMPLES) ...@@ -53,36 +37,26 @@ cc: $(ALL_C_EXAMPLES)
fortran: $(ALL_F95_EXAMPLES) fortran: $(ALL_F95_EXAMPLES)
# Treat all .cpp source files the same way.
# Treat all .cpp source files the same way (except the one that
# implements the C Wrappers).
HelloArgon HelloSodiumChloride HelloEthane HelloWaterBox: HelloArgon HelloSodiumChloride HelloEthane HelloWaterBox:
$(CC) $(CFLAGS) -I$(INCLUDE_DIR) $*.cpp /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe $(CC) $(CFLAGS) -I$(INCLUDE_DIR) $*.cpp /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe
HelloArgonInC: HelloArgonInC.c OpenMMCWrapper.obj HelloArgonInC: HelloArgonInC.c
$(CC) $(CFLAGS) -I. $*.c OpenMMCWrapper.obj /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe $(CC) $(CFLAGS) -I$(INCLUDE_DIR) $*.c /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe
HelloSodiumChlorideInC: HelloSodiumChlorideInC.c OpenMMCWrapper.obj
$(CC) $(CFLAGS) -I. $*.c OpenMMCWrapper.obj /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe
HelloArgonInFortran: HelloArgonInFortran.f90 openmm.mod OpenMMFortranWrapper.obj OpenMMCWrapper.obj
$(FC) $(FFLAGS) $*.f90 OpenMMFortranWrapper.obj OpenMMCWrapper.obj /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe
HelloSodiumChlorideInFortran: HelloSodiumChlorideInFortran.f90 openmm.mod OpenMMFortranWrapper.obj OpenMMCWrapper.obj HelloSodiumChlorideInC: HelloSodiumChlorideInC.c
$(FC) $(FFLAGS) $*.f90 OpenMMFortranWrapper.obj OpenMMCWrapper.obj /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe $(CC) $(CFLAGS) -I$(INCLUDE_DIR) $*.c /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe
HelloArgonInFortran: HelloArgonInFortran.f90 openmm.mod
$(FC) $(FFLAGS) $*.f90 /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe
# Build C Wrappers (Fortran depends on this too) HelloSodiumChlorideInFortran: HelloSodiumChlorideInFortran.f90 openmm.mod
OpenMMCWrapper.obj: OpenMMCWrapper.cpp $(FC) $(FFLAGS) $*.f90 /link /libpath:$(LIB_DIR) $(LIBS) /out:$*.exe
$(CC) $(CFLAGS) -c -I. -I$(INCLUDE_DIR) OpenMMCWrapper.cpp
# Build Fortran Wrappers
OpenMMFortranWrapper.obj: OpenMMFortranWrapper.cpp
$(CC) $(CFLAGS) -c -I. -I$(INCLUDE_DIR) OpenMMFortranWrapper.cpp
# Build Fortran 95 Module file # Build Fortran 95 Module file
openmm.mod: OpenMMFortranModule.f90 openmm.mod:
$(FC) -c $(FFLAGS) OpenMMFortranModule.f90 $(FC) -c $(FFLAGS) $(INCLUDE_DIR)/OpenMMFortranModule.f90
clean : clean :
del *.mod *.obj *.exe *.pdb *.exe.manifest del *.mod *.obj *.exe *.pdb *.exe.manifest
......
---------------------------------------------------------------- ----------------------------------------------------------------
OpenMM(tm) Example programs and prototype C and Fortran wrappers OpenMM(tm) Example programs for OpenMM Preview Release 4,
for OpenMM Preview Release 3, June, 2009. August, 2009.
See https://simtk.org/home/openmm. See https://simtk.org/home/openmm.
For help go to the Advanced/Public Forums tab and post to the For help go to the Advanced/Public Forums tab and post to the
...@@ -21,19 +21,17 @@ V. S. Pande. ...@@ -21,19 +21,17 @@ V. S. Pande.
Graphics Processing Units.” J. Comp. Chem., (2009), 30(6):864-872. Graphics Processing Units.” J. Comp. Chem., (2009), 30(6):864-872.
These simple "hello world" examples were developed by These simple "hello world" examples were developed by
Christopher Bruns and Michael Sherman for the OpenMM Christopher Bruns and Michael Sherman.
workshop on June 24, 2009 at Stanford.
---------------------------------------------------------------- ----------------------------------------------------------------
In addition to the example programs here, there are also two sets OpenMM's native API is in C++, however it also comes with
of wrappers to enable C and Fortran 95 to call the automatically-generated C and Fortran 95 bindings for that API.
OpenMM API. However, even if your calling code is in C or Fortran, However, even if your calling code is in C or Fortran,
please consider instead writing your OpenMM-calling routines in please consider instead writing your OpenMM-calling routines in
C++, using 'extern "C"' so that your main program can call them. C++, using 'extern "C"' so that your main program can call them.
If that isn't feasible for you, try out our wrappers If that isn't feasible for you, you can use the C or Fortran 95
and let us know what troubles or better ideas you have. (Post to bindings.
the OpenMM Forum at the above URL.)
Building the examples Building the examples
--------------------- ---------------------
...@@ -49,7 +47,7 @@ for C++ and C, and Intel's "ifort" Fortran compiler. ...@@ -49,7 +47,7 @@ for C++ and C, and Intel's "ifort" Fortran compiler.
There is a subdirectory here providing Visual Studio "solutions" There is a subdirectory here providing Visual Studio "solutions"
for building HelloArgon in C++, C, and Fortran. You will have to for building HelloArgon in C++, C, and Fortran. You will have to
make your own for the other examples or just substitute a different make your own for the other examples or just substitute a different
source file for HelloArgon.cpp. source file for HelloArgon.
HelloArgon (C++, C, Fortran 95) HelloArgon (C++, C, Fortran 95)
------------------------------- -------------------------------
...@@ -87,12 +85,17 @@ It is organized like the previous two. ...@@ -87,12 +85,17 @@ It is organized like the previous two.
C Wrapper C Wrapper
--------- ---------
This consists of two files: The folling header file is available in the OpenMM/include
directory (where you installed OpenMM):
OpenMMCWrapper.h OpenMMCWrapper.h
OpenMMCWrapper.cpp
The C functions it declares are built in to the main OpenMM
library that you link with. If you are building your own
OpenMM, be sure to enable the OPENMM_BUILD_API_WRAPPERS
CMake option.
Your C code (and the C examples above) include the header file Your C code (and the C examples above) include the header file
and link with OpenMMCWrapper.o along with the OpenMM library. and link with the OpenMM library.
Consult the code or the example programs to figure out how Consult the code or the example programs to figure out how
to use the wrappers; they are for the most part a very to use the wrappers; they are for the most part a very
straightforward rehashing of the well-documented OpenMM C++ straightforward rehashing of the well-documented OpenMM C++
...@@ -101,16 +104,18 @@ API. ...@@ -101,16 +104,18 @@ API.
Fortran Wrapper Fortran Wrapper
--------------- ---------------
The files that define the OpenMM Fortran bindings are: The file that defines the OpenMM Fortran bindings is in the
OpenMM/include directory (where you installed OpenMM):
OpenMMFortranModule.f90 OpenMMFortranModule.f90
OpenMMFortranWrapper.cpp
You have to compile this .f90 file yourself so that you
This consists of a Fortran 95 Module "OpenMM" so that your get appropriate OpenMM*.mod module files. This allows your
Fortran program units have "use OpenMM" statements. You will Fortran program units to have "use OpenMM" statements.
need access to the OpenMM*.mod files generated for the modules,
and you must also link with the OpenMMCWrapper.o as described The functions described there are built in to the main OpenMM
above for C, PLUS the OpenMMFortranWrapper.o. That's because library that you link with. If you are building your own
the Fortran Wrapper makes use of the C Wrapper. OpenMM, be sure to enable the OPENMM_BUILD_API_WRAPPERS
CMake option.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment