forked from ElectronicStructureLibrary/libxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
633 lines (592 loc) · 16.2 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
cmake_policy(SET CMP0048 NEW) # project_VERSION* variables populated from project(... VERSION x.x.x) string
project(Libxc
LANGUAGES C)
set(Libxc_AUTHORS "Miguel A.L. Marques and others")
set(Libxc_DESCRIPTION "Exchange-correlation functionals for density-functional theory")
set(Libxc_EMAIL "libxc@tddft.org")
set(Libxc_URL "http://www.tddft.org/programs/Libxc")
set(Libxc_LICENSE "Mozilla Public License, version 2.0 (MPL-2.0)")
cmake_minimum_required(VERSION 3.1)
set(CMAKE_C_STANDARD 99)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
if(ENABLE_CUDA)
cmake_minimum_required(VERSION 3.8)
set(CMAKE_VERBOSE_MAKEFILE ON)
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 98)
if(POLICY CMP0104)
cmake_policy(SET CMP0104 OLD)
endif()
endif()
################################### Options ####################################
include(psi4OptionsTools)
option_with_default(CMAKE_BUILD_TYPE "Build type" Release)
option_with_print(BUILD_SHARED_LIBS "Build final library as shared, not static. For Windows, also add CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON" OFF)
option_with_print(BUILD_TESTING "Compile the testing infrastructure" ON)
option_with_default(BUILD_FPIC "Libraries will be compiled with position independent code" ON)
if((${BUILD_SHARED_LIBS}) AND NOT ${BUILD_FPIC})
message(FATAL_ERROR "BUILD_SHARED_LIBS ON and BUILD_FPIC OFF are incompatible, as shared library requires position independent code")
endif()
option_with_default(NAMESPACE_INSTALL_INCLUDEDIR "Location within CMAKE_INSTALL_INCLUDEDIR to which headers are installed (e.g., /libxc)" /)
option_with_print(ENABLE_GENERIC "Enable mostly static linking in shared library" OFF)
option_with_print(ENABLE_FORTRAN "Build Fortran 2003 interface" OFF)
option_with_print(ENABLE_PYTHON "Install Python API interface" OFF)
if(${ENABLE_PYTHON} AND NOT ${BUILD_SHARED_LIBS})
message(FATAL_ERROR "ENABLE_PYTHON ON requires BUILD_SHARED_LIBS ON because only shared libraries can be dynamically loaded")
endif()
include(xhost) # defines: option(ENABLE_XHOST "Enable processor-specific optimization" ON)
option_with_print(DISABLE_VXC "Don't compile first derivative code" OFF)
option_with_print(DISABLE_FXC "Don't compile second derivative code" OFF)
option_with_print(DISABLE_KXC "Don't compile third derivative code" ON)
option_with_print(DISABLE_LXC "Don't compile fourth derivative code" ON)
option_with_print(DISABLE_FHC "Disable enforcement of Fermi hole curvature?" OFF)
######################### Process & Validate Options ###########################
include(autocmake_safeguards)
include(custom_static_library)
################################# Main Project #################################
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(PN ${PROJECT_NAME})
# Need BASH to run test suite
find_program(BASH_EXECUTABLE bash)
# link -lm only if necessary
find_package(StandardMathLibraryC)
# check if cbrt exists and declare HAVE_CBRT if it does
check_c_source_compiles (
"#include <math.h>
int main() {
return (int)(cbrt(0.8));
}" HAVE_CBRT)
if (HAVE_CBRT)
add_definitions (-DHAVE_CBRT)
endif (HAVE_CBRT)
# Turn off derivative code
if(DISABLE_VXC)
add_definitions (-DXC_DONT_COMPILE_VXC)
add_definitions (-DXC_DONT_COMPILE_FXC)
add_definitions (-DXC_DONT_COMPILE_KXC)
add_definitions (-DXC_DONT_COMPILE_LXC)
endif(DISABLE_VXC)
if(DISABLE_FXC)
add_definitions (-DXC_DONT_COMPILE_FXC)
add_definitions (-DXC_DONT_COMPILE_KXC)
add_definitions (-DXC_DONT_COMPILE_LXC)
endif(DISABLE_FXC)
if(DISABLE_KXC)
add_definitions (-DXC_DONT_COMPILE_KXC)
add_definitions (-DXC_DONT_COMPILE_LXC)
endif(DISABLE_KXC)
if(DISABLE_LXC)
add_definitions (-DXC_DONT_COMPILE_LXC)
endif(DISABLE_LXC)
if(NOT DISABLE_FHC)
add_definitions (-DXC_ENFORCE_FERMI_HOLE_CURVATURE)
endif(NOT DISABLE_FHC)
# <<< Build >>>
# extract project version from source
file(STRINGS "configure.ac" _libxc_configure_ac
REGEX "AC_INIT")
foreach(ver ${_libxc_configure_ac})
if (ver MATCHES "^AC_INIT..libxc...([0-9]+).([0-9]+).([0-9]+).*$")
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_2})
set(PROJECT_VERSION_MICRO ${CMAKE_MATCH_3})
endif()
endforeach()
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_MICRO})
message(STATUS "Version: Full ${PROJECT_VERSION}")
# repurpose xc_version from Make for CMake
set(VERSION ${PROJECT_VERSION})
set(XC_MAJOR_VERSION ${PROJECT_VERSION_MAJOR})
set(XC_MINOR_VERSION ${PROJECT_VERSION_MINOR})
set(XC_MICRO_VERSION ${PROJECT_VERSION_MICRO})
configure_file(xc_version.h.in xc_version.h @ONLY)
# create dummy config.h
configure_file(config.h.cmake.in config.h @ONLY)
# special substitutions for pkgconfig files
include(JoinPaths)
join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
configure_file(cmake/libxc.pc.in libxc.pc @ONLY)
# extract project soversion from source
file(STRINGS "configure.ac" _libxc_configure_ac
REGEX "XC_(CURRENT|REVISION|AGE)=")
foreach(ver ${_libxc_configure_ac})
if (ver MATCHES "XC_(CURRENT|REVISION|AGE)=+([^ ]+)$")
set(XC_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()
set(${PROJECT_NAME}_SOVERSION ${XC_CURRENT}:${XC_REVISION}:${XC_AGE})
math(EXPR ${PROJECT_NAME}_SOMAJOR "${XC_CURRENT} - ${XC_AGE}")
message(STATUS "SO Version: Full ${${PROJECT_NAME}_SOVERSION} Major ${${PROJECT_NAME}_SOMAJOR}")
set(raw_sources_list
bessel.c
expint_e1.c
faddeeva.c
func_info.c
func_reference.c
functionals.c
hybrids.c
gga.c
gga_c_acgga.c
gga_c_acggap.c
gga_c_am05.c
gga_c_bmk.c
gga_c_chachiyo.c
gga_c_cs1.c
gga_c_ft97.c
gga_c_gapc.c
gga_c_gaploc.c
gga_c_hcth_a.c
gga_c_lm.c
gga_c_lyp.c
gga_c_lypr.c
gga_c_op_b88.c
gga_c_op_g96.c
gga_c_op_pbe.c
gga_c_op_pw91.c
gga_c_op_xalpha.c
gga_c_optc.c
gga_c_p86.c
gga_c_p86vwn.c
gga_c_pbe.c
gga_c_pbe_vwn.c
gga_c_pbeloc.c
gga_c_pbe_erf_gws.c
gga_c_pw91.c
gga_c_q2d.c
gga_c_regtpss.c
gga_c_revtca.c
gga_c_scan_e0.c
gga_c_sg4.c
gga_c_sogga11.c
gga_c_tca.c
gga_c_w94.c
gga_c_wi.c
gga_c_wl.c
gga_c_zpbeint.c
gga_c_zvpbeint.c
gga_c_zvpbeloc.c
gga_k_dk.c
gga_k_pg.c
gga_k_rational_p.c
gga_k_meyer.c
gga_k_ol1.c
gga_k_ol2.c
gga_x_ol2.c
gga_k_pearson.c
gga_k_tflw.c
gga_k_thakkar.c
gga_k_gds08.c
gga_k_exp4.c
gga_x_2d_b86.c
gga_x_2d_b86_mgc.c
gga_x_2d_b88.c
gga_x_2d_pbe.c
gga_x_airy.c
gga_x_ak13.c
gga_x_am05.c
gga_x_b86.c
gga_x_b88.c
gga_k_llp.c
gga_k_pw86.c
gga_k_mpbe.c
gga_k_apbe.c
gga_k_apbeint.c
gga_k_lc94.c
gga_k_lkt.c
gga_k_vt84f.c
gga_x_bayesian.c
gga_x_beefvdw.c
gga_x_bpccac.c
gga_x_c09x.c
gga_x_cap.c
gga_x_chachiyo.c
gga_x_dk87.c
gga_x_ev93.c
gga_x_ft97.c
gga_x_g96.c
gga_x_gg99.c
gga_x_hcth_a.c
gga_x_hjs.c
gga_x_hjs_b88_v2.c
gga_x_htbs.c
gga_x_ityh.c
gga_x_ityh_optx.c
gga_x_ityh_pbe.c
gga_x_kt.c
gga_x_lag.c
gga_x_lb.c
gga_x_lg93.c
gga_x_lspbe.c
gga_x_lsrpbe.c
gga_x_lv_rpw86.c
gga_x_mpbe.c
gga_x_n12.c
gga_x_ncap.c
gga_x_optx.c
gga_x_pbe.c
gga_x_pbea.c
gga_x_pbeint.c
gga_x_pbepow.c
gga_x_pbetrans.c
gga_x_pbe_erf_gws.c
gga_x_pw86.c
gga_x_pw91.c
gga_x_q1d.c
gga_x_q2d.c
gga_x_rge2.c
gga_x_rpbe.c
gga_x_s12.c
gga_x_sfat.c
gga_x_sfat_pbe.c
gga_x_sg4.c
gga_x_sogga11.c
gga_x_ssb_sw.c
gga_x_vmt.c
gga_x_vmt84.c
gga_x_wc.c
gga_x_wpbeh.c
gga_x_fd_lb94.c
gga_x_lcgau.c
gga_xc_1w.c
gga_xc_b97.c
gga_xc_edf1.c
gga_xc_oblyp_d.c
gga_xc_th1.c
gga_xc_th2.c
gga_xc_th3.c
gga_xc_vv10.c
gga_k_lgap.c
gga_k_lgap_ge.c
gga_c_ccdf.c
hyb_gga_xc_b1wc.c
hyb_gga_xc_b3lyp.c
hyb_gga_xc_cam_b3lyp.c
hyb_gga_xc_camy_b3lyp.c
hyb_gga_xc_camy_blyp.c
hyb_gga_xc_edf2.c
hyb_gga_xc_hse.c
hyb_gga_xc_lc_blyp.c
hyb_gga_xc_lcy_blyp.c
hyb_gga_xc_lcy_pbe.c
hyb_gga_xc_o3lyp.c
hyb_gga_xc_pbeh.c
hyb_gga_xc_wb97.c
hyb_lda_xc_cam_lda0.c
hyb_lda_xc_bn05.c
hyb_mgga_x_dldf.c
hyb_mgga_x_m05.c
hyb_mgga_x_mvsh.c
hyb_mgga_xc_b88b95.c
hyb_mgga_xc_kcis.c
hyb_mgga_xc_tpssh.c
hyb_mgga_xc_wb97mv.c
hyb_mgga_x_js18.c
hyb_mgga_x_pjs18.c
hyb_gga_xc_b2plyp.c
hyb_gga_xc_src1_blyp.c
hyb_gga_xc_cam_o3lyp.c
hyb_gga_xc_pbe_dh.c
hyb_gga_x_cam_s12.c
hyb_gga_xc_case21.c
hyb_mgga_xc_gas22.c
integrate.c
lda.c
lda_c_1d_csc.c
lda_c_1d_loos.c
lda_c_2d_amgb.c
lda_c_2d_prm.c
lda_c_chachiyo.c
lda_c_chachiyo_mod.c
lda_c_gombas.c
lda_c_hl.c
lda_c_lp96.c
lda_c_ml1.c
lda_c_pk09.c
lda_c_pw.c
lda_c_pz.c
lda_c_rc04.c
lda_c_rpa.c
lda_c_vwn.c
lda_c_vwn_1.c
lda_c_vwn_2.c
lda_c_vwn_3.c
lda_c_vwn_4.c
lda_c_vwn_rpa.c
lda_c_wigner.c
lda_c_gk72.c
lda_c_w20.c
lda_c_pw_erf.c
lda_k_tf.c
lda_k_zlp.c
lda_k_gds08_worker.c
lda_x.c
lda_x_1d_soft.c
lda_x_1d_exponential.c
lda_x_2d.c
lda_x_erf.c
lda_x_rel.c
lda_xc_1d_ehwlrg.c
lda_xc_ksdt.c
lda_xc_teter93.c
lda_xc_zlp.c
lda_c_pmgb06.c
lda_xc_tih.c
lda_x_sloc.c
lda_x_yukawa.c
mgga.c
mgga_c_b88.c
mgga_c_b94.c
mgga_c_bc95.c
mgga_c_cs.c
mgga_c_kcis.c
mgga_c_kcisk.c
mgga_xc_lp90.c
mgga_c_m05.c
mgga_c_m06l.c
mgga_c_m08.c
mgga_c_pkzb.c
mgga_c_revscan.c
mgga_c_revtpss.c
mgga_c_rscan.c
mgga_c_scan.c
mgga_c_scanl.c
mgga_c_tpss.c
mgga_c_tpssloc.c
mgga_c_vsxc.c
mgga_c_cc.c
mgga_c_ccalda.c
mgga_k_pc07.c
mgga_k_csk.c
mgga_k_csk_loc.c
mgga_k_pgslb.c
mgga_x_2d_prhg07.c
mgga_x_2d_prp10.c
mgga_x_br89.c
mgga_x_br89_explicit.c
mgga_x_tb09.c
mgga_x_gvt4.c
mgga_x_gx.c
mgga_x_jk.c
mgga_x_lta.c
mgga_x_m06l.c
mgga_x_m08.c
mgga_x_m11.c
mgga_x_m11_l.c
mgga_x_mbeef.c
mgga_x_mbeefvdw.c
mgga_x_mn12.c
mgga_x_ms.c
mgga_x_msb.c
mgga_x_mvs.c
mgga_x_mvsb.c
mgga_x_pbe_gx.c
mgga_x_pkzb.c
mgga_x_rscan.c
mgga_x_sa_tpss.c
mgga_x_scan.c
mgga_x_scanl.c
mgga_x_tau_hcth.c
mgga_x_tm.c
mgga_x_regtm.c
mgga_x_revtm.c
mgga_x_tpss.c
mgga_x_regtpss.c
mgga_x_vt84.c
mgga_x_rtpss.c
mgga_xc_b97mv.c
mgga_xc_cc06.c
mgga_xc_hle17.c
mgga_xc_otpss_d.c
mgga_xc_zlp.c
mgga_xc_b98.c
mgga_x_2d_js17.c
mgga_x_edmgga.c
mgga_x_gdme.c
mgga_x_rlda.c
mgga_x_scanl.c
mgga_c_scanl.c
mgga_x_mbrxh_bg.c
mgga_x_mbrxc_bg.c
mgga_x_task.c
mgga_x_mggac.c
mgga_x_th.c
mgga_x_mbr.c
mgga_c_ltapw.c
mgga_x_r2scan.c
mgga_c_r2scan.c
mgga_k_lk.c
mgga_k_rda.c
mgga_k_gea2.c
mgga_k_gea4.c
mgga_x_r2scanl.c
mgga_c_r2scanl.c
mgga_c_rregtm.c
mgga_x_mcml.c
mgga_c_rmggac.c
mgga_x_rppscan.c
mgga_c_rppscan.c
mgga_x_r4scan.c
mgga_x_ft98.c
hyb_mgga_xc_br3p86.c
mgga_x_vcml.c
hyb_mgga_xc_r2scan.c
mix_func.c
deorbitalize_func.c
references.c
special_functions.c
math_brent.c
util.c
version.c
)
set(src_prefix "src/")
string(REGEX REPLACE "([^;]+)" "${src_prefix}\\1" sources_list "${raw_sources_list}")
if(ENABLE_CUDA)
set_source_files_properties(${sources_list} PROPERTIES LANGUAGE CUDA)
endif()
set(raw_sources_list_f90
src/libxc_master.F90
)
# when headers namespaced, xc_version include in xc.h needs to be local, not
# system to be found
file(READ ${src_prefix}xc.h _src_contents)
string(REPLACE "<xc_version.h>" "\"xc_version.h\"" _quoted_src "${_src_contents}")
file(WRITE ${PROJECT_BINARY_DIR}/${src_prefix}xc.h "${_quoted_src}")
# provide basic installed rpath, so Fortran lib can find C lib
if (APPLE)
set(base "@loader_path")
else()
set(base "$ORIGIN")
endif()
file(RELATIVE_PATH relDir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_RPATH ${base} ${base}/${relDir})
# STATIC/SHARED on below governed by BUILD_SHARED_LIBS
add_library(xc ${sources_list})
set_target_properties(xc PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_link_libraries(xc INTERFACE ${STANDARD_MATH_LIBRARY})
set_target_properties(xc PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_FPIC}
SOVERSION ${${PROJECT_NAME}_SOMAJOR})
if(${BUILD_SHARED_LIBS})
target_link_libraries(xc PRIVATE ${LIBC_INTERJECT})
if(APPLE)
set_target_properties(xc PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif()
endif()
if(ENABLE_FORTRAN)
enable_language(Fortran)
add_library(xcf03 ${raw_sources_list_f90})
target_link_libraries(xcf03 xc)
set_target_properties(xcf03 PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_FPIC}
SOVERSION ${${PROJECT_NAME}_SOMAJOR})
endif()
add_executable(xc-info "${src_prefix}/xc-info.c")
if(ENABLE_CUDA)
set_source_files_properties("${src_prefix}/xc-info.c" PROPERTIES LANGUAGE CUDA)
endif()
target_link_libraries(xc-info xc)
add_executable(xc-threshold "${src_prefix}/xc-threshold.c")
if(ENABLE_CUDA)
set_source_files_properties("${src_prefix}/xc-threshold.c" PROPERTIES LANGUAGE CUDA)
endif()
target_link_libraries(xc-threshold xc)
include_directories(${PROJECT_SOURCE_DIR}/${src_prefix} # for util.h
${PROJECT_BINARY_DIR}/${src_prefix} # for xc.h
${PROJECT_BINARY_DIR} # for xc_version.h, config.h
)
if(BUILD_TESTING)
find_program(BZip2_EXECUTABLE
NAMES bzip2
DOC "Path to zipping utility")
if(BZip2_EXECUTABLE)
enable_testing ()
add_subdirectory(testsuite)
else()
message(FATAL_ERROR "Install `bzip2` command to enable tests")
endif()
endif()
# <<< Install >>>
# by default, headers NOT namespace protected
install(FILES ${PROJECT_BINARY_DIR}/${src_prefix}/xc.h
${PROJECT_SOURCE_DIR}/${src_prefix}/xc_funcs.h
${PROJECT_SOURCE_DIR}/${src_prefix}/xc_funcs_worker.h
${PROJECT_SOURCE_DIR}/${src_prefix}/xc_funcs_removed.h
${PROJECT_BINARY_DIR}/xc_version.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${NAMESPACE_INSTALL_INCLUDEDIR})
install(TARGETS xc-info
OPTIONAL
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS xc
EXPORT c_interface
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(ENABLE_FORTRAN)
configure_file(cmake/libxcf03.pc.in libxcf03.pc @ONLY)
install(TARGETS xc xcf03
EXPORT f_interface
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES "${PROJECT_BINARY_DIR}/xc_f03_lib_m.mod"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${NAMESPACE_INSTALL_INCLUDEDIR})
if(NOT MSVC)
install(FILES ${PROJECT_BINARY_DIR}/libxcf03.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
endif()
endif()
# <<< Export Interface >>>
target_compile_definitions(xc INTERFACE USING_${PN})
target_include_directories(xc INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
# <<< Export Config >>>
set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PN}")
configure_package_config_file(cmake/${PN}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
VERSION ${${PN}_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
install(EXPORT c_interface
NAMESPACE "${PN}::"
FILE "${PN}Targets-C.cmake"
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
if(ENABLE_FORTRAN)
install(EXPORT f_interface
NAMESPACE "${PN}::"
FILE "${PN}Targets-Fortran.cmake"
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
endif()
if(ENABLE_PYTHON)
set(SOURCE_PYTHON_API
pylibxc/__init__.py
pylibxc/core.py
pylibxc/flags.py
pylibxc/functional.py
pylibxc/structs.py
pylibxc/util.py
pylibxc/version.py
)
install(
FILES ${SOURCE_PYTHON_API}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pylibxc
)
if(UNIX)
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libxc.so.${${PROJECT_NAME}_SOMAJOR} \
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pylibxc/libxc.so)")
endif()
endif()
export(EXPORT c_interface
NAMESPACE "${PN}::"
FILE "${PROJECT_BINARY_DIR}/${PN}Targets.cmake")
if(NOT MSVC)
install(FILES ${PROJECT_BINARY_DIR}/libxc.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
endif()