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

Installation commands and colcon build support #9

Merged
merged 1 commit into from
May 23, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 50 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -18,38 +18,33 @@ 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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_link_libraries(blast
INTERFACE blaze::blaze
)

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)
Expand All @@ -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()
Expand All @@ -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
)
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 changes: 11 additions & 0 deletions cmake/blast-config.cmake.in
Original file line number Diff line number Diff line change
@@ -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")
13 changes: 13 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>blast</name>
<version>0.1.0</version>
<description>BLAS Templates</description>
<maintainer email="[email protected]">Mikhail Katliar</maintainer>
<license>BSD 3-Clause License</license>

<export>
<build_type>cmake</build_type>
</export>
</package>
Loading