67 lines
1.9 KiB
CMake
67 lines
1.9 KiB
CMake
###################################
|
|
## CMakeLists.txt for Astaroth ##
|
|
###################################
|
|
#
|
|
# Usage: mkdir build && cd build && cmake <options> .. && make
|
|
#
|
|
# If you want to see the exact flags used during compilation, compile with
|
|
# "make VERBOSE=1"
|
|
#
|
|
# Print all options: cmake -LAH ..
|
|
#
|
|
|
|
|
|
## CMake settings
|
|
cmake_minimum_required (VERSION 3.5.1) # Need >= 3.8 for first-class CUDA support
|
|
|
|
## Project settings
|
|
project(astaroth CXX)
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
|
|
|
## Options
|
|
option(BUILD_DEBUG "Builds the program with extensive error checking" OFF)
|
|
option(BUILD_STANDALONE "Builds the standalone Astaroth" ON)
|
|
option(BUILD_RT_VISUALIZATION "Builds the module for real-time visualization using SDL2" OFF)
|
|
option(DOUBLE_PRECISION "Generates double precision code" OFF)
|
|
option(MULTIGPU_ENABLED "If enabled, uses all the available GPUs" ON)
|
|
option(ALTER_CONF "If enabled, loads astaroth.conf from the build directory" OFF)
|
|
|
|
|
|
|
|
## Build types
|
|
# Available types (case-sensitive):
|
|
# RELEASE (best performance)
|
|
# DEBUG (w/ debug information, non-concurrent kernels)
|
|
if (BUILD_DEBUG)
|
|
set(CMAKE_BUILD_TYPE DEBUG)
|
|
else ()
|
|
set(CMAKE_BUILD_TYPE RELEASE)
|
|
endif()
|
|
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
|
|
|
|
|
|
## Defines
|
|
if (DOUBLE_PRECISION)
|
|
add_definitions(-DAC_DOUBLE_PRECISION=1)
|
|
else ()
|
|
add_definitions(-DAC_DOUBLE_PRECISION=0)
|
|
endif ()
|
|
if (MULTIGPU_ENABLED)
|
|
add_definitions(-DAC_MULTIGPU_ENABLED=1)
|
|
else ()
|
|
add_definitions(-DAC_MULTIGPU_ENABLED=0)
|
|
endif ()
|
|
|
|
## Include directories
|
|
include_directories(include)
|
|
include_directories(.) # TODO remove
|
|
include_directories(src) # TODO remove
|
|
|
|
## Subdirectories
|
|
add_subdirectory(src/core)
|
|
if (BUILD_STANDALONE)
|
|
add_subdirectory(src/standalone)
|
|
endif ()
|