-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCMakeLists.txt
98 lines (77 loc) · 2.89 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
#
# Master Opencog CMake file.
#
# We need at least version 3.13 to get TARGET_LINK_DIRECTORIES
MESSAGE("Found CMake version ${CMAKE_VERSION}")
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(generate)
# default build type
IF (CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE Release)
ENDIF (CMAKE_BUILD_TYPE STREQUAL "")
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# add the 'lib' dir to cmake's module search path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/lib/")
# Cogutil
FIND_PACKAGE(CogUtil)
IF (COGUTIL_FOUND)
MESSAGE(STATUS "CogUtil found.")
ADD_DEFINITIONS(-DHAVE_COGUTIL)
SET(HAVE_COGUTIL 1)
INCLUDE_DIRECTORIES(${COGUTIL_INCLUDE_DIR})
ELSE (COGUTIL_FOUND)
MESSAGE(FATAL_ERROR "CogUtil missing: it is needed for everything!")
ENDIF (COGUTIL_FOUND)
# add the 'cmake' directory from cogutil to search path
list(APPEND CMAKE_MODULE_PATH ${COGUTIL_DATA_DIR}/cmake)
include(${COGUTIL_DATA_DIR}/cmake/OpenCogGccOptions.cmake)
include(${COGUTIL_DATA_DIR}/cmake/OpenCogLibOptions.cmake)
include(${COGUTIL_DATA_DIR}/cmake/OpenCogInstallOptions.cmake)
include(${COGUTIL_DATA_DIR}/cmake/Summary.cmake)
# ===================================================================
# Check for existance of various required, optional packages.
# AtomSpace
FIND_PACKAGE(AtomSpace 5.0.3 REQUIRED)
IF (ATOMSPACE_FOUND)
MESSAGE(STATUS "AtomSpace found.")
ADD_DEFINITIONS(-DHAVE_ATOMSPACE)
SET(HAVE_ATOMSPACE 1)
INCLUDE_DIRECTORIES(${ATOMSPACE_INCLUDE_DIR})
ELSE (ATOMSPACE_FOUND)
MESSAGE(FATAL_ERROR "AtomSpace missing: it is needed for everything!")
ENDIF (ATOMSPACE_FOUND)
# ----------------------------------------------------------
# Needed for unit tests.
FIND_PACKAGE(Cxxtest)
IF (CXXTEST_FOUND)
MESSAGE(STATUS "CxxTest found.")
ELSE (CXXTEST_FOUND)
MESSAGE(STATUS "CxxTest missing: needed for unit tests.")
ENDIF (CXXTEST_FOUND)
# ----------------------------------------------------------
# This is required for Guile
include(OpenCogFindGuile)
# ===================================================================
# Global includes
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR} ${CMAKE_BINARY_DIR}
${COGUTIL_INCLUDE_DIR})
INCLUDE("${ATOMSPACE_DATA_DIR}/cmake/OpenCogGuile.cmake")
# ===================================================================
# Add subdirectories
ADD_SUBDIRECTORY(opencog)
IF (CXXTEST_FOUND)
ADD_CUSTOM_TARGET(tests)
ADD_SUBDIRECTORY(tests EXCLUDE_FROM_ALL)
ADD_CUSTOM_TARGET(test
DEPENDS tests
WORKING_DIRECTORY tests
COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure $(ARGS)
COMMENT "Running tests..."
)
ENDIF (CXXTEST_FOUND)
# ===================================================================
# Show a summary of what we got
SUMMARY_ADD("Generate" "Graph Generation" HAVE_ATOMSPACE)
SUMMARY_ADD("Scheme bindings" "Scheme (guile) bindings" HAVE_GUILE)
SUMMARY_ADD("Unit tests" "Unit tests" CXXTEST_FOUND)
SUMMARY_SHOW()