summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: f04e0c1f14efb4b992d745f2cd378d5c4de3bc3b (plain)
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
cmake_minimum_required(VERSION 3.8)
project(honey_engine)

if (UNIX)
	set(CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic")
	set(CMAKE_C_FLAGS "-g")
endif()

find_package(OpenGL REQUIRED)

set(SRC_ROOT ${CMAKE_SOURCE_DIR}/src)
set(LIB_ROOT ${CMAKE_SOURCE_DIR}/libs)

set(HONEY_SOURCE ${SRC_ROOT}/main.c)
add_executable(honey ${HONEY_SOURCE})

target_include_directories(
	honey PUBLIC
	${LIB_ROOT}
	# ${LIB_ROOT}/lua-5.1.5/src 
	${LIB_ROOT}/luajit-cmake/luajit/src
	${CMAKE_SOURCE_DIR}/src
	${LIB_ROOT}/glfw-3.3.8/include
	${LIB_ROOT}/cglm/include
	${LIB_ROOT}/miniaudio
	${LIB_ROOT}/nanovg/src
)

# disable byte-alignment in cglm
add_definitions(-DCGLM_ALL_UNALIGNED)

# link to third-party included libraries
target_link_directories(
	honey PUBLIC
	${LIB_ROOT}/glfw-3.3.8/src
)

# add_subdirectory(${LIB_ROOT}/lua-5.1.5)
add_subdirectory(${LIB_ROOT}/luajit-cmake)
# add_subdirectory(${LIB_ROOT}/cglm)
add_subdirectory(${LIB_ROOT}/glfw-3.3.8)
add_subdirectory(${LIB_ROOT}/cargs)
add_subdirectory(${LIB_ROOT}/ode-0.16.1)
add_subdirectory(${LIB_ROOT}/nanovg)

# set(LIBRARIES lua5.1 glfw cargs ODE nanovg OpenGL::GL)
set(LIBRARIES libluajit glfw cargs ODE nanovg OpenGL::GL)
if (UNIX)
	set(LIBRARIES ${LIBRARIES} dl pthread m)
endif()
target_link_libraries(honey ${LIBRARIES})


# build tests (optional)

string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")

add_executable(test EXCLUDE_FROM_ALL)
set_target_properties(test PROPERTIES
	C_STANDARD 99
	CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic")
target_link_libraries(test lua5.1 glfw dl)


add_subdirectory(${SRC_ROOT}/glfw)
add_subdirectory(${SRC_ROOT}/glm)
add_subdirectory(${SRC_ROOT}/image)
add_subdirectory(${SRC_ROOT}/import)
add_subdirectory(${SRC_ROOT}/logging)
add_subdirectory(${SRC_ROOT}/miniaudio)
add_subdirectory(${SRC_ROOT}/nvg)
add_subdirectory(${SRC_ROOT}/ode)
add_subdirectory(${SRC_ROOT}/opengl)
add_subdirectory(${SRC_ROOT}/options)
add_subdirectory(${SRC_ROOT}/test)
add_subdirectory(${SRC_ROOT}/util)