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

Hunter #40

Merged
merged 10 commits into from Apr 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/GreatCMakeCookOffConfig.cmake
Expand Up @@ -3,6 +3,8 @@ set(GREAT_CMAKE_COOKOFF_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}/../modules CACHE DO
"Path to GreatCMakeCookOff module directory")
set(GREAT_CMAKE_COOKOFF_SCRIPT_DIR ${CMAKE_CURRENT_LIST_DIR}/../scripts CACHE DOC
"Path to GreatCMakeCookOff script directory")
set(GREAT_CMAKE_COOKOFF_HUNTER_RECIPES_DIR ${CMAKE_CURRENT_LIST_DIR}/../hunter_recipes CACHE DOC
"Path to GreatCMakeCookOff script directory")
macro(initialize_cookoff)
if(CMAKE_VERSION VERSION_LESS 2.8)
message(FATAL_ERROR "The GreatCMakeCookOff requires CMake > 2.8")
Expand Down
26 changes: 26 additions & 0 deletions hunter_recipes/configs/default.cmake
@@ -0,0 +1,26 @@
# Do not place header guards here

# Unset:
# * ${PACKAGE_NAME}_ROOT (CMake variable)
# * ${PACKAGE_NAME}_ROOT (CMake cache variable)
# * ${PACKAGE_NAME}_ROOT (environment variable)

# Set CMake variables:
# * HUNTER_${PACKAGE_NAME}_VERSION
# * HUNTER_${PACKAGE_NAME}_CMAKE_ARGS (optionally)

# Usage:
# hunter_config(Foo VERSION 1.0.0)
# hunter_config(Boo VERSION 1.2.3z CMAKE_ARGS BOO_WITH_A=ON)

# Wiki:
# * https://github.com/ruslo/hunter/wiki/dev.modules#hunter_config

include(hunter_config)
include(hunter_user_error)

# NOTE: no names with spaces!
hunter_config(CFitsIO VERSION 3370)
hunter_config(CCFits VERSION "2.4")
hunter_config(GBenchmark VERSION "1.0.0")
hunter_config(F2C VERSION "0.0")
8 changes: 8 additions & 0 deletions hunter_recipes/find/FindCCFits.cmake
@@ -0,0 +1,8 @@
find_path(CCFits_INCLUDE_DIR NAMES CCfits.h PATH_SUFFIXES CCfits)
find_library(CCFits_LIBRARY NAMES CCfits)

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(
CCFits DEFAULT_MSG CCFits_INCLUDE_DIR CCFits_LIBRARY)
8 changes: 8 additions & 0 deletions hunter_recipes/find/FindF2C.cmake
@@ -0,0 +1,8 @@
find_path(F2C_INCLUDE_DIR NAMES f2c.h)
find_library(F2C_LIBRARY NAMES libf2c.a f2c)

