-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (39 loc) · 1.72 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
cmake_minimum_required(VERSION 3.16)
project(fractal)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk4)
pkg_check_modules(GD REQUIRED gdlib)
include_directories(${GD_INCLUDE_DIR})
include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GD_LIBRARY_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
add_definitions(${GTK_CFLAGS_OTHER})
if (NOT WIN32)
set(MATH "m")
else ()
add_definitions(-DYY_NO_UNISTD_H -D_USE_MATH_DEFINES)
endif ()
set(source lsystem.c lsystem_iter.c lines_normilize.c lines_save_png.c lines_save_txt.c)
flex_target(lsystem_scanner lsystem_scanner.l ${CMAKE_CURRENT_BINARY_DIR}/lsystem_scanner.c
COMPILE_FLAGS "--header-file=${CMAKE_CURRENT_BINARY_DIR}/lsystem_scanner.h"
DEFINES_FILE "${CMAKE_CURRENT_BINARY_DIR}/lsystem_scanner.h")
flex_target(turtle_scanner turtle_scanner.l ${CMAKE_CURRENT_BINARY_DIR}/turtle_scanner.c
COMPILE_FLAGS "--header-file=${CMAKE_CURRENT_BINARY_DIR}/turtle_scanner.h"
DEFINES_FILE "${CMAKE_CURRENT_BINARY_DIR}/turtle_scanner.h")
bison_target(lsystem_parser lsystem_parser.y ${CMAKE_CURRENT_BINARY_DIR}/lsystem_parser.c COMPILE_FLAGS "-Wcounterexamples")
add_flex_bison_dependency(lsystem_scanner lsystem_parser)
set(source ${source}
${BISON_lsystem_parser_OUTPUTS}
${FLEX_lsystem_scanner_OUTPUTS}
${FLEX_turtle_scanner_OUTPUTS}
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library(fractal ${source})
add_executable(lsystem main.c)
target_link_libraries(lsystem fractal ${GD_LIBRARIES} ${MATH})
add_executable(lsystem_gui main_gui.c)
target_link_libraries(lsystem_gui fractal ${GD_LIBRARIES} ${GTK_LIBRARIES} ${MATH})