summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: fe564f7df89948a11aa5143c3ba76ba3f1a7fcdd (plain)
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

cmake_minimum_required(VERSION 3.0)
project(wolff)

set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

set (CMAKE_CXX_STANDARD 17)
set (CMAKE_C_STANDARD 11)

include_directories(lib ~/.local/include)
link_directories(~/.local/lib)

file(GLOB CSOURCES lib/*.c)
file(GLOB CPPSOURCES lib/*.cpp)

add_executable(wolff_ising src/wolff_ising.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_dgm src/wolff_dgm.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_cgm src/wolff_cgm.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_3potts src/wolff_potts.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_4potts src/wolff_potts.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_7potts src/wolff_potts.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_3clock src/wolff_clock.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_5clock src/wolff_clock.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_planar src/wolff_On.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(wolff_heisenberg src/wolff_On.cpp ${CPPSOURCES} ${CSOURCES})
add_executable(analyze_correlations src/analyze_correlations.cpp ${CPPSOURCES} ${CSOURCES})

SET_TARGET_PROPERTIES(wolff_3potts PROPERTIES COMPILE_FLAGS "-DPOTTSQ=3")
SET_TARGET_PROPERTIES(wolff_4potts PROPERTIES COMPILE_FLAGS "-DPOTTSQ=4")
SET_TARGET_PROPERTIES(wolff_7potts PROPERTIES COMPILE_FLAGS "-DPOTTSQ=7")
SET_TARGET_PROPERTIES(wolff_3clock PROPERTIES COMPILE_FLAGS "-DPOTTSQ=3")
SET_TARGET_PROPERTIES(wolff_5clock PROPERTIES COMPILE_FLAGS "-DPOTTSQ=5")
SET_TARGET_PROPERTIES(wolff_planar PROPERTIES COMPILE_FLAGS "-DN_COMP=2")
SET_TARGET_PROPERTIES(wolff_heisenberg PROPERTIES COMPILE_FLAGS "-DN_COMP=3")

find_library(GSL REQUIRED NAMES gsl)
find_library(FFTW REQUIRED NAMES fftw3)
find_library(M REQUIRED NAMES m)
FIND_LIBRARY(GL NAMES GL)
FIND_LIBRARY(GLU NAMES GLU)
FIND_LIBRARY(GLUT NAMES glut)

target_link_libraries(analyze_correlations cblas gsl fftw3 m)

if (${GLUT} MATCHES "GLUT-NOTFOUND")
  target_link_libraries(wolff_ising cblas gsl m)
  target_link_libraries(wolff_dgm cblas gsl m)
  target_link_libraries(wolff_cgm cblas gsl m)
  target_link_libraries(wolff_3potts cblas gsl m)
  target_link_libraries(wolff_4potts cblas gsl m)
  target_link_libraries(wolff_7potts cblas gsl m)
  target_link_libraries(wolff_3clock cblas gsl m)
  target_link_libraries(wolff_5clock cblas gsl m)
  target_link_libraries(wolff_heisenberg cblas gsl m)
  target_link_libraries(wolff_planar cblas gsl m)
else()
  target_link_libraries(wolff_ising cblas gsl m glut GL GLU)
  target_link_libraries(wolff_dgm cblas gsl m glut GL GLU)
  target_link_libraries(wolff_cgm cblas gsl m glut GL GLU)
  target_link_libraries(wolff_3potts cblas gsl m glut GL GLU)
  target_link_libraries(wolff_4potts cblas gsl m glut GL GLU)
  target_link_libraries(wolff_7potts cblas gsl m glut GL GLU)
  target_link_libraries(wolff_3clock cblas gsl m glut GL GLU)
  target_link_libraries(wolff_5clock cblas gsl m glut GL GLU)
  target_link_libraries(wolff_heisenberg cblas gsl m glut GL GLU)
  target_link_libraries(wolff_planar cblas gsl m glut GL GLU)
  target_compile_definitions(wolff_ising PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_dgm PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_cgm PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_3potts PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_4potts PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_7potts PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_3clock PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_5clock PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_planar PUBLIC HAVE_GLUT)
  target_compile_definitions(wolff_heisenberg PUBLIC HAVE_GLUT)
endif()

install(TARGETS wolff_ising wolff_dgm wolff_cgm wolff_3potts wolff_4potts wolff_3clock wolff_heisenberg wolff_planar analyze_correlations DESTINATION bin)