-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
122 lines (94 loc) · 3.64 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# SPDX-License-Identifier: LGPL-3.0-only
#
# Author: Hao-Xin Wang<[email protected]>
# Creation Date: 2023-07-19
#
# Description: QuantumLiquids/PEPS project. Main CMake file.
#
cmake_minimum_required(VERSION 3.12)
project("QuantumLiquids/PEPS"
DESCRIPTION "A finite-size PEPS algorithms library"
LANGUAGES CXX)
# Build type control.
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
# Build output control.
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif ()
option(QLPEPS_BUILD_UNITTEST "Build unittests for QuantumLiquids/PEPS." OFF)
option(QLPEPS_BUILD_PROFILER "Build profiler test cases for QuantumLiquids/PEPS." OFF)
# Advanced options.
option(QLPEPS_TIMING_MODE "Timing mode." OFF)
if (QLPEPS_TIMING_MODE)
add_definitions(-DQLPEPS_TIMING_MODE)
endif ()
option(TEST_BUILD_USE_EXTERNAL_HPTT_LIB "Use external hptt library when building unittests for QuantumLiquids/PEPS." ON)
option(TEST_BUILD_USE_EXTERNAL_QLTEN "Use external qlten library when building unittests for QuantumLiquids/PEPS." ON)
option(TEST_BUILD_USE_EXTERNAL_QLMPS "Use external qlmps library when building unittests for QuantumLiquids/PEPS." ON)
# Compilation and linking control.
set(CMAKE_CXX_STANDARD 17)
add_definitions(-g)
# Installation path
set(QLPEPS_TOOL_SCRIPT_DEST "${CMAKE_INSTALL_PREFIX}/bin")
set(QLPEPS_INCLUDE_DEST "${CMAKE_INSTALL_PREFIX}/include")
# Build(Install) library.
set(QLPEPS_HEADER_PATH "${PROJECT_SOURCE_DIR}/include")
message("${QLPEPS_HEADER_PATH}")
set(QLPEPS_HEADER_DIR "${QLPEPS_HEADER_PATH}/qlpeps")
install(
DIRECTORY ${QLPEPS_HEADER_DIR}
DESTINATION ${QLPEPS_INCLUDE_DEST})
# Build tool scripts
#add_subdirectory(script)
# Build unittests.
if (QLPEPS_BUILD_UNITTEST)
if (NOT TEST_BUILD_USE_EXTERNAL_HPTT_LIB)
set(hptt_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external/qlten/external/hptt/include")
set(hptt_LIBRARY "${CMAKE_BINARY_DIR}/external/qlten/external/hptt/libhptt.a")
else ()
find_path(hptt_INCLUDE_DIR "hptt.h")
find_library(hptt_LIBRARY "libhptt.a")
endif ()
if (NOT TEST_BUILD_USE_EXTERNAL_QLTEN)
add_subdirectory(external)
set(QLTENSOR_HEADER_PATH "${PROJECT_SOURCE_DIR}/external/qlten/include")
else ()
find_path(QLTENSOR_HEADER_PATH "qlten")
endif ()
if (NOT TEST_BUILD_USE_EXTERNAL_QLMPS)
add_subdirectory(external)
set(QLMPS_HEADER_PATH "${PROJECT_SOURCE_DIR}/external/qlten/include")
else ()
find_path(QLMPS_HEADER_PATH "qlmps")
endif ()
enable_testing()
find_package(GTest REQUIRED)
add_subdirectory(tests tests)
endif ()
if (QLPEPS_BUILD_PROFILER)
if (NOT TEST_BUILD_USE_EXTERNAL_HPTT_LIB)
set(hptt_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external/qlten/external/hptt/include")
set(hptt_LIBRARY "${CMAKE_BINARY_DIR}/external/qlten/external/hptt/libhptt.a")
else ()
find_path(hptt_INCLUDE_DIR "hptt.h")
find_library(hptt_LIBRARY "libhptt.a")
endif ()
if (NOT TEST_BUILD_USE_EXTERNAL_QLTEN)
add_subdirectory(external)
set(QLPEPS_TENSOR_LIB_HEADER_PATH "${PROJECT_SOURCE_DIR}/external/qlten/include")
else ()
find_path(QLPEPS_TENSOR_LIB_HEADER_PATH "qlten")
endif ()
if (NOT TEST_BUILD_USE_EXTERNAL_QLMPS)
add_subdirectory(external)
set(QLPEPS_MPS_LIB_HEADER_PATH "${PROJECT_SOURCE_DIR}/external/qlten/include")
else ()
find_path(QLPEPS_MPS_LIB_HEADER_PATH "qlmps")
endif ()
enable_testing()
find_path(PROFILER_INCLUDE_DIR "gperftools")
find_library(LIBPROFILER_LIBRARY "libprofiler.a")
add_subdirectory(profiler profiler)
endif ()