have CMakeLists.txt install a pkgconfig file (+ other fixes for building with MSYS)
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit

This commit is contained in:
IoI_xD 2026-07-17 07:45:53 +09:00
commit cddfbb8c85
2 changed files with 39 additions and 12 deletions

View file

@ -296,7 +296,8 @@ if(MW_CLASSIC_THEME)
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
message("Building Milsko for ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "MSYS")
target_sources(
Mw
PRIVATE
@ -336,6 +337,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-framework Cocoa
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Retro")
target_sources(
Mw
PRIVATE
@ -354,6 +356,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Retro")
CLASSIC_MAC_OS
)
else()
find_package(PkgConfig)
find_package(X11)
pkg_check_modules(DBUS dbus-1)
@ -386,23 +389,26 @@ else()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND LIBRARIES dl)
endif()
find_package(DBus1)
if(${DBus1_FOUND})
list(APPEND INCLUDE_DIRS ${DBUS_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${DBUS_LIBRARY_DIRS})
target_compile_definitions(
Mw
PRIVATE
USE_DBUS
)
endif()
endif()
find_package(DBus1)
if(${DBus1_FOUND})
list(APPEND INCLUDE_DIRS ${DBUS_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${DBUS_LIBRARY_DIRS})
target_compile_definitions(
Mw
PRIVATE
USE_DBUS
)
if(UNIX)
list(APPEND LIBRARIES m)
endif()
list(APPEND LIBRARIES m)
target_include_directories(
Mw
PRIVATE
@ -457,6 +463,17 @@ install(
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/resource/${PROJECT_NAME}.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
@ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION $ENV{MINGW_PREFIX}/${CMAKE_INSTALL_DATADIR}/pkgconfig
)
if(MW_INSTALL_HEADERS)
install(
DIRECTORY include/

10
resource/milsko.pc.in Normal file
View file

@ -0,0 +1,10 @@
prefix="@CMAKE_INSTALL_PREFIX@"
includedir="@CMAKE_INSTALL_PREFIX@/include"
libdir="@CMAKE_INSTALL_PREFIX@/bin"
Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
URL: @PROJECT_HOMEPAGE_URL@
Version: @PROJECT_VERSION@
Cflags: -I"${includedir}"/
Libs: -L"${libdir}" -lMw