-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
121 lines (109 loc) · 4.56 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
cmake_minimum_required(VERSION 3.15)
project(expert_system)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra")
set(CMAKE_CXX_STANDARD 17)
################################################################################
# expert_system_lib target
################################################################################
set(EXPERT_SYSTEM_LIB "${PROJECT_NAME}_lib")
add_library(${EXPERT_SYSTEM_LIB}
src/ExpertSystemLib/ExpertSystemData.cpp
src/ExpertSystemLib/ExpertSystem.cpp
src/ExpertSystemLib/Parse/Lexer.ll.cpp
src/ExpertSystemLib/Parse/Grammar.yy.cpp
src/ExpertSystemLib/Expressions/FactExpression.cpp
src/ExpertSystemLib/Expressions/UnaryExpression.cpp
src/ExpertSystemLib/Expressions/BinaryExpression.cpp
src/ExpertSystemLib/Expressions/Expression.cpp
)
INCLUDE(ParseGenerator.cmake)
target_include_directories(${EXPERT_SYSTEM_LIB} PUBLIC include)
################################################################################
# project target
################################################################################
add_executable(${PROJECT_NAME}
src/main.cpp
src/Visualizer.cpp
)
target_link_libraries(${PROJECT_NAME} ${EXPERT_SYSTEM_LIB})
target_include_directories(${PROJECT_NAME} PUBLIC include)
# replaced executable file to root dir
set_target_properties(${PROJECT_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}"
)
################################################################################
# GLWF library to project target
################################################################################
add_subdirectory(libs/glfw)
target_include_directories(${PROJECT_NAME} PUBLIC ${GLFW_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} glfw)
################################################################################
# GLEW library to project target
################################################################################
if (INSTALL_DEPS)
set(GLEW_LIB glew-glew-2.1.0)
execute_process(
COMMAND curl -O https://codeload.github.com/nigels-com/glew/tar.gz/glew-2.1.0
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs)
execute_process(
COMMAND tar -xzvf glew-2.1.0
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs)
execute_process(
COMMAND rm glew-2.1.0
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs)
execute_process(
COMMAND make -C auto
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/${GLEW_LIB})
execute_process(
COMMAND make -j4 glew.lib.static
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/${GLEW_LIB})
endif()
add_definitions(-DGLEW_STATIC)
target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/libs/${GLEW_LIB}/include)
target_link_libraries(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/libs/${GLEW_LIB}/lib/libGLEW.a)
################################################################################
# IMGUI library
################################################################################
target_sources(${PROJECT_NAME} PUBLIC
libs/imgui/imgui.cpp
libs/imgui/imgui_demo.cpp
libs/imgui/imgui_draw.cpp
libs/imgui/imgui_widgets.cpp
libs/imgui/imgui_tables.cpp
libs/imgui/backends/imgui_impl_glfw.cpp
libs/imgui/backends/imgui_impl_opengl3.cpp
)
target_include_directories(${PROJECT_NAME} PUBLIC
libs/imgui
libs/imgui/backends
)
################################################################################
# tests
################################################################################
set(EXPERT_SYSTEM_TESTS ${PROJECT_NAME}_tests)
add_subdirectory(libs/googletest)
add_executable(${EXPERT_SYSTEM_TESTS}
tests/Find_All_Implies_Expressions_Tests.cpp
tests/Not_Correct_Input_Tests.cpp
tests/Correct_XOR_Operations_Tests.cpp
tests/And_Tests.cpp
tests/Or_Tests.cpp
tests/Xor_Tests.cpp
tests/Not_Tests.cpp
tests/Same_Conclusion_In_Multiple_Rules_Tests.cpp
tests/Parentheses_Tests.cpp)
target_include_directories(${EXPERT_SYSTEM_TESTS} PUBLIC
libs/googletest/googletest/include
include)
target_link_libraries(${EXPERT_SYSTEM_TESTS}
gtest
gtest_main
${EXPERT_SYSTEM_LIB}
)
# replaced executable file to root dir
set_target_properties(${EXPERT_SYSTEM_TESTS}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}"
)