Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Msvc portability fix #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
25 changes: 19 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,19 @@ endif()
# Dépendance (fonctions, libs, etc) #
############################################################
include (CheckFunctionExists)
check_function_exists(strsep HAVE_STRSEP)
check_function_exists(isfdtype HAVE_ISFDTYPE)
#check_function_exists(strsep HAVE_STRSEP)
#check_function_exists(isfdtype HAVE_ISFDTYPE)

find_package(ZLIB REQUIRED)
message("ZLIB_LIBRARIES: ${ZLIB_LIBRARIES}")
message("ZLIB_INCLUDE_DIRS: ${ZLIB_INCLUDE_DIRS}")

if(NOT ZLIB_FOUND)
message("ZLib find package")
find_package(ZLIB REQUIRED)
endif()
if (ZLIB_FOUND)
message(STATUS "ZLIB library: ${ZLIB_LIBRARIES}")
include_directories(${ZLIB_INCLUDE_DIRS})
set (EXT_LIBS ${EXT_LIBS} ${ZLIB_LIBRARIES})
set (${PROJECT_NAME}_EXT_LIBS ${${PROJECT_NAME}_EXT_LIBS} ${ZLIB_LIBRARIES})
endif()

if(WITH-MYSQL)
Expand All @@ -112,7 +117,7 @@ if(WITH-MYSQL)
if(MYSQLPP_FOUND)
message(STATUS "Using MySQL++: YES")
include_directories(${MYSQLPP_INCLUDE_DIR})
set (EXT_LIBS ${EXT_LIBS} ${MYSQLPP_LIBRARIES})
set (${PROJECT_NAME}_EXT_LIBS ${${PROJECT_NAME}_EXT_LIBS} ${MYSQLPP_LIBRARIES})
else(MYSQLPP_FOUND)
message(STATUS "Using MySQL++: NO")
endif(MYSQLPP_FOUND)
Expand All @@ -134,6 +139,9 @@ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/config.h
# pour que config.h puisse être trouvé
include_directories ("${PROJECT_BINARY_DIR}")

set(MCCORE_PUBLIC_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/mccore")
include_directories (${MCCORE_PUBLIC_INCLUDE_DIRS})

# ajoute le sous-répertoire de la librarie pour que le CMakeList.txt soit exécuter
add_subdirectory ("${CMAKE_CURRENT_SOURCE_DIR}/lib")

Expand Down Expand Up @@ -178,3 +186,8 @@ INCLUDE(CPack)

# enable dashboard scripting
#include (CTest)

# Expose mccore public includes to other subprojects through cache variable.
set(${PROJECT_NAME}_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}
CACHE INTERNAL "${PROJECT_NAME}: Include Directories" FORCE)
set(${PROJECT_NAME}_LIBRARIES ${PACKAGE_NAME} CACHE INTERNAL "${PROJECT_NAME}: Library")
6 changes: 3 additions & 3 deletions lib/AbstractModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

// cmake generated defines
#include <config.h>
#include "config.h"

#include <algorithm>
#include <string.h>
Expand Down Expand Up @@ -107,7 +107,7 @@ namespace mccore


AbstractModel::iterator
AbstractModel::safeFind (const ResId &id) throw (NoSuchElementException)
AbstractModel::safeFind (const ResId &id)
{
iterator it;

Expand All @@ -124,7 +124,7 @@ namespace mccore


AbstractModel::const_iterator
AbstractModel::safeFind (const ResId &id) const throw (NoSuchElementException)
AbstractModel::safeFind (const ResId &id) const
{
const_iterator it;

Expand Down
25 changes: 11 additions & 14 deletions lib/AtomSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
// cmake generated defines
#include <config.h>

#include <algorithm>
#include <ctype.h>
#include <string>
#include <string.h>

#include "AtomSet.h"
Expand Down Expand Up @@ -130,27 +132,22 @@ namespace mccore {
AtomSet*
AtomSet::create (const char* str)
{
unsigned int i;
size_t sz = strlen(str);
char* lstr = reinterpret_cast<char*>(alloca(sz + 1));

for (i = 0; i < sz; ++i)
lstr[i] = tolower (str[i]);
lstr[i] = '\0';
std::string lstr = str;
std::transform(lstr.begin(), lstr.end(), lstr.begin(), ::tolower);

if (0 == strcmp (lstr, AtomSetAll::representation))
if (0 == lstr.compare (AtomSetAll::representation))
return new AtomSetAll ();
else if (0 == strcmp (lstr, AtomSetBackbone::representation))
else if (0 == lstr.compare(AtomSetBackbone::representation))
return new AtomSetBackbone ();
else if (0 == strcmp (lstr, AtomSetPhosphate::representation))
else if (0 == lstr.compare(AtomSetPhosphate::representation))
return new AtomSetPhosphate ();
else if (0 == strcmp (lstr, AtomSetSideChain::representation))
else if (0 == lstr.compare(AtomSetSideChain::representation))
return new AtomSetSideChain ();
else if (0 == strcmp (lstr, AtomSetPSE::representation))
else if (0 == lstr.compare(AtomSetPSE::representation))
return new AtomSetPSE ();
else if (0 == strcmp (lstr, AtomSetLP::representation))
else if (0 == lstr.compare(AtomSetLP::representation))
return new AtomSetLP ();
else if (0 == strcmp (lstr, AtomSetHydrogen::representation))
else if (0 == lstr.compare(AtomSetHydrogen::representation))
return new AtomSetHydrogen ();
else
{
Expand Down
2 changes: 1 addition & 1 deletion lib/AtomType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ namespace mccore
const AtomType* AtomType::aCM1 = 0;


AtomType::AtomType (const AtomType &other)
AtomType::AtomType (const AtomType &)
{
FatalIntLibException ex ("", __FILE__, __LINE__);
ex << "Use of copy constructor for class AtomType is prohibited.";
Expand Down
Loading