set(F2C_INCLUDE_DIRS ${F2C_INCLUDE_DIR})
set(F2C_LIBRARIES ${F2C_LIBRARY})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(F2C REQUIRED_VARS F2C_INCLUDE_DIR F2C_LIBRARY)
1 change: 1 addition & 0 deletions hunter_recipes/find/FindGBenchmark.cmake
3 changes: 3 additions & 0 deletions hunter_recipes/init.cmake
@@ -0,0 +1,3 @@
include(hunter_initialize_repository)
hunter_initialize_repository(NAME cookoff VERSION 0.0.0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/find")
37 changes: 37 additions & 0 deletions hunter_recipes/projects/CCFits/hunter.cmake
@@ -0,0 +1,37 @@
# Copyright (c) 2015, Damien Buhl
# All rights reserved.

if(DEFINED HUNTER_CMAKE_PROJECTS_CCFITS_HUNTER_CMAKE)
return()
else()
set(HUNTER_CMAKE_PROJECTS_CCFITS_HUNTER_CMAKE 1)
endif()

include(hunter_add_version)
include(hunter_download)
include(hunter_pick_scheme)
include(hunter_add_package)

# Makes it possible to use syste cfitsio
if(NOT CFitsIO_FOUND)
hunter_add_package(CFitsIO)
find_package(CFitsIO REQUIRED)
if(NOT CFitsIO_FOUND)
message(FATAL_ERROR "need cfitsio")
endif()
endif()
get_filename_component(libcfitsio_dir "${CFitsIO_LIBRARY}" DIRECTORY)

hunter_add_version(
PACKAGE_NAME
CCFits
VERSION
"2.4"
URL
"http://heasarc.gsfc.nasa.gov/fitsio/ccfits/CCfits-2.4.tar.gz"
SHA1
3de2a6379bc1024300befae95cfdf33645a7b64a
)

hunter_pick_scheme(DEFAULT ccfits)
hunter_download(PACKAGE_NAME CCFits PACKAGE_DEPENDS_ON CFitsIO)
27 changes: 27 additions & 0 deletions hunter_recipes/projects/CCFits/patches/2.4/array.patch
@@ -0,0 +1,27 @@
--- a/ColumnVectorData.h
+++ b/ColumnVectorData.h
@@ -260,13 +260,16 @@
if ( that.m_data.size() != n ) return false;
for (size_t i = 0; i < n ; i++)
{
- size_t nn = m_data[i].size();
- // first check size (also, == on 2 valarrays is only defined if they
- // are equal in size).
- if (that.m_data[i].size() != nn ) return false;
-
- std::valarray<bool> test = (m_data[i] == that.m_data[i]);
- for (size_t j = 0; j < nn ; j++ ) if ( !test[j] ) return false;
+ const std::valarray<T>& thisValArray=m_data[i];
+ const std::valarray<T>& thatValArray=that.m_data[i];
+ size_t nn = thisValArray.size();
+ if (thatValArray.size() != nn ) return false;
+
+ for (size_t j = 0; j < nn ; j++ )
+ {
+ if (thisValArray[j] != thatValArray[j])
+ return false;
+ }
}
return true;
}

119 changes: 119 additions & 0 deletions hunter_recipes/projects/CCFits/schemes/ccfits.cmake.in
@@ -0,0 +1,119 @@

# Copyright (c) 2013, 2015 Ruslan Baratov, Alexandre Pretyman
# All rights reserved.

cmake_minimum_required(VERSION 3.0)
project(Hunter)

list(APPEND CMAKE_MODULE_PATH "@HUNTER_SELF@/cmake/modules")

include(hunter_fatal_error)
include(hunter_status_debug)
include(hunter_test_string_not_empty)
include(hunter_autotools_project)

hunter_status_debug("Scheme: url_sha1_autotools")

if("@MSVC@")
hunter_fatal_error("Autotools scheme not supported with Visual Studio")
endif()

# Check preconditions
hunter_test_string_not_empty("@HUNTER_SELF@")
hunter_test_string_not_empty("@HUNTER_EP_NAME@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_URL@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_SHA1@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_DOWNLOAD_DIR@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_SOURCE_DIR@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_BUILD_DIR@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_INSTALL_PREFIX@")
hunter_test_string_not_empty("@HUNTER_INSTALL_PREFIX@")

hunter_autotools_project("@HUNTER_EP_NAME@"
HUNTER_SELF
"@HUNTER_SELF@"
URL
@HUNTER_PACKAGE_URL@
URL_HASH
SHA1=@HUNTER_PACKAGE_SHA1@
DOWNLOAD_DIR
"@HUNTER_PACKAGE_DOWNLOAD_DIR@"
SOURCE_DIR
"@HUNTER_PACKAGE_SOURCE_DIR@"
BUILD_DIR
"@HUNTER_PACKAGE_BUILD_DIR@"
INSTALL_DIR
"@HUNTER_PACKAGE_INSTALL_PREFIX@"
GLOBAL_INSTALL_DIR
"@HUNTER_INSTALL_PREFIX@"
PARALLEL_JOBS
"@HUNTER_JOBS_OPTION@"
CPPFLAGS
"-I@CFitsIO_INCLUDE_DIR@"
LDFLAGS
"-L@libcfitsio_dir@ -lcfitsio"
)

