Moving from Xcode to Cmake, Photoshop SDK, linking error.
Hey
So, my Xcode project exploded, and no longer want to compile. I've spent 2 weeks trying to fix it, I gave up. So the time has come to move to Cmake! I managed to do the port on windows <YAYYY> but I'm struggling on mac...
I'm stuck on the last part (I think) linking!
I'm using Getter example project as my starter...
Here are my errors :
ld: warning: ignoring file ../libOutput/resourceBuild/Debug/pluginConfig_PIPL.rcrs, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x00 0x00 0x01 0x00 0x00 0x00 0x04 0x49 0x00 0x00 0x03 0x49 0x00 0x00 0x00 0xEC )
Undefined symbols for architecture x86_64:
“_PIstrlcat”, referenced from:
DoIt(PSActionsPlugInMessage*) in Getter.cpp.o
“PIUGetInfo(unsigned int, unsigned int, void*, void*)“, referenced from:
DoIt(PSActionsPlugInMessage*) in Getter.cpp.o
GetApplicationInfo(char*) in GetInfoFromPhotoshop.cpp.o
GetHistoryInfo(char*) in GetInfoFromPhotoshop.cpp.o
GetLayerInfo(char*) in GetInfoFromPhotoshop.cpp.o
GetPathInfo(char*) in GetInfoFromPhotoshop.cpp.o
GetActionInfo(char*) in GetInfoFromPhotoshop.cpp.o
GetDocumentInfo(char*) in GetInfoFromPhotoshop.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
As far as I can tell there 2 errors here.
1. Linking error - undefined symbols
2. rcrs error which I think is there because the app did not link properly in 1st place... so maybe we can ignore this part now...
Now given the fact that SDK does NOT actually have any lib/sa/a/dylib/dll/etc in itself... I have NO IDEA how on earth this thing even works on windows. All I know is that the same Cmake does not work on mac.
So skipping the REZ generation for now... my cmake mostly is made out of :
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE INTERNAL "" FORCE)
include_directories(${PS_SDK_ROOT}/samplecode/common/includes)
include_directories(${PS_SDK_ROOT}/samplecode/common/sources)
include_directories(${PS_SDK_ROOT}/samplecode/common/resources)
#include_directories(${PS_SDK_ROOT}/samplecode/common)
include_directories(${PS_SDK_ROOT}/photoshopapi/photoshop)
include_directories(${PS_SDK_ROOT}/photoshopapi/PICA_SP)
include_directories(${PS_SDK_ROOT}/photoshopapi/resources)
#include_directories(${PS_SDK_ROOT}/photoshopapi)
set(ALL_FILES
mainPlugin.cpp # this is getter example project
${SRC_LOCAL} # this is getter.cpp etc
${PS_SRC_EXTRA} # ignore.
)
add_library(${PROJECT_NAME} SHARED ${ALL_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${ROOT_LIB_OUTPUT}/")
set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_PDB_OUTPUT_DIRECTORY "${ROOT_LIB_OUTPUT}/")
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX .plugin)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}${GLOBAL_OUTPUT_SUFFIX_TYPE})
set_target_properties(${PROJECT_NAME} PROPERTIES
BUNDLE 1
BUNDLE_EXTENSION plugin
XCODE_ATTRIBUTE_WRAPPER_EXTENSION plugin #sets the extension to .plugin
XCODE_ATTRIBUTE_MACH_O_TYPE mh_bundle
XCODE_ATTRIBUTE_INFOPLIST_FILE ${ROOT_SRC}/pipl/Info.plist
MACOSX_BUNDLE_INFO_PLIST ${ROOT_SRC}/pipl/Info.plist
)
set_source_files_properties(
${PIPL_OUTPUT}
)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
#"-framework Carbon"
#"-framework CoreServices"
stdc++
${PIPL_OUTPUT}
)
target_link_libraries(${PROJECT_NAME} "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
Now here is where I hit a wall... I've no idea how to fix that linking error 😄
I've gone over xcode project TOP-TO-BOTTOM 50x. I even read the xcode project as text file and went over each entry.
I disabled all flags in xcode project, it builds and links. So I don't really need any custom flags in cmake - not like in windows (oh god so many flags there!). So As far as I can tell, I have the same stuff set/configured in cmake. But still errors...sigh.
In any case, I'm stuck. Can any1 help out?
Regards
Dariusz
