Skip to content

Commit

Permalink
deduplicate source in lib and exe (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Dec 5, 2024
1 parent e762674 commit 0dd9910
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions macosnotifications/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_library(SwiftNotify STATIC notify.swift)
set_target_properties(SwiftNotify PROPERTIES Swift_MODULE_NAME SwiftNotify)
target_compile_options(SwiftNotify PUBLIC "$<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>")
target_include_directories(SwiftNotify PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(SwiftNotify Logging)
target_include_directories(SwiftNotify PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}/logging")
add_dependencies(SwiftNotify Logging)

_swift_generate_cxx_header(
SwiftNotify
Expand Down
16 changes: 7 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ add_library(Fcitx5Objs STATIC
fcitx.cpp
tunnel.cpp
config/config.cpp
controller.swift
${CONFIG_UI_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/config/meta.swift
)

target_include_directories(Fcitx5Objs PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}/include"
"${PROJECT_BINARY_DIR}/fcitx5"
)
target_link_libraries(Fcitx5Objs
"-Xlinker -rpath -Xlinker '${CMAKE_INSTALL_PREFIX}/lib'"
AlertToast
SwiftyJSON
SwiftFrontend
SwiftNotify
Expand All @@ -47,7 +39,13 @@ add_executable(Fcitx5
${CONFIG_UI_FILES}
)

target_link_libraries(Fcitx5 Fcitx5Objs)
target_link_libraries(Fcitx5
Fcitx5Objs
AlertToast
SwiftyJSON
SwiftFrontend
SwiftNotify
)

set(APP_PATH "${CMAKE_CURRENT_BINARY_DIR}/Fcitx5.app/Contents")

Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_executable(config-swift testconfig.swift
${PROJECT_SOURCE_DIR}/src/config/optionmodels.swift
${PROJECT_SOURCE_DIR}/src/config/config.swift
)
target_link_libraries(config-swift Fcitx5Objs)
target_link_libraries(config-swift Fcitx5Objs Logging SwiftyJSON)
add_test(NAME config-swift COMMAND config-swift)

add_executable(config-cpp testconfig.cpp)
Expand Down

0 comments on commit 0dd9910

Please sign in to comment.