Skip to content

Commit 28700fb

Browse files
Third Partyax3l
authored andcommitted
Squashed 'thirdParty/cmake-modules/' content from commit a47312b
git-subtree-dir: thirdParty/cmake-modules git-subtree-split: a47312bc6bb2eb52a1ba101d6690d3189e1aca9a
0 parents  commit 28700fb

File tree

4 files changed

+730
-0
lines changed

4 files changed

+730
-0
lines changed

FindADIOS.cmake

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# - Find ADIOS library, routines for scientific, parallel IO
2+
# https://www.olcf.ornl.gov/center-projects/adios/
3+
#
4+
# Use this module by invoking find_package with the form:
5+
# find_package(ADIOS
6+
# [version] [EXACT] # Minimum or EXACT version, e.g. 1.6.0
7+
# [REQUIRED] # Fail with an error if ADIOS or a required
8+
# # component is not found
9+
# [QUIET] # ...
10+
# [COMPONENTS <...>] # Compiled in components, ignored
11+
# )
12+
#
13+
# Module that finds the includes and libraries for a working ADIOS install.
14+
# This module invokes the `adios_config` script that should be installed with
15+
# the other ADIOS tools.
16+
#
17+
# To provide a hint to the module where to find the ADIOS installation,
18+
# set the ADIOS_ROOT environment variable.
19+
#
20+
# If this variable is not set, make sure that at least the according `bin/`
21+
# directory of ADIOS is in your PATH environment variable.
22+
#
23+
# Set the following CMake variables BEFORE calling find_packages to
24+
# influence this module:
25+
# ADIOS_USE_STATIC_LIBS - Set to ON to force the use of static
26+
# libraries. Default: OFF
27+
#
28+
# This module will define the following variables:
29+
# ADIOS_INCLUDE_DIRS - Include directories for the ADIOS headers.
30+
# ADIOS_LIBRARIES - ADIOS libraries.
31+
# ADIOS_FOUND - TRUE if FindADIOS found a working install
32+
# ADIOS_VERSION - Version in format Major.Minor.Patch
33+
#
34+
# Not used for now:
35+
# ADIOS_DEFINITIONS - Compiler definitions you should add with
36+
# add_definitions(${ADIOS_DEFINITIONS})
37+
#
38+
39+
40+
################################################################################
41+
# Copyright 2014 Axel Huebl, Felix Schmitt
42+
#
43+
# This file is part of PIConGPU.
44+
#
45+
# PIConGPU is free software: you can redistribute it and/or modify
46+
# it under the terms of the GNU General Public License as published by
47+
# the Free Software Foundation, either version 3 of the License, or
48+
# (at your option) any later version.
49+
#
50+
# PIConGPU is distributed in the hope that it will be useful,
51+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
52+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53+
# GNU General Public License for more details.
54+
#
55+
# You should have received a copy of the GNU General Public License
56+
# along with PIConGPU.
57+
# If not, see <http://www.gnu.org/licenses/>.
58+
################################################################################
59+
60+
61+
################################################################################
62+
# Required cmake version
63+
################################################################################
64+
65+
cmake_minimum_required(VERSION 2.8.5)
66+
67+
68+
################################################################################
69+
# ADIOS
70+
################################################################################
71+
72+
# we start by assuming we found ADIOS and falsify it if some
73+
# dependencies are missing (or if we did not find ADIOS at all)
74+
set(ADIOS_FOUND TRUE)
75+
76+
77+
# find `adios_config` program #################################################
78+
# check the ADIOS_ROOT hint and the normal PATH
79+
find_file(ADIOS_CONFIG
80+
NAME adios_config
81+
PATHS $ENV{ADIOS_ROOT}/bin $ENV{PATH})
82+
83+
if(ADIOS_CONFIG)
84+
message(STATUS "Found 'adios_config': ${ADIOS_CONFIG}")
85+
else(ADIOS_CONFIG)
86+
set(ADIOS_FOUND FALSE)
87+
message(STATUS "Can NOT find 'adios_config' - set ADIOS_ROOT or check your PATH")
88+
endif(ADIOS_CONFIG)
89+
90+
91+
# check `adios_config` program ################################################
92+
if(ADIOS_FOUND)
93+
execute_process(COMMAND ${ADIOS_CONFIG} -l
94+
OUTPUT_VARIABLE ADIOS_LINKFLAGS
95+
RESULT_VARIABLE ADIOS_CONFIG_RETURN
96+
OUTPUT_STRIP_TRAILING_WHITESPACE)
97+
if(NOT ADIOS_CONFIG_RETURN EQUAL 0)
98+
set(ADIOS_FOUND FALSE)
99+
message(STATUS "Can NOT execute 'adios_config' - check file permissions")
100+
endif()
101+
102+
# find ADIOS_ROOT_DIR
103+
execute_process(COMMAND ${ADIOS_CONFIG} -d
104+
OUTPUT_VARIABLE ADIOS_ROOT_DIR
105+
OUTPUT_STRIP_TRAILING_WHITESPACE)
106+
if(NOT IS_DIRECTORY "${ADIOS_ROOT_DIR}")
107+
set(ADIOS_FOUND FALSE)
108+
message(STATUS "The directory provided by 'adios_config -d' does not exist: ${ADIOS_ROOT_DIR}")
109+
endif()
110+
endif(ADIOS_FOUND)
111+
112+
113+
# option: use only static libs ################################################
114+
if(ADIOS_USE_STATIC_LIBS)
115+
# carfully: we have to restore the original path in the end
116+
set(_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
117+
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
118+
endif()
119+
120+
121+
# we found something in ADIOS_ROOT_DIR and adios_config works #################
122+
if(ADIOS_FOUND)
123+
# ADIOS headers
124+
list(APPEND ADIOS_INCLUDE_DIRS ${ADIOS_ROOT_DIR}/include)
125+
126+
# check for compiled in dependencies
127+
message(STATUS "ADIOS linker flags (unparsed): ${ADIOS_LINKFLAGS}")
128+
129+
# find all library paths -L
130+
# note: this can cause trouble if some libs are specified twice from
131+
# different sources (quite unlikely)
132+
# http://www.cmake.org/pipermail/cmake/2008-November/025128.html
133+
set(ADIOS_LIBRARY_DIRS "")
134+
string(REGEX MATCHALL "-L([A-Za-z_0-9/\\.-]+)" _ADIOS_LIBDIRS "${ADIOS_LINKFLAGS}")
135+
foreach(_LIBDIR ${_ADIOS_LIBDIRS})
136+
string(REPLACE "-L" "" _LIBDIR ${_LIBDIR})
137+
list(APPEND ADIOS_LIBRARY_DIRS ${_LIBDIR})
138+
endforeach()
139+
# we could append ${CMAKE_PREFIX_PATH} now but that is not really necessary
140+
141+
#message(STATUS "ADIOS DIRS to look for libs: ${ADIOS_LIBRARY_DIRS}")
142+
143+
# parse all -lname libraries and find an absolute path for them
144+
string(REGEX MATCHALL "-l([A-Za-z_0-9\\.-]+)" _ADIOS_LIBS "${ADIOS_LINKFLAGS}")
145+
146+
foreach(_LIB ${_ADIOS_LIBS})
147+
string(REPLACE "-l" "" _LIB ${_LIB})
148+
149+
# find static lib: absolute path in -L then default
150+
find_library(_LIB_DIR NAMES ${_LIB} PATHS ${ADIOS_LIBRARY_DIRS})
151+
152+
# found?
153+
if(_LIB_DIR)
154+
message(STATUS "Found ${_LIB} in ${_LIB_DIR}")
155+
list(APPEND ADIOS_LIBRARIES "${_LIB_DIR}")
156+
else(_LIB_DIR)
157+
set(ADIOS_FOUND FALSE)
158+
message(STATUS "ADIOS: Could NOT find library '${_LIB}'")
159+
endif(_LIB_DIR)
160+
161+
# clean cached var
162+
unset(_LIB_DIR CACHE)
163+
unset(_LIB_DIR)
164+
endforeach()
165+
166+
# simplify lists and check for missing components (not implemented)
167+
set(ADIOS_MISSING_COMPONENTS "")
168+
foreach(COMPONENT ${ADIOS_FIND_COMPONENTS})
169+
string(TOUPPER ${COMPONENT} COMPONENT)
170+
list(APPEND ADIOS_MISSING_COMPONENTS ${COMPONENT})
171+
endforeach()
172+
#message(STATUS "ADIOS required components: ${ADIOS_FIND_COMPONENTS}")
173+
174+
# add the version string
175+
execute_process(COMMAND ${ADIOS_CONFIG} -v
176+
OUTPUT_VARIABLE ADIOS_VERSION
177+
OUTPUT_STRIP_TRAILING_WHITESPACE)
178+
179+
endif(ADIOS_FOUND)
180+
181+
# unset checked variables if not found
182+
if(NOT ADIOS_FOUND)
183+
unset(ADIOS_INCLUDE_DIRS)
184+
unset(ADIOS_LIBRARIES)
185+
endif(NOT ADIOS_FOUND)
186+
187+
188+
# restore CMAKE_FIND_LIBRARY_SUFFIXES if manipulated by this module ###########
189+
if(ADIOS_USE_STATIC_LIBS)
190+
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
191+
endif()
192+
193+
194+
###############################################################################
195+
# FindPackage Options
196+
###############################################################################
197+
198+
# handles the REQUIRED, QUIET and version-related arguments for find_package
199+
include(FindPackageHandleStandardArgs)
200+
find_package_handle_standard_args(ADIOS
201+
REQUIRED_VARS ADIOS_LIBRARIES ADIOS_INCLUDE_DIRS
202+
VERSION_VAR ADIOS_VERSION
203+
)

FindPNGwriter.cmake

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# - Find PNGwriter library,
2+
# a C++ library for creating PNG images
3+
# https://github.com/ax3l/pngwriter
4+
#
5+
# Use this module by invoking find_package with the form:
6+
# find_package(PNGwriter
7+
# [version] [EXACT] # Minimum or EXACT version, e.g. 0.5.4
8+
# [REQUIRED] # Fail with an error if PNGwriter or a required
9+
# # component is not found
10+
# [QUIET] # Do not warn if this module was not found
11+
# [COMPONENTS <...>] # Compiled in components: not implemented
12+
# )
13+
#
14+
# To provide a hint to this module where to find the PNGwriter installation,
15+
# set the PNGWRITER_ROOT environment variable.
16+
#
17+
# This module requires a valid installation of libpng (1.2.9+) which in turn
18+
# requires ZLib.
19+
#
20+
# Set the following CMake variables BEFORE calling find_packages to
21+
# change the behavior of this module:
22+
# PNGwriter_USE_STATIC_LIBS - Set to ON to prefer linking to the static
23+
# library and its static dependencies. Note that it
24+
# can fall back to shared libraries. Default: OFF
25+
#
26+
# This module will define the following variables:
27+
# PNGwriter_INCLUDE_DIRS - Include directories for the PNGwriter headers.
28+
# PNGwriter_LIBRARIES - PNGwriter libraries.
29+
# PNGwriter_FOUND - TRUE if FindPNGwriter found a working install
30+
# PNGwriter_VERSION - Version in format Major.Minor.Patch
31+
# PNGwriter_HAS_FREETYPE - Does this install require a freetype install?
32+
# PNGwriter_DEFINITIONS - Compiler definitions you should add with
33+
# add_definitions(${PNGwriter_DEFINITIONS})
34+
#
35+
36+
37+
###############################################################################
38+
# Copyright 2014 Axel Huebl
39+
#
40+
# This file is part of PIConGPU.
41+
#
42+
# PIConGPU is free software: you can redistribute it and/or modify
43+
# it under the terms of the GNU General Public License as published by
44+
# the Free Software Foundation, either version 3 of the License, or
45+
# (at your option) any later version.
46+
#
47+
# PIConGPU is distributed in the hope that it will be useful,
48+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
49+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+
# GNU General Public License for more details.
51+
#
52+
# You should have received a copy of the GNU General Public License
53+
# along with PIConGPU.
54+
# If not, see <http://www.gnu.org/licenses/>.
55+
###############################################################################
56+
57+
58+
###############################################################################
59+
# Required cmake version
60+
###############################################################################
61+
62+
cmake_minimum_required(VERSION 2.8.5)
63+
64+
65+
###############################################################################
66+
# PNGwriter
67+
###############################################################################
68+
69+
# we start by assuming we found PNGwriter and falsify it if some
70+
# dependencies are missing (or if we did not find PNGwriter at all)
71+
set(PNGwriter_FOUND TRUE)
72+
73+
# find PNGwriter install ######################################################
74+
#
75+
find_path(PNGwriter_ROOT_DIR
76+
NAMES include/pngwriter.h
77+
PATHS ENV PNGWRITER_ROOT
78+
DOC "PNGwriter ROOT location")
79+
80+
if(NOT PNGwriter_ROOT_DIR)
81+
set(PNGwriter_FOUND FALSE)
82+
endif(NOT PNGwriter_ROOT_DIR)
83+
84+
# option: prefer static libs ##################################################
85+
#
86+
if(PNGwriter_USE_STATIC_LIBS)
87+
# carefully: we have to restore the original path in the end
88+
set(_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
89+
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
90+
endif()
91+
92+
# find libpng install #########################################################
93+
#
94+
find_package(PNG 1.2.9)
95+
96+
if(NOT PNG_FOUND)
97+
set(PNGwriter_FOUND FALSE)
98+
endif(NOT PNG_FOUND)
99+
100+
101+
if(PNGwriter_FOUND)
102+
# PNGwriter headers #######################################################
103+
#
104+
list(APPEND PNGwriter_INCLUDE_DIRS ${PNGwriter_ROOT_DIR}/include)
105+
list(APPEND PNGwriter_INCLUDE_DIRS ${PNG_INCLUDE_DIRS})
106+
107+
# PNGwriter libraries #####################################################
108+
#
109+
find_library(PNGwriter_LIBRARIES
110+
NAMES pngwriter
111+
PATHS ${PNGwriter_ROOT_DIR}/lib)
112+
113+
# libpng
114+
list(APPEND PNGwriter_LIBRARIES ${PNG_LIBRARIES})
115+
116+
# PNGwriter definitions ###################################################
117+
#
118+
list(APPEND PNGwriter_DEFINITIONS ${PNG_DEFINITIONS})
119+
120+
# freetype support enabled?
121+
# (assumes: environment did not change since install)
122+
include(FindFreetype)
123+
if(FREETYPE_FOUND)
124+
list(APPEND PNGwriter_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
125+
list(APPEND PNGwriter_LIBRARIES ${FREETYPE_LIBRARIES})
126+
127+
else(FREETYPE_FOUND)
128+
# this flag is important for pngwriter headers, see
129+
# https://github.com/ax3l/pngwriter/issues/7
130+
list(APPEND PNGwriter_DEFINITIONS "-DNO_FREETYPE")
131+
endif(FREETYPE_FOUND)
132+
133+
# version string ##########################################################
134+
#
135+
set(PNGwriter_VERSION "0.5.4")
136+
137+
else(PNGwriter_FOUND)
138+
message(STATUS "Can NOT find PNGwriter - set PNGWRITER_ROOT")
139+
endif(PNGwriter_FOUND)
140+
141+
142+
# restore defaults of library suffixes ####################################
143+
#
144+
if(PNGwriter_USE_STATIC_LIBS)
145+
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
146+
endif()
147+
148+
149+
# unset checked variables if not found ########################################
150+
#
151+
if(NOT PNGwriter_FOUND)
152+
unset(PNGwriter_INCLUDE_DIRS)
153+
unset(PNGwriter_LIBRARIES)
154+
unset(PNGwriter_HAS_FREETYPE)
155+
endif(NOT PNGwriter_FOUND)
156+
157+
158+
###############################################################################
159+
# FindPackage Options
160+
###############################################################################
161+
162+
# handles the REQUIRED, QUIET and version-related arguments for find_package
163+
include(FindPackageHandleStandardArgs)
164+
find_package_handle_standard_args(PNGwriter
165+
REQUIRED_VARS PNGwriter_LIBRARIES PNGwriter_INCLUDE_DIRS
166+
VERSION_VAR PNGwriter_VERSION
167+
)

0 commit comments

Comments
 (0)