Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Commit

Permalink
fix findlibigl
Browse files Browse the repository at this point in the history
  • Loading branch information
alecjacobson committed Oct 17, 2016
1 parent caa7b0a commit 66cd3ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 169 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Expand Up @@ -11,11 +11,6 @@ cmake_minimum_required(VERSION 2.6)
project(libigl_unit_tests)
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")

option(LIBIGL_USE_STATIC_LIBRARY "Use static library" OFF)
if(LIBIGL_USE_STATIC_LIBRARY)
add_definitions(-DIGL_STATIC_LIBRARY)
endif(LIBIGL_USE_STATIC_LIBRARY)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

find_package(LIBIGL QUIET)
Expand Down
166 changes: 2 additions & 164 deletions cmake/FindLIBIGL.cmake
Expand Up @@ -31,168 +31,6 @@ if(LIBIGL_INCLUDE_DIR)
#set(LIBIGL_SOURCES
# ${LIBIGL_INCLUDE_DIR}/igl/viewer/Viewer.cpp
#)
endif(LIBIGL_INCLUDE_DIR)
endif()

if(LIBIGL_USE_STATIC_LIBRARY)
add_definitions(-DIGL_STATIC_LIBRARY)
set(LIBIGL_LIB_DIRS
${CMAKE_BINARY_DIR}/
${PROJECT_SOURCE_DIR}/../../lib
${PROJECT_SOURCE_DIR}/../lib
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/../../libigl/lib
${PROJECT_SOURCE_DIR}/../libigl/lib
$ENV{LIBIGL}/lib
$ENV{LIBIGLROOT}/lib
$ENV{LIBIGL_ROOT}/lib
$ENV{LIBIGL_DIR}/lib
/usr/lib
/usr/local/lib)
FIND_LIBRARY( LIBIGL_LIBRARY NAMES igl PATHS ${LIBIGL_LIB_DIRS})

# try to find pre-requisites
find_package(CORK QUIET)
find_package(CGAL QUIET)
find_package(EMBREE QUIET)
find_package(LIBCOMISO QUIET)
find_package(MATLAB QUIET)
find_package(MOSEK QUIET)
find_package(TETGEN QUIET)
find_package(TINYXML2 QUIET)
find_package(TRIANGLE QUIET)

# Main library must be found
if(NOT LIBIGL_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libigl")
endif(NOT LIBIGL_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGL_LIBRARY})

# libiglbbw will work with/without mosek
FIND_LIBRARY( LIBIGLBBW_LIBRARY NAMES iglbbw PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLBBW_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglbbw")
endif(NOT LIBIGLBBW_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLBBW_LIBRARY})

if(LIBCOMISO_FOUND)
FIND_LIBRARY(LIBIGLCOMISO_LIBRARY NAMES iglcomiso PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLCOMISO_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglcomiso")
endif(NOT LIBIGLCOMISO_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLCOMISO_LIBRARY})
endif(LIBCOMISO_FOUND)

if(CGAL_FOUND)
FIND_LIBRARY( LIBIGLBOOLEAN_LIBRARY NAMES iglboolean PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLBOOLEAN_LIBRARY)
message(FATAL_ERROR "could NOT find libiglboolean ")
endif(NOT LIBIGLBOOLEAN_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLBOOLEAN_LIBRARY})

FIND_LIBRARY( LIBIGLCGAL_LIBRARY NAMES iglcgal PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLCGAL_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglcgal")
endif(NOT LIBIGLCGAL_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLCGAL_LIBRARY})
endif(CGAL_FOUND)

if(EMBREE_FOUND)
FIND_LIBRARY( LIBIGLEMBREE_LIBRARY NAMES iglembree PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLEMBREE_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglembree")
endif(NOT LIBIGLEMBREE_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLEMBREE_LIBRARY})
endif(EMBREE_FOUND)

if(LIM_FOUND)
FIND_LIBRARY( LIBIGLLIM_LIBRARY NAMES igllim PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLLIM_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libigllim")
endif(NOT LIBIGLLIM_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLLIM_LIBRARY})
endif(LIM_FOUND)

if(MATLAB_FOUND)
FIND_LIBRARY( LIBIGLMATLAB_LIBRARY NAMES iglmatlab PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLMATLAB_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglmatlab")
endif(NOT LIBIGLMATLAB_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLMATLAB_LIBRARY})
endif(MATLAB_FOUND)

# mosek support should be determined before trying to find bbw
if(MOSEK_FOUND)
FIND_LIBRARY( LIBIGLMOSEK_LIBRARY NAMES iglmosek PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLMOSEK_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglmosek")
endif(NOT LIBIGLMOSEK_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLMOSEK_LIBRARY})
endif(MOSEK_FOUND)

if(TETGEN_FOUND)
FIND_LIBRARY( LIBIGLTETGEN_LIBRARY NAMES igltetgen PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLTETGEN_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libigltetgen")
endif(NOT LIBIGLTETGEN_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLTETGEN_LIBRARY})
endif(TETGEN_FOUND)

if(TINYXML2_FOUND)
FIND_LIBRARY( LIBIGLXML_LIBRARY NAMES iglxml PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLXML_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglxml")
endif(NOT LIBIGLXML_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLXML_LIBRARY})
endif(TINYXML2_FOUND)

if(TRIANGLE_FOUND)
FIND_LIBRARY( LIBIGLTRIANGLE_LIBRARY NAMES igltriangle PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLTRIANGLE_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libigltriangle")
endif(NOT LIBIGLTRIANGLE_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLTRIANGLE_LIBRARY})
endif(TRIANGLE_FOUND)

# libiglviewer is required
FIND_LIBRARY( LIBIGLVIEWER_LIBRARY NAMES iglviewer PATHS ${LIBIGL_LIB_DIRS})
if(NOT LIBIGLVIEWER_LIBRARY)
set(LIBIGL_FOUND FALSE)
message(FATAL_ERROR "could NOT find libiglviewer")
endif(NOT LIBIGLVIEWER_LIBRARY)
set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLVIEWER_LIBRARY})

find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(OPENMP_FOUND)


endif(LIBIGL_USE_STATIC_LIBRARY)



if(LIBIGL_FOUND)
if(NOT LIBIGL_FIND_QUIETLY)
message(STATUS "Found LIBIGL: ${LIBIGL_INCLUDE_DIR}")
endif(NOT LIBIGL_FIND_QUIETLY)
else(LIBIGL_FOUND)
if(LIBIGL_FIND_REQUIRED)
message(FATAL_ERROR "could NOT find LIBIGL")
endif(LIBIGL_FIND_REQUIRED)
endif(LIBIGL_FOUND)

MARK_AS_ADVANCED(LIBIGL_INCLUDE_DIRS LIBIGL_INCLUDE_DIR LIBIGL_LIBRARIES IGL_VIEWER_SOURCES)

endif(NOT LIBIGL_FOUND)
endif()

0 comments on commit 66cd3ff

Please sign in to comment.