Skip to content

Commit ac0e461

Browse files
committed
more find modules
1 parent 5e6d3f2 commit ac0e461

8 files changed

Lines changed: 236 additions & 30 deletions

File tree

cmake/FindGLFW.cmake

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
#.rst:
2+
# FindGLFW
3+
# ------------
4+
#
5+
# Locate glfw3 library
6+
#
7+
# This module defines
8+
#
9+
# ::
10+
#
11+
# GLFW_LIBRARIES, the library to link against
12+
# GLFW_FOUND, if false, do not try to link to FREETYPE
13+
# GLFW_INCLUDE_DIRS, where to find headers.
14+
# This is the concatenation of the paths:
15+
# GLFW_INCLUDE_DIR
16+
#
17+
#=============================================================================
18+
# Copyright 2014-2014 Martell Malone
19+
#
20+
# Distributed under the OSI-approved BSD License (the "License");
21+
# see accompanying file Copyright.txt for details.
22+
#
23+
# This software is distributed WITHOUT ANY WARRANTY; without even the
24+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25+
# See the License for more information.
26+
#=============================================================================
27+
# (To distribute this file outside of CMake, substitute the full
28+
# License text for the above reference.)
29+
30+
# glfw has special requirements for linking (from docs: http://www.glfw.org/docs/latest/build.html)
31+
# MINGW or MSVC + static "glfw3" -> link: opengl32, gdi32 (plus glu32 if use GLU)
32+
# MINGW or MSVC + dynamic "glfw3dll" (but this not true ;) -> -DGLFW_DLL link: no
33+
# UNIX + static -> pkg-config --static --libs
34+
# UNIX + dynamic -> pkg-config --libs
35+
# So... if we find dynamic version, no problems, but if we find static, we need to determine deps
36+
# but cmake can't simply say to us what kind of library it found. So we try to find static version
37+
# first, and then if nothing found, we repeat search for dynamic
38+
39+
find_package(PkgConfig)
40+
if(PKG_CONFIG_FOUND)
41+
message(STATUS "PkgConfig found")
42+
else()
43+
message(STATUS "PkgConfig not found, if you have only static glfw library, you build can fail")
44+
endif()
45+
46+
if(PKG_CONFIG_FOUND)
47+
# Save some global stuff that we change, to revert after work has been done
48+
set(_saved_PKG_CONFIG_PATH "$ENV{PKG_CONFIG_PATH}")
49+
set(_saved_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
50+
51+
# add /usr/local/lib/pkgconfig to pkg-config search path (some linuxes do not do that, but glfw installs to taht prefix by default)
52+
file(TO_CMAKE_PATH "$ENV{PKG_CONFIG_PATH}" PKG_CONFIG_PATH)
53+
list(APPEND PKG_CONFIG_PATH "/usr/local/lib/pkgconfig")
54+
file(TO_NATIVE_PATH "${PKG_CONFIG_PATH}" new_pkg_config_path)
55+
set(ENV{PKG_CONFIG_PATH} "${new_pkg_config_path}")
56+
57+
# now try to find glfw with pkg-config
58+
pkg_check_modules(PC_GLFW3 glfw3)
59+
if(PC_GLFW3_FOUND)
60+
61+
# try to find static library
62+
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
63+
find_library(GLFW3_STATIC_LIBRARY NAMES glfw3 libglfw3 PATHS ${PC_GLFW3_LIBRARY_DIRS} NO_DEFAULT_PATH)
64+
find_library(GLFW3_STATIC_LIBRARY NAMES glfw3 libglfw3 PATHS ${PC_GLFW3_LIBRARY_DIRS})
65+
# also we include glfw3.h header, not GLFW/glfw3.h :(
66+
find_path(GLFW3_INCLUDE_DIRS glfw3.h GLFW/glfw PATH_SUFFIXES GLFW PATHS ${PC_GLFW3_INCLUDE_DIRS} NO_DEFAULT_PATH)
67+
find_path(GLFW3_INCLUDE_DIRS glfw3.h PATH_SUFFIXES GLFW PATHS ${PC_GLFW3_INCLUDE_DIRS})
68+
MESSAGE("${GLFW3_STATIC_LIBRARY}")
69+
MESSAGE(${GLFW3_STATIC_LIBRARY})
70+
if(GLFW3_STATIC_LIBRARY)
71+
# glfw3 is static
72+
set(GLFW_LIBRARIES ${PC_GLFW3_STATIC_LIBRARIES})
73+
set(GLFW_LIBRARY_DIRS ${PC_GLFW3_STATIC_LIBRARY_DIRS})
74+
75+
# We also need to add any other LDFLAGS, but with additional fixup for Apple frameworks :(
76+
if(APPLE)
77+
unset(_is_framework)
78+
foreach(_arg ${PC_GLFW3_STATIC_LDFLAGS_OTHER})
79+
if(_is_framework)
80+
set(var FRAMEWORK_${_arg}_LIBRARY)
81+
find_library(${var} ${_arg})
82+
if(${var})
83+
list(APPEND GLFW_LIBRARIES ${${var}})
84+
endif()
85+
unset(var)
86+
unset(_is_framework)
87+
else()
88+
if(_arg STREQUAL "-framework")
89+
set(_is_framework 1)
90+
else()
91+
list(APPEND GLFW_LIBRARIES ${_arg})
92+
endif()
93+
endif()
94+
endforeach()
95+
else(APPLE)
96+
list(APPEND GLFW_LIBRARIES ${PC_GLFW3_STATIC_LDFLAGS_OTHER})
97+
endif(APPLE)
98+
99+
else()
100+
# glfw3 is dynamic
101+
set(GLFW_DEFINITIONS -DGLFW_DLL)
102+
set(GLFW_LIBRARIES ${PC_GLFW3_LIBRARIES})
103+
set(GLFW_LIBRARY_DIRS ${PC_GLFW3_LIBRARY_DIRS})
104+
105+
endif()
106+
set(GLFW3_FOUND 1)
107+
108+
endif()
109+
110+
# Restore global stuff
111+
set(CMAKE_FIND_LIBRARY_SUFFIXES "${_saved_CMAKE_FIND_LIBRARY_SUFFIXES}")
112+
set(ENV{PKG_CONFIG_PATH} "${_saved_PKG_CONFIG_PATH}")
113+
endif(PKG_CONFIG_FOUND)
114+
115+
# fallback if pkg-config method not work
116+
if(NOT GLFW3_FOUND)
117+
118+
find_path(GLFW3_INCLUDE_DIR GLFW/glfw3.h
119+
$ENV{GLFW_ROOT}
120+
HINTS
121+
ENV GLFW3_DIR
122+
PATH_SUFFIXES include/GLFW include
123+
PATHS
124+
/opt/glfw3/current/include/
125+
/usr/include/
126+
/usr/local/include/
127+
~/Library/Frameworks
128+
/Library/Frameworks
129+
/usr/local
130+
/usr
131+
/sw # Fink
132+
/opt/local # DarwinPorts
133+
/opt/csw # Blastwave
134+
/opt
135+
/opt/glfw3/current/include/
136+
# By default headers are under GLFW subfolder
137+
/usr/include/GLFW
138+
/usr/local/include/GLFW
139+
${GLOBAL_EXT_DIR}/glfw/include
140+
${GLFW_ROOT_DIR}/include/ # added by ptr
141+
)
142+
find_library(GLFW3_LIBRARY
143+
NAMES glfw3 libglfw3 glfw glfw3dll
144+
HINTS
145+
ENV GLFW3_DIR
146+
PATH_SUFFIXES lib
147+
PATHS
148+
~/Library/Frameworks
149+
/Library/Frameworks
150+
/usr/local
151+
/usr
152+
/sw
153+
/opt/local
154+
/opt/csw
155+
/opt
156+
/opt/glfw3/current/lib
157+
)
158+
159+
IF(MSVC)
160+
# VisualStudio needs a debug version
161+
162+
find_library(GLFW3_LIBRARY_DEBUG
163+
NAMES glfw3d libglfw3d glfwd glfw3dlld
164+
HINTS
165+
ENV GLFW3_DIR
166+
PATH_SUFFIXES lib
167+
PATHS
168+
~/Library/Frameworks
169+
/Library/Frameworks
170+
/usr/local
171+
/usr
172+
/sw
173+
/opt/local
174+
/opt/csw
175+
/opt
176+
/opt/glfw3/current/lib
177+
)
178+
179+
IF(GLFW3_LIBRARY_DEBUG AND GLFW3_LIBRARY)
180+
SET(GLFW3_LIBRARIES optimized ${GLFW3_LIBRARY} debug ${GLFW3_LIBRARY_DEBUG} )
181+
SET(GLFW_LIBRARIES optimized ${GLFW3_LIBRARY} debug ${GLFW3_LIBRARY_DEBUG} )
182+
ENDIF(GLFW3_LIBRARY_DEBUG AND GLFW3_LIBRARY)
183+
184+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 DEFAULT_MSG GLFW3_LIBRARY GLFW3_LIBRARY_DEBUG GLFW3_INCLUDE_DIR)
185+
186+
MARK_AS_ADVANCED(GLFW3_LIBRARY GLFW3_LIBRARY_DEBUG GLFW3_INCLUDE_DIR)
187+
188+
ELSE(MSVC)
189+
190+
set(GLFW_LIBRARIES "${GLFW3_LIBRARY}")
191+
set(GLFW3_LIBRARIES "${GLFW3_LIBRARY}")
192+
193+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
194+
find_package_handle_standard_args(GLFW3 DEFAULT_MSG GLFW3_LIBRARIES GLFW3_INCLUDE_DIRS)
195+
196+
ENDIF(MSVC)
197+
198+
set(GLFW_INCLUDE_DIRS "${GLFW3_INCLUDE_DIR}")
199+
200+
endif()
201+
202+
mark_as_advanced(GLFW_INCLUDE_DIR GLFW_LIBRARIES GLFW_LIBRARY)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ENDIF(LAMURE_INCLUDE_DIR)
1212
FIND_PATH(LAMURE_INCLUDE_DIR "lamure/config.h"
1313
PATHS
1414
$ENV{LAMURE_HOME}/include
15+
$ENV{EXTERNLIBS}/lamure/include
1516
$ENV{EXTERNLIBS}/Lamure/include
1617
~/Library/Frameworks/include
1718
/Library/Frameworks/include

cmake/FindSCHISM.cmake

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,17 @@ SET(SCHISM_LIBRARY_SEARCH_DIRS
2222
# check for schism
2323
##############################################################################
2424

25-
IF ( NOT SCHISM_INCLUDE_DIRS )
26-
27-
FOREACH(_SEARCH_DIR ${SCHISM_INCLUDE_SEARCH_DIRS})
28-
FIND_PATH(_CUR_SEARCH
29-
NAMES scm_gl_core/src/scm/gl_core.h scm/gl_core.h
30-
PATHS ${_SEARCH_DIR}
25+
MESSAGE("SEARCHING")
26+
FIND_PATH(SCHISM_INCLUDE_DIR
27+
NAMES scm_gl_core/src/scm/gl_core.h
28+
PATHS ${SCHISM_INCLUDE_SEARCH_DIRS}
3129
NO_DEFAULT_PATH)
32-
IF (_CUR_SEARCH)
33-
LIST(APPEND _SCHISM_FOUND_INC_DIRS ${_CUR_SEARCH})
34-
ENDIF(_CUR_SEARCH)
35-
SET(_CUR_SEARCH _CUR_SEARCH-NOTFOUND CACHE INTERNAL "internal use")
36-
ENDFOREACH(_SEARCH_DIR ${SCHISM_INCLUDE_SEARCH_DIRS})
37-
38-
39-
FOREACH(_INC_DIR ${_SCHISM_FOUND_INC_DIRS})
40-
LIST(APPEND _SCHISM_INCLUDE_DIRS ${_INC_DIR}/scm_cl_core/src)
41-
LIST(APPEND _SCHISM_INCLUDE_DIRS ${_INC_DIR}/scm_core/src)
42-
LIST(APPEND _SCHISM_INCLUDE_DIRS ${_INC_DIR}/scm_gl_core/src)
43-
LIST(APPEND _SCHISM_INCLUDE_DIRS ${_INC_DIR}/scm_gl_util/src)
44-
LIST(APPEND _SCHISM_INCLUDE_DIRS ${_INC_DIR}/scm_input/src)
45-
ENDFOREACH(_INC_DIR ${_BOOST_FOUND_INC_DIRS})
46-
47-
IF (_SCHISM_FOUND_INC_DIRS)
48-
SET(SCHISM_INCLUDE_DIRS ${_SCHISM_INCLUDE_DIRS} CACHE PATH "path to schism headers.")
49-
ENDIF (_SCHISM_FOUND_INC_DIRS)
50-
51-
ENDIF ( NOT SCHISM_INCLUDE_DIRS )
52-
53-
# release libraries
30+
LIST(APPEND SCHISM_INCLUDE_DIRS ${SCHISM_INCLUDE_SEARCH_DIRS}/scm_cl_core/src)
31+
LIST(APPEND SCHISM_INCLUDE_DIRS ${SCHISM_INCLUDE_SEARCH_DIRS}/scm_core/src)
32+
LIST(APPEND SCHISM_INCLUDE_DIRS ${SCHISM_INCLUDE_SEARCH_DIRS}/scm_gl_core/src)
33+
LIST(APPEND SCHISM_INCLUDE_DIRS ${SCHISM_INCLUDE_SEARCH_DIRS}/scm_gl_util/src)
34+
LIST(APPEND SCHISM_INCLUDE_DIRS ${SCHISM_INCLUDE_SEARCH_DIRS}/scm_input/src)
35+
5436
find_library(SCHISM_CORE_LIBRARY
5537
NAMES scm_core libscm_core
5638
PATHS ${SCHISM_LIBRARY_SEARCH_DIRS}

cmake/Using/UseFREETYPE.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ MACRO(USE_FREETYPE)
1111
SET(FREETYPE_USED TRUE)
1212
INCLUDE_DIRECTORIES(SYSTEM ${FREETYPE_INCLUDE_DIRS})
1313
SET(EXTRA_LIBS ${EXTRA_LIBS} ${FREETYPE_LIBRARIES})
14+
SET(EXTRA_LIBS ${EXTRA_LIBS} ${FREETYPE_LIBRARY_RELEASE})
1415
ENDIF()
1516
ENDMACRO(USE_FREETYPE)
1617

cmake/Using/UseGLFW.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
MACRO(USE_GLFW)
2+
COVISE_FIND_PACKAGE(GLFW)
3+
IF ((NOT GLFW3_FOUND) AND (${ARGC} LESS 1))
4+
USING_MESSAGE("Skipping because of missing GLFW")
5+
RETURN()
6+
ENDIF((NOT GLFW3_FOUND) AND (${ARGC} LESS 1))
7+
IF(NOT GLFW_USED AND GLFW3_FOUND)
8+
USE_OPENGL(${ARGN})
9+
SET(GLFW_USED TRUE)
10+
ADD_DEFINITIONS(-DHAVE_GLFW)
11+
INCLUDE_DIRECTORIES(SYSTEM ${GLFW3_INCLUDE_DIRS})
12+
MESSAGE("GLFW_LIBRARIES")
13+
MESSAGE(${GLFW_LIBRARIES})
14+
SET(EXTRA_LIBS ${EXTRA_LIBS} ${GLFW_LIBRARY} -lglfw)
15+
ENDIF()
16+
ENDMACRO(USE_GLFW)
17+

cmake/Using/UseGLUT.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ MACRO(USE_GLUT)
1515
INCLUDE_DIRECTORIES(SYSTEM ${GLUT_INCLUDE_DIR})
1616
SET(EXTRA_LIBS ${EXTRA_LIBS} ${GLUT_LIBRARIES})
1717
IF(UNIX AND NOT APPLE)
18-
SET(EXTRA_LIBS ${EXTRA_LIBS} Xxf86vm)
18+
# who needs this? SET(EXTRA_LIBS ${EXTRA_LIBS} Xxf86vm)
1919
ENDIF()
2020
ENDIF()
2121
ENDMACRO(USE_GLUT)

cmake/Using/UseLamure.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
MACRO(USE_LAMURE)
22
COVISE_FIND_PACKAGE(LAMURE)
33
IF ((NOT LAMURE_FOUND) AND (${ARGC} LESS 1))
4+
MESSAGE("Lamure FOUND")
45
USING_MESSAGE("Skipping because of missing Lamure")
56
RETURN()
67
ENDIF((NOT LAMURE_FOUND) AND (${ARGC} LESS 1))
78
COVISE_FIND_PACKAGE(SCHISM)
9+
MESSAGE(${SCHISM_LIBRARIES})
810
COVISE_FIND_PACKAGE(FREEIMAGE)
11+
MESSAGE(${FREEIMAGE_LIBRARIES})
912
IF(NOT LAMURE_USED AND LAMURE_FOUND)
1013
SET(LAMURE_USED TRUE)
1114
INCLUDE_DIRECTORIES(SYSTEM ${LAMURE_INCLUDE_DIR} ${SCHISM_INCLUDE_DIRS})

config/config-filetypes.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<FileType name="gpx" plugin="GPS" />
1313
<FileType name="top" plugin="Amber" />
1414
<FileType name="trj" plugin="Amber" />
15-
<FileType name="bvh" plugin="Lamure" />
15+
<FileType name="bvh" plugin="LamurePointCloud" />
1616
<FileType name="ifc" plugin="IFC" />
1717
<FileType name="stp" plugin="IFC" />
1818
<FileType name="step" plugin="IFC" />

0 commit comments

Comments
 (0)