Skip to content

Commit

Permalink
Fix ptrdiff/int64 bug with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck Pérignon committed Mar 3, 2016
1 parent a60662c commit e0b39b0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
23 changes: 15 additions & 8 deletions cmake/SiconosTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ ENDMACRO(PRINT_VAR V)
MACRO(COMPILE_WITH)

set(options REQUIRED)
set(oneValueArgs)
set(oneValueArgs ONLY)
set(multiValueArgs COMPONENTS)

cmake_parse_arguments(COMPILE_WITH "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )

set(_NAME)
Expand Down Expand Up @@ -172,6 +172,7 @@ MACRO(COMPILE_WITH)

FIND_PACKAGE(${_NAME} ${_NAME_VERSION} ${_COMPONENTS} ${_REQUIRED})

set(_LINK_LIBRARIES)
FOREACH(_N ${_NAMES})
IF(${_N}_FOUND)
SET(_FOUND TRUE)
Expand All @@ -190,8 +191,7 @@ MACRO(COMPILE_WITH)
endif()
# Now we set list of libs that must be linked with.
if(DEFINED ${_N}_LIBRARIES)
set(SICONOS_LINK_LIBRARIES ${SICONOS_LINK_LIBRARIES}
${${_N}_LIBRARIES})
list(APPEND _LINK_LIBRARIES ${${_N}_LIBRARIES})
endif()
# And the compiler flags
if(DEFINED ${_N}_DEFINITIONS)
Expand All @@ -202,10 +202,17 @@ MACRO(COMPILE_WITH)
endif()
endif()
endforeach()
list(REMOVE_DUPLICATES SICONOS_LINK_LIBRARIES)
set(SICONOS_LINK_LIBRARIES ${SICONOS_LINK_LIBRARIES}
${${_N}_LIBRARIES} CACHE INTERNAL "List of external libraries.")

if(_LINK_LIBRARIES)
list(REMOVE_DUPLICATES _LINK_LIBRARIES)
endif()
if(COMPILE_WITH_ONLY)
set(_sico_component ${COMPILE_WITH_ONLY})
set(${_sico_component}_LINK_LIBRARIES ${${_sico_component}_LINK_LIBRARIES}
${_LINK_LIBRARIES} CACHE INTERNAL "List of external libraries for ${_sico_component}.")
else()
set(SICONOS_LINK_LIBRARIES ${SICONOS_LINK_LIBRARIES}
${_LINK_LIBRARIES} CACHE INTERNAL "List of external libraries.")
endif()

IF (_FOUND)
MESSAGE(STATUS "Compilation with ${_REQUIRED_STR} ${_COMPONENTS_STR} ${_NAME} ${_NAME_VERSION_STR}")
Expand Down
8 changes: 5 additions & 3 deletions cmake/siconos_find_common_dep.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ if(LpSolve_FOUND)
set(HAS_ONE_LP_SOLVER TRUE)
set(HAS_EXTREME_POINT_ALGO TRUE)
set(WITH_LPSOLVE TRUE)
string(REPLACE "-Werror=conversion" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
if(WITH_CXX)
string(REPLACE "-Werror=conversion" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
string(REPLACE "-Werror=conversion" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
endif(LpSolve_FOUND)

Expand Down Expand Up @@ -82,7 +84,7 @@ ENDIF(WITH_BULLET)
# --- OCC ---
IF(WITH_OCC)
if(NOT WITH_MECHANISMS)
COMPILE_WITH(OCE 0.15 REQUIRED)
COMPILE_WITH(OCE 0.15 REQUIRED ONLY mechanics)
SET(HAVE_OCC TRUE)
LIST(REMOVE_ITEM SICONOS_LINK_LIBRARIES DRAWEXE)
endif()
Expand All @@ -93,7 +95,7 @@ IF(WITH_MECHANISMS)
SET(OCE_TOOLKITS "TKernel" "TKMath" "TKService" "TKV3d" "TKBRep" "TKIGES" "TKSTL" "TKVRML" "TKSTEP" "TKSTEPAttr" "TKSTEP209" "TKSTEPBase" "TKShapeSchema" "TKGeomBase" "TKGeomAlgo" "TKG3d" "TKG2d" "TKXSBase" "TKPShape" "TKShHealing" "TKHLR" "TKTopAlgo" "TKMesh" "TKPrim" "TKCDF" "TKBool" "TKBO" "TKFillet" "TKOffset")

message(STATUS "Searching for OCE ....")
compile_with(OCE COMPONENTS ${OCE_TOOLKITS})
compile_with(OCE COMPONENTS ${OCE_TOOLKITS} ONLY mechanics)
LIST(REMOVE_ITEM SICONOS_LINK_LIBRARIES DRAWEXE)

if(OCE_FOUND)
Expand Down
6 changes: 5 additions & 1 deletion externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ set(${COMPONENT}_DIRS
hairer
netlib/dftemplates
netlib/odepack
numeric_bindings
ql0001
SOL/lumod-c
SuiteSparse/CSparse
tools
)

if(WITH_CXX)
list(APPEND ${COMPONENT}_DIRS numeric_bindings)
endif()


# Unstable sources. Will be included only
# if WITH_${COMPONENT}_UNSTABLE is true.
set(${COMPONENT}_Unstable_SRCS)
Expand Down
10 changes: 9 additions & 1 deletion externals/SuiteSparse/CSparse/csparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
#define csi mwSignedIndex
#endif
#ifndef csi
#define csi ptrdiff_t
#include "SiconosConfig.h"
#include <stdint.h>

#ifdef SICONOS_INT64
#define csi int64_t
#else
#define csi int32_t
#endif
//#define csi ptrdiff_t
#endif

/* --- primary CSparse routines and data structures ------------------------- */
Expand Down

0 comments on commit e0b39b0

Please sign in to comment.