2021-03-19 22:05:00 +00:00
|
|
|
option( KICAD_SHOW_GTK_MESSAGES
|
|
|
|
"Show all the GTK error messages in the terminal"
|
|
|
|
OFF )
|
|
|
|
|
|
|
|
mark_as_advanced( KICAD_SHOW_GTK_MESSAGES )
|
|
|
|
|
|
|
|
set( PLATFORM_COMPILE_DEFS "" )
|
|
|
|
|
2020-06-03 14:58:54 +00:00
|
|
|
# Add the appropriate source files
|
|
|
|
if( APPLE )
|
|
|
|
set( PLATFORM_SRCS
|
2020-07-21 00:33:35 +00:00
|
|
|
osx/app.mm
|
2023-06-13 16:44:22 +00:00
|
|
|
osx/drivers.mm
|
2020-01-30 01:31:45 +00:00
|
|
|
osx/environment.mm
|
2022-08-20 00:01:36 +00:00
|
|
|
osx/io.mm
|
2022-04-09 18:01:07 +00:00
|
|
|
osx/policy.mm
|
2023-09-14 21:39:42 +00:00
|
|
|
osx/secrets.mm
|
2020-06-03 14:58:54 +00:00
|
|
|
osx/ui.mm
|
|
|
|
)
|
|
|
|
|
|
|
|
set( PLATFORM_LIBS
|
|
|
|
"-framework Cocoa"
|
|
|
|
"-framework AppKit"
|
|
|
|
"-framework CoreData"
|
|
|
|
"-framework Foundation"
|
|
|
|
)
|
|
|
|
elseif( WIN32 )
|
|
|
|
set( PLATFORM_SRCS
|
2020-07-21 00:33:35 +00:00
|
|
|
msw/app.cpp
|
2023-06-13 16:44:22 +00:00
|
|
|
msw/drivers.cpp
|
2020-01-30 01:31:45 +00:00
|
|
|
msw/environment.cpp
|
2022-08-20 00:01:36 +00:00
|
|
|
msw/io.cpp
|
2022-04-09 18:01:07 +00:00
|
|
|
msw/policy.cpp
|
2023-09-14 21:39:42 +00:00
|
|
|
msw/secrets.cpp
|
2020-06-03 14:58:54 +00:00
|
|
|
msw/ui.cpp
|
|
|
|
)
|
2020-12-16 00:28:58 +00:00
|
|
|
|
|
|
|
set( PLATFORM_LIBS
|
|
|
|
"Shlwapi"
|
2021-11-11 14:29:25 +00:00
|
|
|
"winhttp"
|
2022-03-13 00:12:34 +00:00
|
|
|
"wintrust"
|
2023-05-10 00:30:15 +00:00
|
|
|
"Imm32"
|
2020-12-16 00:28:58 +00:00
|
|
|
)
|
2020-06-03 14:58:54 +00:00
|
|
|
elseif( UNIX )
|
|
|
|
set( PLATFORM_SRCS
|
2020-07-21 00:33:35 +00:00
|
|
|
gtk/app.cpp
|
2023-06-13 16:44:22 +00:00
|
|
|
gtk/drivers.cpp
|
2020-01-30 01:31:45 +00:00
|
|
|
gtk/environment.cpp
|
2022-08-20 00:01:36 +00:00
|
|
|
gtk/io.cpp
|
2022-04-09 18:01:07 +00:00
|
|
|
gtk/policy.cpp
|
2023-09-14 21:39:42 +00:00
|
|
|
gtk/secrets.cpp
|
2020-06-03 14:58:54 +00:00
|
|
|
gtk/ui.cpp
|
|
|
|
)
|
2020-01-30 01:31:45 +00:00
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
|
|
|
|
|
|
|
# Detect GTK3 and configure it
|
|
|
|
set( PLATFORM_LIBS
|
|
|
|
${GTK3_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
|
|
|
include_directories( SYSTEM ${GTK3_INCLUDE_DIRS} )
|
|
|
|
link_directories( ${GTK3_LIBRARY_DIRS} )
|
|
|
|
add_definitions( ${GTK3_CFLAGS_OTHER} )
|
2021-03-19 22:05:00 +00:00
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
# Detect the secret library and configure it
|
|
|
|
pkg_check_modules(secret REQUIRED libsecret-1)
|
|
|
|
include_directories( SYSTEM ${secret_INCLUDE_DIRS} )
|
|
|
|
list( APPEND PLATFORM_LIBS ${secret_LIBRARIES} )
|
|
|
|
|
2023-09-14 21:04:03 +00:00
|
|
|
if( KICAD_WAYLAND )
|
2024-04-27 13:48:34 +00:00
|
|
|
find_package(Wayland 1.20 COMPONENTS Client REQUIRED)
|
2023-09-14 21:04:03 +00:00
|
|
|
|
|
|
|
list( APPEND PLATFORM_SRCS gtk/wayland-pointer-constraints-unstable-v1.c )
|
|
|
|
list( APPEND PLATFORM_LIBS Wayland::Client )
|
|
|
|
endif()
|
|
|
|
|
2021-03-19 22:05:00 +00:00
|
|
|
# Add the definition to show the GTK error messages if desired (they are hidden
|
|
|
|
# by us by default)
|
|
|
|
if( KICAD_SHOW_GTK_MESSAGES )
|
|
|
|
message( STATUS "Configuring KiCad not to hide any GTK error messages" )
|
|
|
|
string( APPEND PLATFORM_COMPILE_DEFS "-DKICAD_SHOW_GTK_MESSAGES" )
|
|
|
|
endif()
|
2020-06-03 14:58:54 +00:00
|
|
|
endif()
|
|
|
|
|
2021-03-19 22:36:16 +00:00
|
|
|
include_directories(
|
|
|
|
${INC_AFTER}
|
|
|
|
)
|
2020-06-03 14:58:54 +00:00
|
|
|
|
|
|
|
add_library( kiplatform STATIC
|
|
|
|
${PLATFORM_SRCS}
|
|
|
|
)
|
|
|
|
|
2021-03-19 22:05:00 +00:00
|
|
|
target_compile_definitions( kiplatform PRIVATE
|
|
|
|
${PLATFORM_COMPILE_DEFS}
|
|
|
|
)
|
|
|
|
|
2020-06-03 14:58:54 +00:00
|
|
|
target_include_directories( kiplatform PUBLIC
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries( kiplatform
|
2023-07-24 21:40:06 +00:00
|
|
|
core
|
2020-06-03 14:58:54 +00:00
|
|
|
${wxWidgets_LIBRARIES}
|
|
|
|
${PLATFORM_LIBS}
|
|
|
|
)
|
2023-10-20 15:24:11 +00:00
|
|
|
|
|
|
|
if( APPLE )
|
|
|
|
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
|
|
|
|
find_library(SECURITY_LIBRARY Security REQUIRED)
|
|
|
|
|
|
|
|
target_link_libraries( kiplatform
|
|
|
|
${COREFOUNDATION_LIBRARY}
|
|
|
|
${SECURITY_LIBRARY}
|
|
|
|
)
|
|
|
|
endif()
|