Skip to content

Commit

Permalink
Detach the presenter/view build from the rest of the code
Browse files Browse the repository at this point in the history
The intent is that this become an internal library in future

Rationale: Having better separation of concerns and less coupling
between some complex components (like the UI) from the remaining
of the code. This may make the building faster on average aftewars.
  • Loading branch information
Daniel Hilst committed Feb 11, 2025
1 parent e708693 commit 3a90032
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
# Add all source files except main.cpp
file(GLOB_RECURSE SOURCE_FILES *.cpp)
file(GLOB PRESENTER_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/presenter/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/view/*.cpp)
list(REMOVE_ITEM SOURCE_FILES ${PRESENTER_SOURCE_FILES})
list(REMOVE_ITEM SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)

message(STATUS "Source files found are: ${SOURCE_FILES}")

include(../cmake/CommonLibraries.cmake)

# Build the presenter on its onw object, to be faster
# Not wo
add_library(cloysterhpc_presenter_object OBJECT ${PRESENTER_SOURCE_FILES})
target_include_directories(cloysterhpc_presenter_object PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
target_link_system_libraries(
cloysterhpc_presenter_object
PRIVATE
SimpleIni::SimpleIni
SDBusCpp::sdbus-c++
magic_enum::magic_enum
gsl::gsl-lite
fmt::fmt
spdlog::spdlog
glibmm::glibmm
Boost::headers
${NEWT_LIBRARY}
)

# Build a library and a ${cloysterhpc_BINARY_NAME} binary that links to the library
add_library(cloysterhpc_object OBJECT ${SOURCE_FILES})
add_library(cloysterhpc_static STATIC $<TARGET_OBJECTS:cloysterhpc_object>)
add_executable(${cloysterhpc_BINARY_NAME} main.cpp
../include/cloysterhpc/models/elclonerepo.h)

include(../cmake/CommonLibraries.cmake)
# add_library(cloysterhpc_static STATIC $<TARGET_OBJECTS:cloysterhpc_object>)
add_library(cloysterhpc_static STATIC $<TARGET_OBJECTS:cloysterhpc_object> $<TARGET_OBJECTS:cloysterhpc_presenter_object>)
add_executable(${cloysterhpc_BINARY_NAME} main.cpp)

target_link_libraries(
${cloysterhpc_BINARY_NAME}
Expand Down

0 comments on commit 3a90032

Please sign in to comment.