CMakeLists.txt 2.91 KB
Newer Older
damien's avatar
damien committed
1
2
3
cmake_minimum_required(VERSION 3.5)
project(spell_qtl)

4
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE TYPE INTERNAL FORCE)
damien's avatar
damien committed
5

6
7
8
9
set(CMAKE_VERBOSE_MAKEFILE ON)

MESSAGE(STATUS "CMAKE VERSION ${CMAKE_VERSION}")
MESSAGE(STATUS "${CMAKE_CURRENT_SOURCE_DIR}")
damien's avatar
damien committed
10
11

execute_process(
12
13
        COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/get_patch_number.sh
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
damien's avatar
damien committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
        OUTPUT_VARIABLE VERSION_PATCH
        OUTPUT_STRIP_TRAILING_WHITESPACE
)

execute_process(
        COMMAND git tag
        COMMAND tail -1
        OUTPUT_VARIABLE LAST_TAG
        OUTPUT_STRIP_TRAILING_WHITESPACE
)

STRING(REGEX MATCHALL "[0-9]+" VERSION "${LAST_TAG}")

MESSAGE(STATUS "LAST TAG ${LAST_TAG}")
MESSAGE(STATUS "VERSION ${VERSION}")

LIST(GET VERSION 0 VERSION_MAJOR)
LIST(GET VERSION 1 VERSION_MINOR)

set(CMAKE_CXX_STANDARD 11)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall -Wno-unused-parameter -pthread -fPIC")
36
37
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG -DEIGEN_NO_DEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -ggdb")
damien's avatar
damien committed
38
39
40
41
42
43
44

add_definitions(-DEIGEN_NO_DEPRECATED_WARNING -DVERSION_MAJOR=\"${VERSION_MAJOR}\" -DVERSION_MINOR=\"${VERSION_MINOR}\" -DVERSION_PATCH=\"${VERSION_PATCH}\")

MESSAGE(STATUS "CXX FLAGS ${CMAKE_CXX_FLAGS}")

find_library(EXPAT_LIBRARY_NAMES expat)
find_path(EXPAT_INCLUDE_DIR expat.h HINTS /usr/include /usr/local/include /usr/include/expat/ /usr/local/include/expat/)
45
46
find_path(X2C_INCLUDE_DIR x2c/x2c.h HINTS /usr/include/ /usr/local/include/ /home/daleroux/include/)
find_path(EIGEN_INCLUDE_DIR Eigen/Eigen HINTS /usr/include /usr/local/include /usr/include/eigen3/ /usr/local/include/eigen3/ /home/daleroux/include/eigen3/)
damien's avatar
damien committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

include_directories(AFTER 3rd-party/ThreadPool)
include_directories(AFTER include/ include/input/ include/bayes/ ${EIGEN_INCLUDE_DIR})
include_directories(SYSTEM ${EXPAT_INCLUDE_DIR} ${X2C_INCLUDE_DIR})

set(SPELL_PEDIGREE_SRC
        src/static_data.cc
        src/pedigree/main.cc
        src/pedigree/cli.cc
)

set(SPELL_MARKER_SRC
        src/input/read_mark.cc src/input/design.cc src/input/read_map.cc src/input/xml/xml_design.cc src/input/xml/xml_format.cc
        src/static_data.cc
        src/bayes/main.cc src/bayes/dispatch.cc src/bayes/jobs.cc src/bayes/cli.cc
)

set(SPELL_QTL_SRC
        src/input/read_map.cc src/input/read_trait.cc src/input/read_settings.cc src/input/ld_matrices.cc src/input/xml/xml_format.cc src/input/xml/xml_settings.cc
        src/static_data.cc src/main.cc src/beta_gamma.cc
        src/computations/basic_data.cc src/computations/probabilities.cc src/computations/model.cc src/computations/frontends.cc
)

70
71
72
add_executable(spell-pedigree ${SPELL_PEDIGREE_SRC})
add_executable(spell-marker ${SPELL_MARKER_SRC})
add_executable(spell-qtl ${SPELL_QTL_SRC})
damien's avatar
damien committed
73

74
75
target_link_libraries(spell-marker expat dl)
target_link_libraries(spell-qtl expat dl)
damien's avatar
damien committed
76
77
78
set(CMAKE_EXE_LINKER_FLAGS "-rdynamic")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)