# Create patch script and command
file(GLOB patches "@CMAKE_CURRENT_LIST_DIR@/patches/@HUNTER_PACKAGE_VERSION@/*.patch")
if(NOT "${patches}" STREQUAL "")
set(patch_script "@HUNTER_PACKAGE_HOME_DIR@/patching_cmake_script.cmake")
find_program(PATCH_EXECUTABLE patch REQUIRED)
file(WRITE "${patch_script}" "execute_process(\n")
foreach(patch ${patches})
file(APPEND "${patch_script}" " COMMAND ${PATCH_EXECUTABLE} -i ${patch}\n")
endforeach()
file(APPEND "${patch_script}"
" WORKING_DIRECTORY @HUNTER_PACKAGE_SOURCE_DIR@\n"
")\n"
)


ExternalProject_Add_Step("@HUNTER_EP_NAME@"
patching
DEPENDEES download
DEPENDERS configure
COMMENT "Patching @HUNTER_EP_NAME@"
COMMAND @CMAKE_COMMAND@ -P "${patch_script}"
)
endif()

# CCFits expects its source to be in a directory called CCFits whereas hunter
# puts it in a directory called Source
ExternalProject_Add_Step("@HUNTER_EP_NAME@"
header
DEPENDEES download
DEPENDERS configure
COMMENT "Adding CCFits header directory"
COMMAND @CMAKE_COMMAND@ -E make_directory "@HUNTER_PACKAGE_SOURCE_DIR@/../CCFits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/AsciiTable.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/BinTable.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/CCfits.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/Column.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/ColumnCreator.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/ColumnData.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/ColumnT.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/ColumnVectorData.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/ExtHDU.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/ExtHDUT.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/FITS.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/FITSBase.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/FITSUtil.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/FITSUtilT.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/FitsError.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/HDU.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/HDUCreator.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/Image.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/ImageExt.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/KeyData.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/Keyword.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/KeywordCreator.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/KeywordT.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/MSconfig.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/NewColumn.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/NewKeyword.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/PHDU.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/PHDUT.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/PrimaryHDU.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
COMMAND @CMAKE_COMMAND@ -E copy "@HUNTER_PACKAGE_SOURCE_DIR@/Table.h" "@HUNTER_PACKAGE_SOURCE_DIR@/../CCfits"
)
48 changes: 48 additions & 0 deletions hunter_recipes/projects/CFitsIO/hunter.cmake
@@ -0,0 +1,48 @@
# Copyright (c) 2015, Damien Buhl
# All rights reserved.

if(DEFINED HUNTER_CMAKE_PROJECTS_CFITSIO_HUNTER_CMAKE)
return()
else()
set(HUNTER_CMAKE_PROJECTS_CFITSIO_HUNTER_CMAKE 1)
endif()

include(hunter_add_version)
include(hunter_download)
include(hunter_pick_scheme)

hunter_add_version(
PACKAGE_NAME
CFitsIO
VERSION
"3350"
URL
"ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3350.tar.gz"
SHA1
e928832708d6a5df21a1e17ae4a63036cab7c1b9
)

hunter_add_version(
PACKAGE_NAME
CFitsIO
VERSION
"3360"
URL
"ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3360.tar.gz"
SHA1
0d3099721a6bf1e763f158c447a74c5e8192412d
)

hunter_add_version(
PACKAGE_NAME
CFitsIO
VERSION
"3370"
URL
"ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3370.tar.gz"
SHA1
48bd6389dcff3228508eec70384f2cae3a88ff32
)

hunter_pick_scheme(DEFAULT url_sha1_autotools)
hunter_download(PACKAGE_NAME CFitsIO)
21 changes: 21 additions & 0 deletions hunter_recipes/projects/F2C/hunter.cmake
@@ -0,0 +1,21 @@
# Copyright (c) 2015, Damien Buhl
# All rights reserved.
include(hunter_add_version)
include(hunter_download)
include(hunter_pick_scheme)
include(hunter_add_package)

# Makes it possible to use syste cfitsio
hunter_add_version(
PACKAGE_NAME
F2C
VERSION
"0.0"
URL
"http://netlib.sandia.gov/f2c/libf2c.zip"
SHA1
e4a93aeee80c33525ffc87a5f802c30a7e6d1ea4
)

hunter_pick_scheme(DEFAULT F2C)
hunter_download(PACKAGE_NAME F2C)