2024-11-01 14:10:00 +01:00
|
|
|
cmake_minimum_required (VERSION 3.8)
|
2024-11-02 17:17:12 +01:00
|
|
|
include("cmake/create_resources.cmake")
|
2024-11-04 17:00:29 +01:00
|
|
|
|
2024-11-05 11:23:15 +01:00
|
|
|
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
|
|
|
|
2024-11-04 17:00:29 +01:00
|
|
|
#enable objective c support on mac os, needed for wxwidgets and compile for both intel macs and apple sillicon macs
|
2024-11-02 12:10:42 +01:00
|
|
|
if(APPLE)
|
2024-11-05 11:23:15 +01:00
|
|
|
list(APPEND SOURCES "src/backends/darwin.mm")
|
2024-11-04 17:00:29 +01:00
|
|
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
|
|
|
project ("PlayerLink" LANGUAGES C CXX OBJCXX)
|
2024-11-02 12:10:42 +01:00
|
|
|
else()
|
2024-11-04 17:00:29 +01:00
|
|
|
project ("PlayerLink" LANGUAGES C CXX)
|
2024-11-02 12:10:42 +01:00
|
|
|
endif()
|
2024-11-04 17:00:29 +01:00
|
|
|
|
2024-11-02 17:17:12 +01:00
|
|
|
create_resources("rsrc" "src/rsrc.hpp")
|
2024-11-05 11:23:15 +01:00
|
|
|
|
2024-11-04 17:00:29 +01:00
|
|
|
add_executable (PlayerLink ${SOURCES})
|
|
|
|
set_property(TARGET PlayerLink PROPERTY CXX_STANDARD 20)
|
2024-11-01 14:10:00 +01:00
|
|
|
add_subdirectory("vendor")
|
2024-11-02 11:25:56 +01:00
|
|
|
set(LIBRARIES discord-rpc libcurl_static mbedcrypto mbedx509 mbedtls wxmono)
|
2024-11-05 20:22:11 +01:00
|
|
|
set(INCLUDES vendor vendor/libdbus vendor/wxWidgets/include)
|
2024-11-04 17:00:29 +01:00
|
|
|
|
|
|
|
#use windows subsystem to disable console window and link winrt
|
2024-11-01 16:55:27 +01:00
|
|
|
if(WIN32)
|
|
|
|
list(APPEND LIBRARIES WindowsApp)
|
2024-11-04 17:00:29 +01:00
|
|
|
target_link_options(PlayerLink PRIVATE "/SUBSYSTEM:WINDOWS" "/ENTRY:mainCRTStartup")
|
2024-11-05 11:23:15 +01:00
|
|
|
elseif(APPLE)
|
|
|
|
set(MEDIAREMOTE_FRAMEWORK_PATH "/System/Library/PrivateFrameworks")
|
|
|
|
find_library(MEDIAREMOTE_LIBRARY MediaRemote PATHS ${MEDIAREMOTE_FRAMEWORK_PATH})
|
|
|
|
if (MEDIAREMOTE_LIBRARY)
|
|
|
|
message(STATUS "Found MediaRemote: ${MEDIAREMOTE_LIBRARY}")
|
|
|
|
list(APPEND LIBRARIES ${MEDIAREMOTE_LIBRARY})
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "MediaRemote framework not found.")
|
|
|
|
endif()
|
2024-11-05 20:22:11 +01:00
|
|
|
elseif(UNIX AND NOT APPLE)
|
|
|
|
list(APPEND LIBRARIES dbus)
|
|
|
|
list(APPEND INCLUDES "${CMAKE_BINARY_DIR}/vendor/dbus")
|
2024-11-01 16:55:27 +01:00
|
|
|
endif()
|
2024-11-04 17:00:29 +01:00
|
|
|
|
|
|
|
#search directories for the autogenerated wxwidgets setup.h file for all plattforms
|
2024-11-02 11:25:56 +01:00
|
|
|
file(GLOB wx_setup_dir
|
|
|
|
"${CMAKE_BINARY_DIR}/vendor/wxWidgets/lib/*/mswu"
|
|
|
|
"${CMAKE_BINARY_DIR}/vendor/wxWidgets/lib/*/gtk3u"
|
2024-11-02 12:10:42 +01:00
|
|
|
"${CMAKE_BINARY_DIR}/vendor/wxWidgets/lib/wx/include/*"
|
2024-11-02 11:25:56 +01:00
|
|
|
)
|
|
|
|
if(wx_setup_dir)
|
|
|
|
message(STATUS "wxWidgets setup.h directory found: ${wx_setup_dir}")
|
2024-11-05 20:22:11 +01:00
|
|
|
target_include_directories(PlayerLink PRIVATE ${INCLUDES} ${wx_setup_dir})
|
2024-11-02 11:25:56 +01:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "wx/setup.h not found. Please check your wxWidgets build configuration.")
|
|
|
|
endif()
|
2024-11-04 17:00:29 +01:00
|
|
|
target_link_libraries(PlayerLink PUBLIC ${LIBRARIES})
|