Skip to content
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
34 changes: 33 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,39 @@
#

cmake_minimum_required(VERSION 3.25)
project(alpaka)

# Find alpaka version.
file(
STRINGS
"${CMAKE_CURRENT_LIST_DIR}/include/alpaka/version.hpp"
alpaka_VERSION_MAJOR_HPP
REGEX "#define ALPAKA_VERSION_MAJOR "
)
file(
STRINGS
"${CMAKE_CURRENT_LIST_DIR}/include/alpaka/version.hpp"
alpaka_VERSION_MINOR_HPP
REGEX "#define ALPAKA_VERSION_MINOR "
)
file(
STRINGS
"${CMAKE_CURRENT_LIST_DIR}/include/alpaka/version.hpp"
alpaka_VERSION_PATCH_HPP
REGEX "#define ALPAKA_VERSION_PATCH "
)

string(REGEX MATCH "([0-9]+)" alpaka_VERSION_MAJOR ${alpaka_VERSION_MAJOR_HPP})
string(REGEX MATCH "([0-9]+)" alpaka_VERSION_MINOR ${alpaka_VERSION_MINOR_HPP})
string(REGEX MATCH "([0-9]+)" alpaka_VERSION_PATCH ${alpaka_VERSION_PATCH_HPP})

set(PACKAGE_VERSION "${alpaka_VERSION_MAJOR}.${alpaka_VERSION_MINOR}.${alpaka_VERSION_PATCH}")

project(
alpaka
VERSION ${alpaka_VERSION_MAJOR}.${alpaka_VERSION_MINOR}.${alpaka_VERSION_PATCH}
DESCRIPTION "The alpaka library is a header-only C++20 abstraction library for accelerator development."
HOMEPAGE_URL "https://github.com/alpaka-group/alpaka3"
)

# This file's directory.
set(_alpaka_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
Expand Down
5 changes: 5 additions & 0 deletions cmake/alpakaCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ if(NOT TARGET alpaka)
target_compile_definitions(alpaka_target_headers INTERFACE ALPAKA_CMAKE_TARGET_HEADERS)

add_library(alpaka INTERFACE)
set_target_properties(alpaka PROPERTIES VERSION ${PROJECT_VERSION})

get_target_property(version alpaka VERSION)
message(STATUS "Alpaka version: ${version}")

add_library(alpaka::alpaka ALIAS alpaka)
target_compile_definitions(alpaka INTERFACE ALPAKA_CMAKE_TARGET_ALPAKA)

Expand Down
1 change: 1 addition & 0 deletions include/alpaka/core/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "alpaka/core/PP.hpp"
#include "alpaka/core/hipConfig.hpp"
#include "alpaka/version.hpp"

// guard cmake target alpaka
#if defined(ALPAKA_CMAKE_TARGET_ALPAKA) && !defined(ALPAKA_CMAKE_TARGET_ALPAKA_FINALIZE_CALLED)
Expand Down
14 changes: 14 additions & 0 deletions include/alpaka/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Copyright 2025 Benjamin Worpitz, Erik Zenker, Jan Stephan, René Widera
* SPDX-License-Identifier: MPL-2.0
*/

#pragma once

#include "core/PP.hpp"

#define ALPAKA_VERSION_MAJOR 3
#define ALPAKA_VERSION_MINOR 0
#define ALPAKA_VERSION_PATCH 0

//! The alpaka library version number
#define ALPAKA_VERSION ALPAKA_VERSION_NUMBER(ALPAKA_VERSION_MAJOR, ALPAKA_VERSION_MINOR, ALPAKA_VERSION_PATCH)