-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
150 lines (103 loc) · 3.52 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
# STUDENT CMakeLists.txt
#
# tabs: 8 space
# CMake initialization
cmake_minimum_required(VERSION 3.20)
project("ProjetC_IG")
# Paths
get_filename_component(ROOT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
set(HEADER_DIRS "${ROOT_DIR}/api")
set(TEST_DIR "${ROOT_DIR}/tests")
set(DOCS_DIR "${ROOT_DIR}/docs")
set(SRC "${ROOT_DIR}/implem")
set(LIB_FLAGS -lfreeimage -lSDL2 -lSDL2_ttf -lSDL2_gfx)
if(IG_ASAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
endif(IG_ASAN)
# Platform specific definitions
if(${APPLE})
set(HEADER_DIRS ${HEADER_DIRS}
"/opt/local/include/SDL2"
"/opt/local/include")
set(PLATFORM_DIR "${ROOT_DIR}/_macos")
set(PLATFORM_LIB_FLAGS eibase -L/opt/local/lib ${LIB_FLAGS})
message(STATUS "Building for MacOS")
elseif(${UNIX})
set(HEADER_DIRS ${HEADER_DIRS}
"/usr/include/SDL2")
set(PLATFORM_DIR "${ROOT_DIR}/_x11")
set(PLATFORM_LIB_FLAGS eibase ${LIB_FLAGS} -lm)
message(STATUS "Building for Linux")
else()
set(SDL "C:/projetc/SDL2_windows")
set(HEADER_DIRS ${HEADER_DIRS}
"${SDL}/include")
add_definitions(-D_AMD64_=1 -D__WIN__=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4068)
set(PLATFORM_DIR "${ROOT_DIR}/_win")
set(PLATFORM_LIB_FLAGS eibase
${SDL}/lib/${ARCH}/SDL2.lib
${SDL}/lib/${ARCH}/SDL2_gfx.lib
${SDL}/lib/${ARCH}/SDL2_ttf.lib
${SDL}/lib/${ARCH}/FreeImage.lib)
message(STATUS "Building for Windows")
endif(${APPLE})
# General definitions for all targets
include_directories(${HEADER_DIRS})
link_directories(${PLATFORM_DIR})
# target ei (libei)
set(LIB_EI_SOURCES
${SRC}/ei_application.c
${SRC}/ei_dessin_relief.c
${SRC}/ei_draw.c
${SRC}/ei_draw_widget.c
${SRC}/ei_im_draw.c
${SRC}/ei_anchor.c
${SRC}/ei_callback.c
${SRC}/ei_entry.c
${SRC}/ei_event.c
${SRC}/ei_geometrymanager.c
${SRC}/ei_parser.c
${SRC}/ei_placer.c
${SRC}/ei_types.c
${SRC}/ei_utils.c
${SRC}/ei_widget.c
${SRC}/ei_widgetclass.c
${SRC}/ei_widget_attributes.c
${SRC}/ei_widget_configure.c
)
add_library(ei STATIC ${LIB_EI_SOURCES})
# target minimal
add_executable(minimal ${TEST_DIR}/minimal.c)
target_link_libraries(minimal ${PLATFORM_LIB_FLAGS})
# target frame
add_executable(frame ${TEST_DIR}/frame.c)
target_link_libraries(frame ei ${PLATFORM_LIB_FLAGS})
# target button
add_executable(button ${TEST_DIR}/button.c)
target_link_libraries(button ei ${PLATFORM_LIB_FLAGS})
# target hello_world
add_executable(hello_world ${TEST_DIR}/hello_world.c)
target_link_libraries(hello_world ei ${PLATFORM_LIB_FLAGS})
# target entry
add_executable(entry ${TEST_DIR}/entry.c)
target_link_libraries(entry ei ${PLATFORM_LIB_FLAGS})
# target puzzle
add_executable(puzzle ${TEST_DIR}/puzzle.c)
target_link_libraries(puzzle ei ${PLATFORM_LIB_FLAGS})
# target two048
add_executable(two048 ${TEST_DIR}/two048.c)
target_link_libraries(two048 ei ${PLATFORM_LIB_FLAGS})
# target minesweeper
add_executable(minesweeper ${TEST_DIR}/minesweeper.c)
target_link_libraries(minesweeper ei ${PLATFORM_LIB_FLAGS})
# target ext_testclass
add_executable(ext_testclass ${TEST_DIR}/ext_testclass.c)
target_link_libraries(ext_testclass testclass ei ${PLATFORM_LIB_FLAGS})
# target test_ext_gm
add_executable(ext_testgm ${TEST_DIR}/ext_testgm.c)
target_link_libraries(ext_testgm testgm ei ${PLATFORM_LIB_FLAGS})
# target parsing
add_executable(parsing ${TEST_DIR}/parsing.c)
target_link_libraries(parsing ei ${PLATFORM_LIB_FLAGS})
# target to build the documentation
add_custom_target(doc doxygen ${DOCS_DIR}/doxygen.cfg WORKING_DIRECTORY ${ROOT_DIR})