-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Non-effective CMake code removed This change should not affect functionality. * Compilation of examples made optional * Boost made mandatory, better include_dir settings * Install and cmake package instructions added * Indentation fixes * benchmark: submodule -> cmake ExternalProject_Add Unnecessary download of benchmark can be avoided with CMake. During CMake configure, benchmark is downloaded if needed and not found. benchmark is then built and installed during CMake configure step. We can then use find_package with REQUIRED to use benchmark. This is cleaner and is the suggested method by google. https://github.com/google/googletest/blob/master/googletest/README.md Settings for benchmark build can be set in: benchmark_download.cmake.in. This file is configured so use of variables from main build is possible. * yomm2 given ARCHIVE DESTINATION for install This fixes an issue that appeared in Travis CI * Options revamped Now using CMake's `Option` command to define options. This allows them to be cached and have default values. Examples are set to on by default again. YOMM2_ENABLE_BENCHMARKS only available if tests are built. * Dependency downloading macro improved * Readme updated * Linking instructions added to README.md * Boost should be PUBLIC, not INTERFACE dependency! * Make yomm2.a STATIC explicitly (clearer!) * Unneeded parameter removed
- Loading branch information
Showing
11 changed files
with
139 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.rtags | ||
build/ | ||
**/#*# | ||
|
||
extern |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include(CMakeFindDependencyMacro) | ||
|
||
# Tell library users about the Boost dependency | ||
find_dependency(Boost 1.53) | ||
|
||
# Add the targets file | ||
include("${CMAKE_CURRENT_LIST_DIR}/YOMM2Targets.cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(benchmarkDownload) | ||
include(ExternalProject) | ||
|
||
ExternalProject_Add(benchmark | ||
GIT_REPOSITORY https://github.com/google/benchmark.git | ||
GIT_TAG master | ||
GIT_PROGRESS True | ||
SOURCE_DIR "${CMAKE_SOURCE_DIR}/extern/benchmark" | ||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/benchmark-build" | ||
INSTALL_DIR ${CMAKE_SOURCE_DIR}/extern | ||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DBENCHMARK_ENABLE_TESTING=OFF | ||
-DBENCHMARK_ENABLE_GTEST_TESTS=OFF | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
macro(find_or_download_package PACKAGE) | ||
find_package(${PACKAGE} QUIET) | ||
if(NOT ${${PACKAGE}_FOUND}) | ||
message(STATUS "Package \"${PACKAGE}\" not found in system.") | ||
message(STATUS | ||
"Downloading dependency \"${PACKAGE}\" and building from source." | ||
) | ||
|
||
# Prepare download instructions for dependency | ||
configure_file( | ||
${CMAKE_SOURCE_DIR}/cmake/${PACKAGE}_download.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-download/CMakeLists.txt | ||
) | ||
|
||
# Download dependency | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-download | ||
OUTPUT_QUIET | ||
) | ||
if(result) | ||
message(FATAL_ERROR "Download of dependency ${PACKAGE} failed: ${result}") | ||
endif() | ||
|
||
# Build dependency | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} --build . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-download | ||
) | ||
if(result) | ||
message(FATAL_ERROR "Build of dependency ${PACKAGE} failed: ${result}") | ||
endif() | ||
|
||
# Update search path and use regular find_package to add dependency | ||
# TODO Use same directory here as for configure_file up there and inside | ||
# download instructions! | ||
list( | ||
APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/extern/lib/cmake/${PACKAGE}" | ||
) | ||
find_package(${PACKAGE} REQUIRED) | ||
endif() | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule benchmark
deleted from
e30cac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters