# Copyright (C) 2007-2009 LuaDist. # Created by Peter Kapec # Redistribution and use of this file is allowed according to the terms of the MIT license. # For details see the COPYRIGHT file distributed with LuaDist. # Please note that the package source code is licensed under its own license. PROJECT(luatask C) CMAKE_MINIMUM_REQUIRED(VERSION 2.6 ) # Where to install module parts: SET (INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules.") SET (INSTALL_DATA . CACHE PATH "Directory the package can store documentation, tests or other data in.") SET (INSTALL_DOC ${INSTALL_DATA}/doc CACHE PATH "Recommended directory to install documentation into.") SET (INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH "Recommended directory to install examples into.") # We need Lua to compile FIND_PACKAGE (Lua51 REQUIRED) INCLUDE_DIRECTORIES( ${LUA_INCLUDE_DIR}) # Detect threading support. # TODO: Windows can use Pthreads-Win32. FIND_PACKAGE(Threads) IF(CMAKE_USE_WIN32_THREADS_INIT) ADD_DEFINITIONS(-DNATV_WIN32 "-DLUATASK_API=__declspec(dllexport)") ELSEIF(CMAKE_USE_PTHREADS_INIT) ADD_DEFINITIONS(-DLUATASK_API= -DLUATASK_PTHREAD_STACK_SIZE=2097152/16) SET(LIBS pthread) ENDIF() # Build modules ADD_LIBRARY(task MODULE src/LuaTask/ltask.c src/LuaTask/queue.c src/LuaTask/syncos.c) TARGET_LINK_LIBRARIES(task ${LUA_LIBRARY} ${LIBS}) SET_TARGET_PROPERTIES(task PROPERTIES PREFIX "") # Install all files and documentation INSTALL(TARGETS task DESTINATION ${INSTALL_CMOD}) INSTALL(FILES ChangeLog LICENSE README DESTINATION ${INSTALL_DATA}) INSTALL(DIRECTORY doc/ DESTINATION ${INSTALL_DOC}) INSTALL(DIRECTORY examples/ DESTINATION ${INSTALL_EXAMPLE})