-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
70 lines (62 loc) · 1.97 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
cmake_minimum_required(VERSION 3.0.1)
project(brandy)
set(BRANDY_USE_GRAPHICS ON CACHE BOOL "Use Graphics")
set(BRANDY_USE_ANSI ON CACHE BOOL "Use ANSI Escape Sequences")
set(SRCDIR src)
set(SRC ${SRCDIR}/variables.c ${SRCDIR}/tokens.c ${SRCDIR}/strings.c
${SRCDIR}/statement.c ${SRCDIR}/stack.c ${SRCDIR}/miscprocs.c
${SRCDIR}/mainstate.c ${SRCDIR}/lvalue.c ${SRCDIR}/keyboard.c
${SRCDIR}/iostate.c ${SRCDIR}/heap.c ${SRCDIR}/functions.c
${SRCDIR}/fileio.c ${SRCDIR}/evaluate.c ${SRCDIR}/errors.c
${SRCDIR}/mos.c ${SRCDIR}/editor.c ${SRCDIR}/convert.c
${SRCDIR}/commands.c ${SRCDIR}/brandy.c ${SRCDIR}/assign.c
${SRCDIR}/net.c ${SRCDIR}/mos_sys.c)
if(BRANDY_USE_GRAPHICS)
set(SRC ${SRC} ${SRCDIR}/graphsdl.c)
if(NOT WIN32)
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
link_libraries(${X11_LIBRARIES})
endif()
find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
link_libraries(${SDL_LIBRARY})
add_definitions(-DUSE_SDL)
else()
if(BRANDY_USE_ANSI)
set(SRC ${SRC} ${SRCDIR}/textonly.c)
else()
set(SRC ${SRC} ${SRCDIR}/simpletext.c)
endif()
if (WIN32)
add_definitions(-DBODGEMGW)
endif()
add_definitions(-DNO_SDL)
endif()
if(WIN32)
link_libraries(wsock32 ws2_32)
endif()
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git log -1 --format=%cd
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions(-DBRANDY_GITCOMMIT=\"${GIT_COMMIT}\" -DBRANDY_GITBRANCH=\"${GIT_BRANCH}\" -DBRANDY_GITDATE=\"${GIT_DATE}\")
add_definitions(-DDEFAULT_IGNORE)
link_libraries(m)
add_executable(brandy ${SRC})
add_library(brandyapp ${SRC})
target_compile_definitions(brandyapp PUBLIC -DBRANDYAPP)