From 053a01c6b712da915cf181cc5072a79537fbb24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D1=8B=D0=BC=D0=B0=D0=BD?= Date: Wed, 22 May 2024 13:14:21 +0000 Subject: [PATCH] - Installation commands in CMakeLists.txt - Added package.xml, allowing blast to be build as a part of colcon build --- CMakeLists.txt | 66 ++++++++++++++++++++++++++++--------- LICENSE | 4 +-- cmake/blast-config.cmake.in | 11 +++++++ package.xml | 13 ++++++++ 4 files changed, 76 insertions(+), 18 deletions(-) create mode 100644 cmake/blast-config.cmake.in create mode 100644 package.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dfbd0bd..e509f126 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -cmake_minimum_required (VERSION 3.10) # Need at least 3.10 for gtest_discover_tests() -project (blast) +cmake_minimum_required(VERSION 3.10) # Need at least 3.10 for gtest_discover_tests() +project(blast VERSION 0.1 LANGUAGES CXX) # Enable modern C++ set(CMAKE_CXX_STANDARD 20) @@ -18,26 +18,18 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) include(CMakeToolsHelpers OPTIONAL) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -set(PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_DEBUG_POSTFIX d) -# find_package(LAPACK REQUIRED) - -# Find boost. find_package(Boost REQUIRED COMPONENTS exception) - -# Find Blaze. find_package(blaze REQUIRED) -# add_subdirectory(src) -# add_subdirectory(examples) - add_library(blast INTERFACE) -target_include_directories(blast - INTERFACE ${PROJECT_INCLUDE_DIR} +target_include_directories(blast INTERFACE + $ + $ ) target_link_libraries(blast @@ -45,11 +37,14 @@ target_link_libraries(blast ) target_compile_options(blast - INTERFACE "-Wno-ignored-attributes" + INTERFACE "-Wno-ignored-attributes" "-fno-math-errno" "-ftemplate-backtrace-limit=0" + # Enable SIMD instruction sets, otherwise it does not compile. + # This will change when we support multiple architectures. + INTERFACE "-march=native" "-mfma" "-mavx" "-mavx2" "-msse4" ) # BLAST_WITH_BLASFEO -set(BLAST_WITH_BLASFEO CACHE BOOL "Build blasfeo C++ interface") +option(BLAST_WITH_BLASFEO "Build blasfeo C++ interface") if (BLAST_WITH_BLASFEO) find_package(BLASFEO REQUIRED) @@ -68,7 +63,7 @@ if (BLAST_WITH_BLASFEO) endif() # BLAST_WITH_TEST -set(BLAST_WITH_TEST ON CACHE BOOL "Build blast tests") +option(BLAST_WITH_TEST "Build blast tests") if (BLAST_WITH_TEST) enable_testing() @@ -82,3 +77,42 @@ if (BLAST_WITH_BENCHMARK) include_directories(${PROJECT_INCLUDE_DIR}) add_subdirectory(bench) endif() + +# +# Install +# +install( + DIRECTORY include/ + DESTINATION include +) + +# Install targets and generate an export target +install(TARGETS blast + EXPORT blast-targets +) + +install(EXPORT blast-targets + NAMESPACE blast:: + DESTINATION share/blast/cmake +) + +# Generate and install the package configuration and version files +include(CMakePackageConfigHelpers) + +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/blast-config-version.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion +) + +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/blast-config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/blast-config.cmake" + INSTALL_DESTINATION share/blast/cmake +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/blast-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/blast-config-version.cmake" + DESTINATION share/blast/cmake +) diff --git a/LICENSE b/LICENSE index 3a92e231..ec00c423 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2020, Mikhail Katliar +Copyright (c) 2020-2024, Mikhail Katliar All rights reserved. Redistribution and use in source and binary forms, with or without @@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cmake/blast-config.cmake.in b/cmake/blast-config.cmake.in new file mode 100644 index 00000000..df95f464 --- /dev/null +++ b/cmake/blast-config.cmake.in @@ -0,0 +1,11 @@ +#--------------------------------------------------------------------------- +# +# blast-config.cmake - CMake configuration file for external projects. +# Use this by invoking +# +# find_package(blast) +# +# The module defines blast::blast IMPORTED target + +include("${CMAKE_CURRENT_LIST_DIR}/blast-targets.cmake") +message(STATUS "Found blast") diff --git a/package.xml b/package.xml new file mode 100644 index 00000000..952ada91 --- /dev/null +++ b/package.xml @@ -0,0 +1,13 @@ + + + + blast + 0.1.0 + BLAS Templates + Mikhail Katliar + BSD 3-Clause License + + + cmake + +