Skip to content

Commit

Permalink
Cleanup plClient CMake project a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue committed Nov 13, 2023
1 parent ab94eb9 commit d65b8e7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 36 deletions.
53 changes: 21 additions & 32 deletions Sources/Plasma/Apps/plClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ if(WIN32)
win32/res/headspin.ico
)
elseif(APPLE)
set(plClient_SOURCES ${plClient_SOURCES}
list(APPEND plClient_SOURCES
Mac-Cocoa/main.mm
Mac-Cocoa/NSString+StringTheory.mm
Mac-Cocoa/PLSKeyboardEventMonitor.mm
Expand All @@ -100,7 +100,7 @@ elseif(APPLE)
Mac-Cocoa/PLSPatcher.mm
Mac-Cocoa/PLSServerStatus.mm
)
set(plClient_HEADERS ${plClient_HEADERS}
list(APPEND plClient_HEADERS
Mac-Cocoa/NSString+StringTheory.h
Mac-Cocoa/PLSKeyboardEventMonitor.h
Mac-Cocoa/PLSView.h
Expand All @@ -109,28 +109,29 @@ elseif(APPLE)
Mac-Cocoa/PLSPatcher.h
Mac-Cocoa/PLSServerStatus.h
)
set(RESOURCES
list(APPEND plClient_RESOURCES
Mac-Cocoa/Assets.xcassets
Mac-Cocoa/banner.png
Mac-Cocoa/[email protected]
Mac-Cocoa/MainMenu.xib
Mac-Cocoa/PLSLoginWindowController.xib
Mac-Cocoa/PLSPatcherWindowController.xib
Mac-Cocoa/banner.png
Mac-Cocoa/[email protected]
win32/res/Dirt.ICO
)

list(APPEND plClient_RESOURCES
win32/res/Dirt.ICO
)
else()
list(APPEND plClient_SOURCES
main.cpp
)
endif()

plasma_executable(plClient CLIENT INSTALL_PDB
SOURCES
${plClient_SOURCES} ${plClient_HEADERS}
${plClient_TEXT} ${plClient_RESOURCES}
)

if(APPLE)
plasma_executable(plClient CLIENT INSTALL_PDB SOURCES ${plClient_SOURCES} ${plClient_HEADERS} ${RESOURCES})
target_sources(plClient PRIVATE ${plClient_IBSOURCES})
set_target_properties(plClient PROPERTIES
BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Mac-Cocoa/Info.plist.in"
# Hard coding the app name here intentionally.
# Should prevent macOS from tripping over secured resources being
Expand All @@ -141,42 +142,28 @@ if(APPLE)
MACOSX_BUNDLE_GUI_IDENTIFIER org.Huru.UruExplorer
MACOSX_BUNDLE_BUNDLE_VERSION "0.1"
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
RESOURCE "${plClient_RESOURCES} ${plClient_IBSOURCES}"
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon
XCODE_ATTRIBUTE_MTL_FAST_MATH "YES"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=Debug] "INCLUDE_SOURCE"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=RelWithDebInfo] "INCLUDE_SOURCE"
XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES"
XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=RelWithDebInfo] "YES"
XCODE_ATTRIBUTE_MTL_HEADER_SEARCH_PATHS ${Plasma_SOURCE_DIR}/Sources/Plasma/NucleusLib/inc/
XCODE_ATTRIBUTE_MTL_HEADER_SEARCH_PATHS "${Plasma_SOURCE_DIR}/Sources/Plasma/NucleusLib/inc/"
XCODE_ATTRIBUTE_INSTALL_PATH "/Applications"
XCODE_ATTRIBUTE_SKIP_INSTALL "NO"
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_SOURCE_DIR}/Mac-Cocoa/plClient.entitlements
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/Mac-Cocoa/plClient.entitlements"
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES"
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "YES"
)
target_compile_options(plClient PRIVATE -fobjc-arc)
target_sources(plClient PRIVATE Mac-Cocoa/Assets.xcassets)
set_source_files_properties(Mac-Cocoa/Assets.xcassets ${RESOURCES} PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
target_link_libraries(plClient PRIVATE "-framework Cocoa")
target_link_libraries(plClient PRIVATE "-framework QuartzCore")
install(
TARGETS plClient
DESTINATION client
)


if(PLASMA_APPLE_DEVELOPMENT_TEAM_ID)
set_target_properties(plClient PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development"
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ${PLASMA_APPLE_DEVELOPMENT_TEAM_ID}
)
endif()
else()
plasma_executable(plClient WIN32 CLIENT INSTALL_PDB
SOURCES
${plClient_SOURCES} ${plClient_HEADERS}
${plClient_TEXT} ${plClient_RESOURCES}
)
endif()

if(PLASMA_BUILD_RESOURCE_DAT)
Expand Down Expand Up @@ -240,6 +227,8 @@ target_link_libraries(
$<$<BOOL:${PLASMA_PIPELINE_DX}>:pfDXPipeline>
$<$<BOOL:${PLASMA_PIPELINE_GL}>:pfGLPipeline>
CURL::libcurl
"$<$<PLATFORM_ID:Darwin>:-framework Cocoa>"
"$<$<PLATFORM_ID:Darwin>:-framework QuartzCore>"
)
target_include_directories(plClient PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")

Expand Down Expand Up @@ -269,4 +258,4 @@ endif()
source_group("Source Files" FILES ${plClient_SOURCES})
source_group("Header Files" FILES ${plClient_HEADERS})
source_group("Text" FILES ${plClient_TEXT})
source_group("Windows Resource Files" FILES ${plClient_RESOURCES})
source_group("Resources" FILES ${plClient_RESOURCES})
5 changes: 1 addition & 4 deletions cmake/PlasmaTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ function(plasma_executable TARGET)
if(_pex_WIN32)
list(APPEND addexe_args WIN32)
endif()
if(_pex_QT_GUI)
if(_pex_QT_GUI OR _pex_CLIENT)
list(APPEND addexe_args WIN32 MACOSX_BUNDLE)
endif()
if(_pex_CLIENT)
list(APPEND addexe_args MACOSX_BUNDLE)
endif()
if(_pex_EXCLUDE_FROM_ALL)
list(APPEND addexe_args EXCLUDE_FROM_ALL)
endif()
Expand Down

0 comments on commit d65b8e7

Please sign in to comment.