diff --git a/.travis.yml b/.travis.yml index d2a3488050..6766135c52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,6 @@ matrix: - libxml2-dev - libcurl4-gnutls-dev - liblua5.1-0-dev - - libtolua++5.1-dev - libcairo2-dev - libimlib2-dev - libxinerama-dev @@ -37,7 +36,6 @@ matrix: - audacious-dev - libsystemd-dev - libxml2-dev - - tolua++ - gawk env: - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" @@ -58,7 +56,6 @@ matrix: - libxml2-dev - libcurl4-gnutls-dev - liblua5.1-0-dev - - libtolua++5.1-dev - libcairo2-dev - libimlib2-dev - libxinerama-dev @@ -77,7 +74,6 @@ matrix: - audacious-dev - libsystemd-dev - libxml2-dev - - tolua++ - gawk env: - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" @@ -98,7 +94,6 @@ matrix: - libxml2-dev - libcurl4-gnutls-dev - liblua5.1-0-dev - - libtolua++5.1-dev - libcairo2-dev - libimlib2-dev - libxinerama-dev @@ -117,7 +112,6 @@ matrix: - audacious-dev - libsystemd-dev - libxml2-dev - - tolua++ - gawk env: - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" @@ -138,7 +132,6 @@ matrix: - libxml2-dev - libcurl4-gnutls-dev - liblua5.1-0-dev - - libtolua++5.1-dev - libcairo2-dev - libimlib2-dev - libxinerama-dev @@ -157,7 +150,6 @@ matrix: - audacious-dev - libsystemd-dev - libxml2-dev - - tolua++ - gawk env: - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" @@ -178,7 +170,6 @@ matrix: - libxml2-dev - libcurl4-gnutls-dev - liblua5.1-0-dev - - libtolua++5.1-dev - libcairo2-dev - libimlib2-dev - libxinerama-dev @@ -197,7 +188,6 @@ matrix: - audacious-dev - libsystemd-dev - libxml2-dev - - tolua++ - gawk env: - MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0" @@ -219,7 +209,6 @@ matrix: - libxml2-dev - libcurl4-gnutls-dev - liblua5.1-0-dev - - libtolua++5.1-dev - libcairo2-dev - libimlib2-dev - libxinerama-dev @@ -238,7 +227,6 @@ matrix: - audacious-dev - libsystemd-dev - libxml2-dev - - tolua++ - gawk sonarcloud: organization: "brndnmtthws-github" @@ -257,7 +245,7 @@ before_install: - | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; - brew install freetype gettext lua imlib2 ccache; + brew install freetype gettext lua imlib2 librsvg ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link gettext --force ; fi @@ -266,58 +254,60 @@ before_script: if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir build && cd build - cmake \ + cmake \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DBUILD_MYSQL=ON \ - -DBUILD_LUA_CAIRO=ON \ - -DBUILD_LUA_IMLIB2=ON \ - -DBUILD_LUA_RSVG=ON \ - -DBUILD_LUA_CAIRO=ON \ - -DBUILD_AUDACIOUS=ON \ - -DBUILD_XMMS2=ON \ - -DBUILD_ICAL=ON \ - -DBUILD_IRC=ON \ - -DBUILD_HTTP=ON \ - -DBUILD_ICONV=ON \ - -DBUILD_PULSEAUDIO=ON \ - -DBUILD_JOURNAL=ON \ - -DBUILD_RSS=ON \ + -DBUILD_MYSQL=ON \ + -DBUILD_LUA_IMLIB2=ON \ + -DBUILD_LUA_RSVG=ON \ + -DBUILD_LUA_CAIRO=ON \ + -DBUILD_AUDACIOUS=ON \ + -DBUILD_XMMS2=ON \ + -DBUILD_ICAL=ON \ + -DBUILD_IRC=ON \ + -DBUILD_HTTP=ON \ + -DBUILD_ICONV=ON \ + -DBUILD_PULSEAUDIO=ON \ + -DBUILD_JOURNAL=ON \ + -DBUILD_RSS=ON \ .. cd .. mkdir build-no-x11 cd build-no-x11 - cmake \ + cmake \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DBUILD_X11=OFF \ - -DBUILD_MYSQL=ON \ - -DBUILD_LUA_CAIRO=ON \ - -DBUILD_LUA_IMLIB2=ON \ - -DBUILD_LUA_RSVG=ON \ - -DBUILD_LUA_CAIRO=ON \ - -DBUILD_AUDACIOUS=ON \ - -DBUILD_XMMS2=ON \ - -DBUILD_ICAL=ON \ - -DBUILD_IRC=ON \ - -DBUILD_HTTP=ON \ - -DBUILD_ICONV=ON \ - -DBUILD_PULSEAUDIO=ON \ - -DBUILD_JOURNAL=ON \ - -DBUILD_RSS=ON \ + -DBUILD_X11=OFF \ + -DBUILD_MYSQL=ON \ + -DBUILD_LUA_CAIRO=ON \ + -DBUILD_LUA_IMLIB2=ON \ + -DBUILD_LUA_RSVG=ON \ + -DBUILD_AUDACIOUS=ON \ + -DBUILD_XMMS2=ON \ + -DBUILD_ICAL=ON \ + -DBUILD_IRC=ON \ + -DBUILD_HTTP=ON \ + -DBUILD_ICONV=ON \ + -DBUILD_PULSEAUDIO=ON \ + -DBUILD_JOURNAL=ON \ + -DBUILD_RSS=ON \ .. cd .. elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir build && cd build - cmake \ + cmake \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DBUILD_LUA_RSVG=ON \ + -DBUILD_LUA_IMLIB2=ON \ .. cd .. mkdir build-no-x11 cd build-no-x11 - cmake \ - -DBUILD_X11=OFF \ + cmake \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DBUILD_X11=OFF \ + -DBUILD_LUA_RSVG=ON \ + -DBUILD_LUA_IMLIB2=ON \ .. cd .. fi diff --git a/3rdparty/toluapp/CMakeLists.txt b/3rdparty/toluapp/CMakeLists.txt index 27c972cac1..dd7e57731d 100644 --- a/3rdparty/toluapp/CMakeLists.txt +++ b/3rdparty/toluapp/CMakeLists.txt @@ -6,11 +6,11 @@ project ( toluapp C ) cmake_minimum_required ( VERSION 3.4 ) -include ( cmake/dist.cmake ) +# include ( cmake/dist.cmake ) include(FindPkgConfig) -pkg_search_module(LUA REQUIRED lua>=5.3 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua>=5.1 luajit) +pkg_search_module(LUA REQUIRED lua>=5.3 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua>=5.1 luajit) include_directories ( include src/lib ${LUA_INCLUDE_DIRS} ) # Build lib @@ -19,21 +19,21 @@ if ( MSVC ) set ( DEF_FILE libtoluapp.def ) endif ( ) -add_library ( toluapp_lib SHARED ${SRC_LIBTOLUAPP} ${DEF_FILE} ) +# add_library ( toluapp_lib SHARED ${SRC_LIBTOLUAPP} ${DEF_FILE} ) add_library ( toluapp_lib_static STATIC ${SRC_LIBTOLUAPP} ${DEF_FILE} ) -target_link_libraries ( toluapp_lib ${LUA_LIBRARIES} ) -set_target_properties ( toluapp_lib PROPERTIES OUTPUT_NAME toluapp CLEAN_DIRECT_OUTPUT +target_link_libraries ( toluapp_lib_static ${LUA_LIBRARIES} ) +set_target_properties ( toluapp_lib_static PROPERTIES OUTPUT_NAME toluapp CLEAN_DIRECT_OUTPUT 1 ) # Build app include_directories ( src/bin ) set ( SRC_TOLUA src/bin/tolua.c src/bin/toluabind.c ) add_executable ( toluapp ${SRC_TOLUA} ) -target_link_libraries ( toluapp toluapp_lib ${LUA_LIBRARIES} ) +target_link_libraries ( toluapp toluapp_lib_static ${LUA_LIBRARIES} ) # Install -install_library ( toluapp_lib ) -install_executable ( toluapp ) -install_header ( include/ ) -install_data ( README INSTALL ) -install_doc ( doc/ ) +#install_library ( toluapp_lib ) +#install_executable ( toluapp ) +#install_header ( include/ ) +#install_data ( README INSTALL ) +#install_doc ( doc/ ) diff --git a/3rdparty/toluapp/src/bin/tolua.c b/3rdparty/toluapp/src/bin/tolua.c index d47c448dbf..5aa26e5ff0 100644 --- a/3rdparty/toluapp/src/bin/tolua.c +++ b/3rdparty/toluapp/src/bin/tolua.c @@ -116,7 +116,7 @@ int main (int argc, char* argv[]) lua_pushvalue(L,-1); lua_setglobal(L,"flags"); t = lua_gettop(L); - for (i=1; i=5.3 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua>=5.1 luajit) -endif(WANT_TOLUA) +# Otherwise, use the most recent Lua version +pkg_search_module(LUA REQUIRED lua>=5.3 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua>=5.1 luajit) set(conky_libs ${conky_libs} ${LUA_LIBRARIES}) set(conky_includes ${conky_includes} ${LUA_INCLUDE_DIRS}) link_directories(${LUA_LIBRARY_DIRS}) +include_directories(3rdparty/toluapp/include) # Check for libraries used by Lua bindings if(BUILD_LUA_CAIRO) @@ -352,8 +339,8 @@ if(BUILD_LUA_CAIRO) endif(BUILD_LUA_CAIRO) if(BUILD_LUA_IMLIB2) pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2) - set(luaimlib2_libs ${IMLIB2_LIB} ${LUA_LIBRARIES}) - set(luaimlib2_includes ${IMLIB2_INCLUDE_PATH} ${LUA_INCLUDE_DIRS}) + set(luaimlib2_libs ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS} ${LUA_LIBRARIES}) + set(luaimlib2_includes ${IMLIB2_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS} ${X11_INCLUDE_DIR}) endif(BUILD_LUA_IMLIB2) if(BUILD_LUA_RSVG) pkg_check_modules(RSVG REQUIRED librsvg-2.0) @@ -419,14 +406,14 @@ endif(BUILD_NVIDIA) if(BUILD_IMLIB2) pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2) - set(conky_libs ${conky_libs} ${IMLIB2_LIB} ${IMLIB2_LDFLAGS}) - set(conky_includes ${conky_includes} ${IMLIB2_INCLUDE_PATH}) + set(conky_libs ${conky_libs} ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS}) + set(conky_includes ${conky_includes} ${IMLIB2_INCLUDE_DIRS}) endif(BUILD_IMLIB2) if(BUILD_JOURNAL) pkg_search_module(SYSTEMD REQUIRED libsystemd libsystemd-journal) set(conky_libs ${conky_libs} ${SYSTEMD_LIB} ${SYSTEMD_LDFLAGS}) - set(conky_includes ${conky_includes} ${SYSTEMD_INCLUDE_PATH}) + set(conky_includes ${conky_includes} ${SYSTEMD_INCLUDE_DIRS}) endif(BUILD_JOURNAL) if(BUILD_PULSEAUDIO) @@ -457,24 +444,6 @@ if(WANT_LIBXML2) set(conky_includes ${conky_includes} ${LIBXML2_INCLUDE_DIR}) endif(WANT_LIBXML2) -if(WANT_TOLUA) - find_program(APP_TOLUA NAMES toluapp tolua++ tolua++5.1 tolua++-5.1) - if(NOT APP_TOLUA) - message(FATAL_ERROR "Unable to find program 'tolua++'") - endif(NOT APP_TOLUA) - find_library(TOLUA_LIBS NAMES toluapp tolua++ tolua++5.1 tolua++-5.1) - find_path(TOLUA_INCLUDE_PATH tolua++.h ${INCLUDE_SEARCH_PATH}) - if(TOLUA_INCLUDE_PATH AND TOLUA_LIBS) - set(TOLUA_FOUND true) - else(TOLUA_INCLUDE_PATH AND TOLUA_LIBS) - message(FATAL_ERROR "Unable to find tolua++ library") - endif(TOLUA_INCLUDE_PATH AND TOLUA_LIBS) - mark_as_advanced(APP_TOLUA TOLUA_INCLUDE_PATH TOLUA_LIBS) - set(conky_includes ${conky_includes} ${TOLUA_INCLUDE_PATH}) - set(conky_libs ${conky_libs} ${TOLUA_LIBS}) - set(LUA_EXTRAS true) -endif(WANT_TOLUA) - # Look for doc generation programs if(MAINTAINER_MODE) # Used for doc generation diff --git a/cmake/ToLua.cmake b/cmake/ToLua.cmake index 00de3f199a..7ed063affa 100644 --- a/cmake/ToLua.cmake +++ b/cmake/ToLua.cmake @@ -40,9 +40,11 @@ else() SET(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c) endif(DEFINED ARGV2) -ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND ${APP_TOLUA} -n - ${FIL_WE} -o ${TOLUA_OUT} ${ABS_FIL} DEPENDS - ${ABS_FIL} COMMENT "Running tolua++ on ${FIL}" +ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND + toluapp -n + ${FIL_WE} -o ${TOLUA_OUT} ${ABS_FIL} + ${CMAKE_SOURCE_DIR}/3rdparty/toluapp/src/bin/lua/ + DEPENDS ${ABS_FIL} COMMENT "Running tolua++ on ${FIL}" VERBATIM ) SET_SOURCE_FILES_PROPERTIES(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE) diff --git a/cmake/config.h.in b/cmake/config.h.in index af7734dc03..fcba38ce51 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -121,10 +121,6 @@ #cmakedefine BUILD_LUA_RSVG 1 -#if defined(BUILD_LUA_CAIRO) || defined(BUILD_LUA_IMLIB2) || defined(BUILD_LUA_RSVG) -#define BUILD_LUA_EXTRAS -#endif - #cmakedefine BUILD_IBM 1 #cmakedefine BUILD_RSS 1 diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt index 947c18ec85..5f42e2e33c 100644 --- a/lua/CMakeLists.txt +++ b/lua/CMakeLists.txt @@ -36,7 +36,7 @@ if(BUILD_LUA_CAIRO) add_library(conky-cairo SHARED ${luacairo_src}) set_target_properties(conky-cairo PROPERTIES OUTPUT_NAME "cairo") - target_link_libraries(conky-cairo ${luacairo_libs} ${TOLUA_LIBS}) + target_link_libraries(conky-cairo ${luacairo_libs} toluapp_lib_static) set(lua_libs ${lua_libs} conky-cairo) endif(BUILD_LUA_CAIRO) @@ -47,7 +47,7 @@ if(BUILD_LUA_IMLIB2) add_library(conky-imlib2 SHARED ${luaimlib2_src}) set_target_properties(conky-imlib2 PROPERTIES OUTPUT_NAME "imlib2") - target_link_libraries(conky-imlib2 ${luaimlib2_libs} ${TOLUA_LIBS}) + target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static) set(lua_libs ${lua_libs} conky-imlib2) endif(BUILD_LUA_IMLIB2) @@ -58,7 +58,7 @@ if(BUILD_LUA_RSVG) add_library(conky-rsvg SHARED ${luarsvg_src}) set_target_properties(conky-rsvg PROPERTIES OUTPUT_NAME "rsvg") - target_link_libraries(conky-rsvg ${luarsvg_libs} ${TOLUA_LIBS}) + target_link_libraries(conky-rsvg ${luarsvg_libs} toluapp_lib_static) set(lua_libs ${lua_libs} conky-rsvg) endif(BUILD_LUA_RSVG) @@ -69,7 +69,7 @@ if(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2) add_library(conky-cairo_imlib2_helper SHARED ${luacairo_imlib2_helper_src}) set_target_properties(conky-cairo_imlib2_helper PROPERTIES OUTPUT_NAME "cairo_imlib2_helper") - target_link_libraries(conky-cairo_imlib2_helper ${luacairo_libs} ${luaimlib2_libs} ${TOLUA_LIBS}) + target_link_libraries(conky-cairo_imlib2_helper ${luacairo_libs} ${luaimlib2_libs} toluapp_lib_static) set(lua_libs ${lua_libs} conky-cairo_imlib2_helper) endif(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2) diff --git a/src/llua.cc b/src/llua.cc index 5cda882811..04a6fbce1a 100644 --- a/src/llua.cc +++ b/src/llua.cc @@ -27,11 +27,9 @@ #include "llua.h" #include "logging.h" -#ifdef BUILD_LUA_EXTRAS extern "C" { #include } -#endif /* BUILD_LUA_EXTRAS */ #ifdef HAVE_SYS_INOTIFY_H #include @@ -178,7 +176,7 @@ void llua_init() { lua_pushcfunction(lua_L, &llua_conky_set_update_interval); lua_setglobal(lua_L, "conky_set_update_interval"); -#if defined(BUILD_X11) && defined(BUILD_LUA_EXTRAS) +#if defined(BUILD_X11) /* register tolua++ user types */ tolua_open(lua_L); tolua_usertype(lua_L, "Drawable"); @@ -472,12 +470,10 @@ void llua_draw_post_hook() { llua_do_call(lua_draw_hook_post.get(*state).c_str(), 0); } -#ifdef BUILD_LUA_EXTRAS void llua_set_userdata(const char *key, const char *type, void *value) { tolua_pushusertype(lua_L, value, type); lua_setfield(lua_L, -2, key); } -#endif /* BUILD_LUA_EXTRAS */ void llua_setup_window_table(int text_start_x, int text_start_y, int text_width, int text_height) { @@ -485,11 +481,9 @@ void llua_setup_window_table(int text_start_x, int text_start_y, int text_width, lua_newtable(lua_L); if (out_to_x.get(*state)) { -#ifdef BUILD_LUA_EXTRAS llua_set_userdata("drawable", "Drawable", (void *)&window.drawable); llua_set_userdata("visual", "Visual", window.visual); llua_set_userdata("display", "Display", display); -#endif /* BUILD_LUA_EXTRAS */ llua_set_number("width", window.width); llua_set_number("height", window.height);