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

[WIP] Adds cupla_add_library and separate compilation test #115

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
28 changes: 28 additions & 0 deletions cmake/addLibrary.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright 2016 Rene Widera
#
# This file is part of cupla.
#
# cupla is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cupla is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with cupla.
# If not, see <http://www.gnu.org/licenses/>.
#

macro(CUPLA_ADD_LIBRARY BinaryName)

alpaka_add_library(
${BinaryName}
${ARGN}
)
target_link_libraries(${BinaryName} PUBLIC cupla)
endmacro()
4 changes: 4 additions & 0 deletions cuplaConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ get_filename_component(_cupla_ROOT_DIR "${_cupla_ROOT_DIR}" ABSOLUTE)
set(_cupla_ADD_EXECUTABLE_FILE "${_cupla_ROOT_DIR}/cmake/addExecutable.cmake")
include("${_cupla_ADD_EXECUTABLE_FILE}")

# Add cupla_ADD_LIBRARY function.
set(_cupla_ADD_LIBRARY_FILE "${_cupla_ROOT_DIR}/cmake/addLibrary.cmake")
include("${_cupla_ADD_LIBRARY_FILE}")

################################################################################
# Set found to true initially and set it on false if a required dependency is missing.
################################################################################
Expand Down
28 changes: 28 additions & 0 deletions test/separate_compilation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
################################################################################
# Required CMake version.
################################################################################

cmake_minimum_required(VERSION 3.11.0)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

################################################################################
# Project.
################################################################################

project(separate_compilation)

################################################################################
# Find cupla
################################################################################

list(APPEND CMAKE_MODULE_PATH "${cupla_ROOT}")
find_package("cupla" REQUIRED)


################################################################################
# Add library.
################################################################################

cupla_add_library(${PROJECT_NAME} STATIC "src/kernel.cpp")
set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
6 changes: 6 additions & 0 deletions test/separate_compilation/src/kernel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "kernel.hpp"

void TestClass::test()
{
std::cout<<"separate compilation "<<std::endl;
}
12 changes: 12 additions & 0 deletions test/separate_compilation/src/kernel.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once
#include <iostream>

#include <cuda_to_cupla.hpp>

class TestClass
{
public:

void test();

};