GPU Developer's Guide
  • 1. Introduction
  • 2. GPU Execution Architecture in CODE.HEAAN
  • 3. Start a new project with HEaaN
    • 3-1. Create Project Directory
    • 3-2. Set up Basic Directory Structure
    • 3-3. CMake Configuration
    • 3-4. Build and Compile
    • 3-5. Run (gpu-run)
    • 3-6. Check the results
    • Additional tips
  • 4. Example Codes
    • 4-1. CUDA
    • 4-2. HEaaN End to End Example
  • HEaaN GPU Guideline
    • HEaaN GPU Component Overview
    • CudaTools
    • Device Class
    • HEaaN GPU API in use
  • Not supported features
Powered by GitBook

Copyright©️ 2025 CryptoLab, Inc. All rights reserved.

On this page

Was this helpful?

  1. 3. Start a new project with HEaaN

3-3. CMake Configuration

Create a CMakeLists.txt file in the project root directory:

# Specify minimum required CMake Version
# HEaaN library requires version 3.21 or higher
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)

# Project information setup
project(my-heaan-project 
    VERSION 1.0.0 
    DESCRIPTION "Project using HEaaN library" 
    LANGUAGES CXX)

# Include cmake modules
include(cmake/BuildType.cmake)

# C++ standard modules
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED Yes)
set(CMAKE_CXX_EXTENSIONTS no)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Set output directory path
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

# Find HEaaN library
find_package(HEaaN REQUIRED)

# Interface library setup
add_library(heaan INTERFACE)
target_link_libraries(heaan INTERFACE HEaaN::HEaaN)

# Add subdirectories
add_subdirectory(src)

# Add tests and examples (optional)
option(BUILD_TESTS "Build tests" OFF)
option(BUILD_EXAMPLES "Build examples" OFF)

if(BUILD_TESTS)
    add_subdirectory(tests)
endif()

if(BUILD_EXAMPLES)
    add_subdirectory(examples)
endif()
src/CMakeLists.txt
Create a CMakeLists.txt file in the src directory:

Copy
# Set source files
set(SOURCES
    main.cpp
    # Additional source files
)

# Include CUDA headers if needed
include_directories("/usr/local/cuda/include")

# Create executable
add_executable(my_program ${SOURCES}

cmake/BuildType.cmake

Create a BuildType.cmake file in the cmake directory:

# Set build type to 'Release' if not specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPE)
    message(STATUS "Build type not specified. Setting to 'Release'.")
	
    # Set possible build types
    set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif()

If you need more information, please refer the CMake official document.

Previous3-2. Set up Basic Directory StructureNext3-4. Build and Compile

Last updated 7 days ago

Was this helpful?

CMake Document