TIC-80-guile/CMakeLists.txt

158 lines
3.9 KiB
CMake
Raw Normal View History

2018-05-17 16:32:25 +02:00
project(tic80)
set(CMAKE_C_STANDARD 99)
################################
# LUA
################################
set(LUA_DIR 3rd-party/lua-5.3.1/src)
set(LUA_SRC
${LUA_DIR}/lapi.c
${LUA_DIR}/lcode.c
${LUA_DIR}/lctype.c
${LUA_DIR}/ldebug.c
${LUA_DIR}/ldo.c
${LUA_DIR}/ldump.c
${LUA_DIR}/lfunc.c
${LUA_DIR}/lgc.c
${LUA_DIR}/llex.c
${LUA_DIR}/lmem.c
${LUA_DIR}/lobject.c
${LUA_DIR}/lopcodes.c
${LUA_DIR}/lparser.c
${LUA_DIR}/lstate.c
${LUA_DIR}/lstring.c
${LUA_DIR}/ltable.c
${LUA_DIR}/ltm.c
${LUA_DIR}/lundump.c
${LUA_DIR}/lvm.c
${LUA_DIR}/lzio.c
${LUA_DIR}/lauxlib.c
${LUA_DIR}/lbaselib.c
${LUA_DIR}/lbitlib.c
${LUA_DIR}/lcorolib.c
${LUA_DIR}/ldblib.c
${LUA_DIR}/liolib.c
${LUA_DIR}/lmathlib.c
${LUA_DIR}/loslib.c
${LUA_DIR}/lstrlib.c
${LUA_DIR}/ltablib.c
${LUA_DIR}/lutf8lib.c
${LUA_DIR}/loadlib.c
${LUA_DIR}/linit.c
)
add_library(lua STATIC ${LUA_SRC})
################################
# LPEG
################################
set(LPEG_DIR 3rd-party/lpeg-1.0.1)
set(LPEG_SRC
${LPEG_DIR}/lpcap.c
${LPEG_DIR}/lpcode.c
${LPEG_DIR}/lpprint.c
${LPEG_DIR}/lptree.c
${LPEG_DIR}/lpvm.c
)
add_library(lpeg STATIC ${LPEG_SRC})
target_include_directories(lpeg PRIVATE 3rd-party/lua-5.3.1/src)
set(TIC80_DIR src)
set(TIC80_SRC
${TIC80_DIR}/tic80.c
${TIC80_DIR}/tic.c
${TIC80_DIR}/tools.c
${TIC80_DIR}/jsapi.c
${TIC80_DIR}/luaapi.c
${TIC80_DIR}/wrenapi.c
${TIC80_DIR}/ext/gif.c
3rd-party/blip-buf/blip_buf.c # TODO: link it as lib?
3rd-party/duktape-2.2.0/src/duktape.c # TODO: link it as lib?
)
################################
# WREN
################################
set(WREN_DIR 3rd-party/wren-0.1.0/src)
set(WREN_SRC
${WREN_DIR}/optional/wren_opt_meta.c
${WREN_DIR}/optional/wren_opt_random.c
${WREN_DIR}/vm/wren_compiler.c
${WREN_DIR}/vm/wren_core.c
${WREN_DIR}/vm/wren_debug.c
${WREN_DIR}/vm/wren_primitive.c
${WREN_DIR}/vm/wren_utils.c
${WREN_DIR}/vm/wren_value.c
${WREN_DIR}/vm/wren_vm.c
)
add_library(wren STATIC ${WREN_SRC})
target_include_directories(wren PRIVATE 3rd-party/wren-0.1.0/src/include)
target_include_directories(wren PRIVATE 3rd-party/wren-0.1.0/src/optional)
target_include_directories(wren PRIVATE 3rd-party/wren-0.1.0/src/vm)
################################
# GIFLIB
################################
set(GIFLIB_DIR 3rd-party/giflib-5.1.4/lib)
set(GIFLIB_SRC
${GIFLIB_DIR}/dgif_lib.c
${GIFLIB_DIR}/egif_lib.c
${GIFLIB_DIR}/gif_err.c
${GIFLIB_DIR}/gif_font.c
${GIFLIB_DIR}/gif_hash.c
${GIFLIB_DIR}/gifalloc.c
${GIFLIB_DIR}/openbsd-reallocarray.c
)
add_library(giflib STATIC ${GIFLIB_SRC})
target_include_directories(giflib PRIVATE ${GIFLIB_DIR})
################################
# TIC-80 lib
################################
add_library(tic80lib STATIC ${TIC80_SRC})
target_include_directories(tic80lib PRIVATE include)
target_include_directories(tic80lib PRIVATE 3rd-party/blip-buf)
target_include_directories(tic80lib PRIVATE 3rd-party/duktape-2.2.0/src)
target_include_directories(tic80lib PRIVATE 3rd-party/lua-5.3.1/src)
target_include_directories(tic80lib PRIVATE 3rd-party/giflib-5.1.4/lib)
target_include_directories(tic80lib PRIVATE 3rd-party/wren-0.1.0/src/include)
target_include_directories(tic80lib PRIVATE 3rd-party/moonscript)
target_include_directories(tic80lib PRIVATE 3rd-party/fennel)
add_dependencies(tic80lib lua lpeg wren giflib)
target_link_libraries(tic80lib lua lpeg wren giflib)
2018-05-17 20:53:42 +02:00
if(WIN32)
set(HAVE_LIBC TRUE)
endif()
2018-05-17 17:02:52 +02:00
set(SDL_STATIC ON)
2018-05-17 16:32:25 +02:00
add_subdirectory(3rd-party/SDL2-2.0.7)
set(EXAMPLE_DIR examples)
set(EXAMPLE_SRC
${EXAMPLE_DIR}/sdl-renderer.c
)
2018-05-17 17:02:52 +02:00
if(WIN32)
2018-05-17 20:53:42 +02:00
add_executable(sdl-renderer WIN32 ${EXAMPLE_SRC})
2018-05-17 17:02:52 +02:00
else()
2018-05-17 20:53:42 +02:00
add_executable(sdl-renderer ${EXAMPLE_SRC})
2018-05-17 17:02:52 +02:00
endif()
2018-05-17 16:32:25 +02:00
2018-05-17 20:53:42 +02:00
target_include_directories(sdl-renderer PRIVATE 3rd-party/SDL2-2.0.7/include)
target_include_directories(sdl-renderer PRIVATE include)
target_include_directories(sdl-renderer PRIVATE src)
2018-05-17 16:32:25 +02:00
2018-05-17 20:53:42 +02:00
add_dependencies(sdl-renderer tic80lib SDL2-static SDL2main)
target_link_libraries(sdl-renderer tic80lib SDL2-static SDL2main)