mirror of
https://github.com/polybar/polybar.git
synced 2025-04-14 17:33:17 -04:00
refactor(cmake): Use a source list instead of static libs
This commit is contained in:
parent
95588a2c21
commit
ce6ac7869e
10 changed files with 46 additions and 84 deletions
|
@ -191,6 +191,16 @@ endfunction()
|
|||
|
||||
# }}}
|
||||
|
||||
# add_sources {{{
|
||||
macro(add_sources varname)
|
||||
foreach(SRC ${ARGN})
|
||||
list(APPEND ${varname} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC})
|
||||
endforeach()
|
||||
set(${varname} ${${varname}} PARENT_SCOPE)
|
||||
endmacro()
|
||||
|
||||
# }}}
|
||||
|
||||
# queryfont {{{
|
||||
|
||||
function(queryfont output_variable fontname)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# Source tree {{{
|
||||
|
||||
add_subdirectory(cairo)
|
||||
add_subdirectory(components)
|
||||
add_subdirectory(drawtypes)
|
||||
add_subdirectory(events)
|
||||
add_subdirectory(modules)
|
||||
|
@ -19,28 +20,14 @@ add_subdirectory(x11)
|
|||
make_executable(polybar
|
||||
SOURCES
|
||||
main.cpp
|
||||
components/bar.cpp
|
||||
components/builder.cpp
|
||||
components/command_line.cpp
|
||||
components/config.cpp
|
||||
components/controller.cpp
|
||||
components/ipc.cpp
|
||||
components/logger.cpp
|
||||
components/parser.cpp
|
||||
components/renderer.cpp
|
||||
components/screen.cpp
|
||||
components/taskqueue.cpp
|
||||
${files}
|
||||
INCLUDE_DIRS
|
||||
${dirs}
|
||||
TARGET_DEPENDS
|
||||
polybar-modules-internal_shared
|
||||
polybar-cairo_static
|
||||
polybar-drawtypes_static
|
||||
polybar-events_static
|
||||
polybar-utils_static
|
||||
polybar-x11_static
|
||||
RAW_DEPENDS
|
||||
${libs}
|
||||
${CMAKE_DL_LIBS}
|
||||
Threads::Threads)
|
||||
|
||||
target_compile_options(polybar PUBLIC $<$<CXX_COMPILER_ID:GNU>:$<$<CONFIG:MinSizeRel>:-flto>>)
|
||||
|
|
|
@ -1,10 +1 @@
|
|||
make_library(polybar-cairo
|
||||
STATIC
|
||||
INTERNAL
|
||||
SOURCES
|
||||
utils.cpp
|
||||
INCLUDE_DIRS
|
||||
${dirs}
|
||||
${cairo-dirs}
|
||||
RAW_DEPENDS
|
||||
${cairo-libs})
|
||||
add_sources(files utils.cpp)
|
||||
|
|
12
src/components/CMakeLists.txt
Normal file
12
src/components/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
add_sources(files
|
||||
bar.cpp
|
||||
builder.cpp
|
||||
command_line.cpp
|
||||
config.cpp
|
||||
controller.cpp
|
||||
ipc.cpp
|
||||
logger.cpp
|
||||
parser.cpp
|
||||
renderer.cpp
|
||||
screen.cpp
|
||||
taskqueue.cpp)
|
|
@ -1,13 +1,6 @@
|
|||
make_library(polybar-drawtypes
|
||||
STATIC
|
||||
INTERNAL
|
||||
SOURCES
|
||||
add_sources(files
|
||||
animation.cpp
|
||||
iconset.cpp
|
||||
label.cpp
|
||||
progressbar.cpp
|
||||
ramp.cpp
|
||||
INCLUDE_DIRS
|
||||
${dirs}
|
||||
RAW_DEPENDS
|
||||
${libs})
|
||||
ramp.cpp)
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
make_library(polybar-events
|
||||
STATIC
|
||||
INTERNAL
|
||||
SOURCES
|
||||
add_sources(files
|
||||
signal_emitter.cpp
|
||||
signal_receiver.cpp
|
||||
INCLUDE_DIRS
|
||||
${dirs})
|
||||
signal_receiver.cpp)
|
||||
|
|
|
@ -120,5 +120,4 @@ make_library(polybar-modules-internal
|
|||
INCLUDE_DIRS
|
||||
${dirs}
|
||||
RAW_DEPENDS
|
||||
${libs}
|
||||
polybar-utils-bspwm_shared)
|
||||
${libs})
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
make_library(polybar-utils
|
||||
STATIC
|
||||
INTERNAL
|
||||
SOURCES
|
||||
add_sources(files
|
||||
bspwm.cpp
|
||||
command.cpp
|
||||
concurrency.cpp
|
||||
env.cpp
|
||||
|
@ -14,21 +12,7 @@ make_library(polybar-utils
|
|||
restack.cpp
|
||||
socket.cpp
|
||||
string.cpp
|
||||
throttle.cpp
|
||||
INCLUDE_DIRS
|
||||
${dirs}
|
||||
RAW_DEPENDS
|
||||
${libs}
|
||||
${CMAKE_DL_LIBS})
|
||||
|
||||
make_library(polybar-utils-bspwm
|
||||
SHARED
|
||||
SOURCES
|
||||
bspwm.cpp
|
||||
INCLUDE_DIRS
|
||||
${dirs}
|
||||
RAW_DEPENDS
|
||||
${libs})
|
||||
throttle.cpp)
|
||||
|
||||
if(ENABLE_I3)
|
||||
make_library(polybar-utils-i3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
list(APPEND x11-sources
|
||||
add_sources(files
|
||||
atoms.cpp
|
||||
connection.cpp
|
||||
ewmh.cpp
|
||||
|
@ -11,36 +11,26 @@ list(APPEND x11-sources
|
|||
xembed.cpp)
|
||||
|
||||
if(WITH_XRANDR)
|
||||
list(APPEND x11-sources extensions/randr.cpp)
|
||||
add_sources(files extensions/randr.cpp)
|
||||
endif()
|
||||
if(WITH_XRENDER)
|
||||
list(APPEND x11-sources extensions/render.cpp)
|
||||
add_sources(files extensions/render.cpp)
|
||||
endif()
|
||||
if(WITH_XDAMAGE)
|
||||
list(APPEND x11-sources extensions/damage.cpp)
|
||||
add_sources(files extensions/damage.cpp)
|
||||
endif()
|
||||
if(WITH_XSYNC)
|
||||
list(APPEND x11-sources extensions/sync.cpp)
|
||||
add_sources(files extensions/sync.cpp)
|
||||
endif()
|
||||
if(WITH_XCOMPOSITE)
|
||||
list(APPEND x11-sources extensions/composite.cpp)
|
||||
add_sources(files extensions/composite.cpp)
|
||||
endif()
|
||||
if(WITH_XKB)
|
||||
list(APPEND x11-sources extensions/xkb.cpp)
|
||||
add_sources(files extensions/xkb.cpp)
|
||||
endif()
|
||||
if(WITH_XRM)
|
||||
list(APPEND x11-sources xresources.cpp)
|
||||
add_sources(files xresources.cpp)
|
||||
endif()
|
||||
if(WITH_XCURSOR)
|
||||
list(APPEND x11-sources cursor.cpp)
|
||||
add_sources(files cursor.cpp)
|
||||
endif()
|
||||
|
||||
make_library(polybar-x11
|
||||
STATIC
|
||||
INTERNAL
|
||||
SOURCES
|
||||
${x11-sources}
|
||||
INCLUDE_DIRS
|
||||
${dirs}
|
||||
RAW_DEPENDS
|
||||
${libs})
|
||||
|
|
|
@ -47,9 +47,10 @@ function(unit_test file tests)
|
|||
# unit_test function become cleaner
|
||||
SET(sources "")
|
||||
FOREACH(f ${BIN_SOURCES})
|
||||
# Do not add main.cpp, because it will override the main function
|
||||
if(NOT "${f}" STREQUAL "main.cpp")
|
||||
if(NOT IS_ABSOLUTE ${f})
|
||||
LIST(APPEND sources "../src/${f}")
|
||||
else()
|
||||
LIST(APPEND sources ${f})
|
||||
endif()
|
||||
ENDFOREACH(f)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue