Commit 832794f5 authored by Peter Eastman's avatar Peter Eastman
Browse files

Tony's changes to fix errors on Windows

parent 94ecc958
......@@ -159,9 +159,9 @@ static HMODULE loadOneLibrary(const string& file) {
HMODULE handle = LoadLibrary(file.c_str());
SetErrorMode(oldErrorMode); // Restore previous error mode.
if (handle == NULL) {
string message;
stringstream(message) << "Error loading library " << file << ": " << GetLastError();
throw OpenMMException(message);
stringstream message;
message << "Error loading library " << file << ": " << GetLastError();
throw OpenMMException(message.str());
}
return handle;
}
......
......@@ -5,9 +5,14 @@ CONFIGURE_FILE(${CL_SOURCE_DIR}/${CL_SOURCE_CLASS}.cpp.in ${CL_KERNELS_CPP})
FOREACH(file ${OPENCL_KERNELS})
# Load the file contents and process it.
FILE(STRINGS ${file} file_content NEWLINE_CONSUME)
STRING(REPLACE \\\n \\\\\n file_content "${file_content}")
STRING(REPLACE \" \\\" file_content "${file_content}")
STRING(REPLACE \n \\n\"\n\" file_content "${file_content}")
# Replace all backslashes by double backslashes as they are being put in a C string.
# Be careful not to replace the backslash before a semicolon as that is the CMAKE
# internal escaping of a semicolon to prevent it from acting as a list seperator.
STRING(REGEX REPLACE "\\\\([^;])" "\\\\\\\\\\1" file_content "${file_content}")
# Escape double quotes as being put in a C string.
STRING(REPLACE "\"" "\\\"" file_content "${file_content}")
# Split in separate C strings for each line.
STRING(REPLACE "\n" "\\n\"\n\"" file_content "${file_content}")
# Determine a name for the variable that will contain this file's contents
FILE(RELATIVE_PATH filename ${CL_SOURCE_DIR}/kernels ${file})
......
......@@ -27,6 +27,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/windowsExport.h"
#include <string>
namespace OpenMM {
......@@ -37,7 +38,7 @@ namespace OpenMM {
* kernels subfolder.
*/
class OpenCLKernelSources {
class OPENMM_EXPORT OpenCLKernelSources {
public:
@CL_FILE_DECLARATIONS@
};
......
......@@ -75,7 +75,7 @@ namespace OpenMM {
*/
template <class TRAIT>
class OPENMM_EXPORT OpenCLSort {
class OpenCLSort {
public:
/**
* Create an OpenCLSort object for sorting data of a particular type.
......
......@@ -344,7 +344,7 @@ void ReferenceCCMAAlgorithm::setTolerance( RealOpenMM tolerance ){
int ReferenceCCMAAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoordinates,
vector<RealVec>& atomCoordinatesP,
vector<RealOpenMM>& inverseMasses ){
applyConstraints(numberOfAtoms, atomCoordinates, atomCoordinatesP, inverseMasses, false);
return applyConstraints(numberOfAtoms, atomCoordinates, atomCoordinatesP, inverseMasses, false);
}
/**---------------------------------------------------------------------------------------
......@@ -363,7 +363,7 @@ int ReferenceCCMAAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoord
int ReferenceCCMAAlgorithm::applyToVelocities(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates,
std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses) {
applyConstraints(numberOfAtoms, atomCoordinates, velocities, inverseMasses, true);
return applyConstraints(numberOfAtoms, atomCoordinates, velocities, inverseMasses, true);
}
int ReferenceCCMAAlgorithm::applyConstraints(int numberOfAtoms, vector<RealVec>& atomCoordinates,
......
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