Skip to content

Commit

Permalink
Refactor build scripts
Browse files Browse the repository at this point in the history
- Separate libconky from conky for all builds to allow lua modules to
  access conky internals.
- Remove global variables that carried build sources/libs/dirs/options
  and replace them with targets.
- Use targets for platform testing to ensure consistent results when
  building.
- Replace build options stored in headers with compile definitions
  (stored in a target).
- Remove some old files that weren't being used.

Signed-off-by: Tin ¿vagelj <[email protected]>
  • Loading branch information
Caellian committed Jan 10, 2025
1 parent 7fd5dcb commit 211896e
Show file tree
Hide file tree
Showing 112 changed files with 1,941 additions and 2,179 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ cmake_install.cmake
cmake_uninstall.cmake
CPackConfig.cmake
CPackSourceConfig.cmake
CMakeUserPresets.json

# Generated files
data/convertconf.h
data/defconfig.h
*.so
*.a
/config.h
/build.h
src/colour-names.hh

# Compiler cache
Expand Down
66 changes: 32 additions & 34 deletions 3rdparty/toluapp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
# Copyright (C) 2007-2012 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.
# Created under MIT License 2007-2012 for LuaDist by Peter Kapec
# Copy of the license is available in the COPYRIGHT file.
# Vendored and maintained for conky build process.

project ( toluapp C )
cmake_minimum_required ( VERSION 3.15 )
# Disable dist stuff, we're not installing this as a lib
# include ( cmake/dist.cmake )
project(toluapp C)
cmake_minimum_required(VERSION 3.15)

include(FindPkgConfig)
include(FindLua)
include_directories ( include src/lib ${LUA_INCLUDE_DIR} )
if(NOT DEFINED LUA_VERSION)
set(LUA_VERSION "5.3")
endif()

include(FindLua ${LUA_VERSION})
find_package(Lua ${LUA_VERSION} REQUIRED)

# Build lib
file ( GLOB SRC_LIBTOLUAPP src/lib/*.c )
if ( MSVC )
set ( DEF_FILE libtoluapp.def )
endif ( )
file(GLOB SRC_LIBTOLUAPP "${CMAKE_CURRENT_SOURCE_DIR}/src/lib/*.c")
if(MSVC)
list(APPEND SRC_LIBTOLUAPP libtoluapp.def)
endif()

# add_library ( toluapp_lib SHARED ${SRC_LIBTOLUAPP} ${DEF_FILE} )
add_library ( toluapp_lib_static STATIC ${SRC_LIBTOLUAPP} ${DEF_FILE} )
target_link_libraries ( toluapp_lib_static ${LUA_LIBRARIES} )
set_target_properties ( toluapp_lib_static PROPERTIES COMPILE_FLAGS -fPIC) # -fPIC required for static linking
set_target_properties ( toluapp_lib_static PROPERTIES OUTPUT_NAME toluapp CLEAN_DIRECT_OUTPUT
1 )
add_library(toluapp_lib_static STATIC ${SRC_LIBTOLUAPP})
target_include_directories(toluapp_lib_static
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
PRIVATE ${LUA_INCLUDE_DIR}
)
target_link_libraries(toluapp_lib_static PUBLIC ${LUA_LIBRARIES})
set_target_properties(toluapp_lib_static PROPERTIES
COMPILE_FLAGS -fPIC # required for static linking
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_static ${LUA_LIBRARIES} )

# Disable installation, we don't need these at runtime for Conky
# Install
#install_library ( toluapp_lib )
#install_executable ( toluapp )
#install_header ( include/ )
#install_data ( README INSTALL )
#install_doc ( doc/ )
set(SRC_TOLUA
src/bin/tolua.c
src/bin/toluabind.c
)
add_executable(toluapp ${SRC_TOLUA})
target_link_libraries(toluapp toluapp_lib_static)
42 changes: 0 additions & 42 deletions 3rdparty/toluapp/INSTALL

This file was deleted.

5 changes: 0 additions & 5 deletions 3rdparty/toluapp/Makefile

This file was deleted.

182 changes: 0 additions & 182 deletions 3rdparty/toluapp/SConstruct

This file was deleted.

22 changes: 0 additions & 22 deletions 3rdparty/toluapp/config_linux.py

This file was deleted.

28 changes: 0 additions & 28 deletions 3rdparty/toluapp/config_msvc.py

This file was deleted.

23 changes: 0 additions & 23 deletions 3rdparty/toluapp/config_posix.py

This file was deleted.

Loading

0 comments on commit 211896e

Please sign in to comment.