cmake_minimum_required (VERSION 3.8) include("cmake/create_resources.cmake") file(GLOB_RECURSE SOURCES "src/*.cpp") #enable objective c support on mac os, needed for wxwidgets and compile for both intel macs and apple sillicon macs if(APPLE) list(APPEND SOURCES "src/backends/darwin.mm" ${CMAKE_SOURCE_DIR}/osx/icon.icns) set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15") project ("PlayerLink" LANGUAGES C CXX OBJCXX) else() project ("PlayerLink" LANGUAGES C CXX) endif() if(WIN32) list(APPEND SOURCES ${CMAKE_SOURCE_DIR}/win/app_icon.rc) endif() create_resources("rsrc" "src/rsrc.hpp") add_executable (PlayerLink ${SOURCES}) set_property(TARGET PlayerLink PROPERTY CXX_STANDARD 17) add_subdirectory("vendor") set(LIBRARIES discord-rpc libcurl_static mbedcrypto mbedx509 mbedtls wxmono) set(INCLUDES vendor vendor/wxWidgets/include) #use windows subsystem to disable console window and link winrt if(WIN32) list(APPEND LIBRARIES WindowsApp) target_link_options(PlayerLink PRIVATE "/SUBSYSTEM:WINDOWS" "/ENTRY:mainCRTStartup") 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() set_target_properties(PlayerLink PROPERTIES MACOSX_BUNDLE TRUE) set_source_files_properties(${CMAKE_SOURCE_DIR}/osx/icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set_target_properties(PlayerLink PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/osx/Info.plist) elseif(UNIX AND NOT APPLE) list(APPEND LIBRARIES dbus) list(APPEND INCLUDES "${CMAKE_BINARY_DIR}/vendor/dbus" vendor/libdbus) endif() #search directories for the autogenerated wxwidgets setup.h file for all plattforms file(GLOB wx_setup_dir "${CMAKE_BINARY_DIR}/vendor/wxWidgets/lib/*/mswu" "${CMAKE_BINARY_DIR}/vendor/wxWidgets/lib/*/gtk3u" "${CMAKE_BINARY_DIR}/vendor/wxWidgets/lib/wx/include/*" ) if(wx_setup_dir) message(STATUS "wxWidgets setup.h directory found: ${wx_setup_dir}") target_include_directories(PlayerLink PRIVATE ${INCLUDES} ${wx_setup_dir}) else() message(FATAL_ERROR "wx/setup.h not found. Please check your wxWidgets build configuration.") endif() target_link_libraries(PlayerLink PUBLIC ${LIBRARIES})