From 263c93d9eb8af0a50e50875dedc80d026be7a912 Mon Sep 17 00:00:00 2001 From: Omni Flux Date: Wed, 23 Aug 2023 23:23:43 -0600 Subject: [PATCH] Improve CMake FindDAZStudioSDK module --- src/CMakeLists.txt | 16 +- src/CMakeUserPresets.json.template | 8 +- src/Reality.def | 5 - src/cmake/Modules/FindDAZStudioSDK.cmake | 409 +++++++++++++++-------- src/exportedPluginSymbols.txt | 2 - 5 files changed, 282 insertions(+), 158 deletions(-) delete mode 100644 src/Reality.def delete mode 100644 src/exportedPluginSymbols.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd4706f..587c905 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,16 +3,13 @@ # Contrary to DAZ SDK Documention it appears linking to libc++ works? -### TODO OS X build bundle and verify rpath/loader_path are correct - - # Configure CMAKE cmake_minimum_required (VERSION 3.25) set (CMAKE_POLICY_DEFAULT_CMP0077 NEW) list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) include (FetchContent) -include(CheckIPOSupported) +include (CheckIPOSupported) # Configure pre-project settings set (CMAKE_CXX_STANDARD 11) @@ -78,7 +75,7 @@ find_package (Boost 1.67.0 REQUIRED COMPONENTS atomic program_options python27) find_package (Qt4 4.8.7 REQUIRED COMPONENTS QtGui QtNetwork QtWebKit) find_package (Python2 2.7.18 REQUIRED COMPONENTS Development.Module) find_package (OpenCL REQUIRED) -find_package (DAZStudioSDK REQUIRED) +find_package (DAZStudioSDK 4.5 REQUIRED COMPONENTS Plugin) if (DAZStudioSDK_TOOLKIT_INCOMPATIBLE) message (SEND_ERROR) @@ -597,9 +594,6 @@ set (SRC_GROUP_DAZ_STUDIO_PLUGIN $<$:Studio/Reality_DS.rc.in> $<$:${PROJECT_BINARY_DIR}/autogen/Reality_DS.rc> - - # The Windows version needs a .def file to export the plugin's entry points - $<$:Reality.def> ) source_group ("DAZ Studio Plugin" FILES ${HEADER_GROUP_DAZ_STUDIO_PLUGIN} ${SRC_GROUP_DAZ_STUDIO_PLUGIN}) @@ -701,13 +695,11 @@ add_library (Reality_DS MODULE) target_compile_definitions (Reality_DS PRIVATE RE_LIB_MAKE_SHARED) target_include_directories (Reality_DS PRIVATE core data) target_link_libraries (Reality_DS PRIVATE Reality_Version) -target_link_libraries (Reality_DS PRIVATE Boost::boost OpenCL::OpenCL DAZStudioSDK::DAZStudioSDK qjson SQLiteCpp cppzmq-static) -set_target_properties (Reality_DS PROPERTIES XCODE_ATTRIBUTE_EXPORTED_SYMBOLS_FILE "${TESTFIXTURES_DIR}/exported-symbols.txt") +target_link_libraries (Reality_DS PRIVATE Boost::boost OpenCL::OpenCL DAZStudioSDK::Plugin qjson SQLiteCpp cppzmq-static) if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set_target_properties (Reality_DS PROPERTIES - CXX_VISIBILITY_PRESET hidden # Necessary with the following? - XCODE_ATTRIBUTE_EXPORTED_SYMBOLS_FILE exportedPluginSymbols.txt + CXX_VISIBILITY_PRESET hidden # Necessary with XCODE_ATTRIBUTE_EXPORTED_SYMBOLS_FILE? XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING YES XCODE_ATTRIBUTE_STRIP_STYLE all ) diff --git a/src/CMakeUserPresets.json.template b/src/CMakeUserPresets.json.template index 74215a1..830df79 100644 --- a/src/CMakeUserPresets.json.template +++ b/src/CMakeUserPresets.json.template @@ -9,8 +9,8 @@ "environment": { "CFLAGS": "$penv{CFLAGS} /MP", "CXXFLAGS": "$penv{CXXFLAGS} /MP", - "BOOST_ROOT": "E:/Reality/boost_1_81_0", - "DAZStudioSDK_ROOT_DIR": "D:/3D/DAZ 3D/DAZStudio4.5+ SDK" + "BOOST_ROOT": "E:/BuildDependencies/Boost/boost_1_81_0", + "DAZStudioSDK_ROOT": "D:/3D/DAZ 3D/DAZStudio4.5+ SDK" } }, { @@ -19,7 +19,7 @@ "displayName": "My Paths x64", "description": "My custom x64 dependency paths", "environment": { - "QTDIR": "E:/Reality/Qt/4.8.7-x64/qt-4.8.7-x64-msvc2010" + "QTDIR": "E:/BuildDependencies/Qt/qt-4.8.7-x64-msvc2010" } }, { @@ -28,7 +28,7 @@ "displayName": "My Paths x86", "description": "My custom x86 dependency paths", "environment": { - "QTDIR": "E:/Reality/Qt/4.8.7-x86" + "QTDIR": "E:/BuildDependencies/Qt/qt-4.8.7-x86-msvc2010" } }, { diff --git a/src/Reality.def b/src/Reality.def deleted file mode 100644 index b70c424..0000000 --- a/src/Reality.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - getSDKVersion @1 - getPluginDefinition @2 -SECTIONS - .data READ WRITE \ No newline at end of file diff --git a/src/cmake/Modules/FindDAZStudioSDK.cmake b/src/cmake/Modules/FindDAZStudioSDK.cmake index e8b3804..e738aad 100644 --- a/src/cmake/Modules/FindDAZStudioSDK.cmake +++ b/src/cmake/Modules/FindDAZStudioSDK.cmake @@ -30,16 +30,13 @@ This module defines the following variables: True if the current compiler toolkit will produce a shared library incompatible with DAZ Studio ``DAZStudioSDK_INCLUDE_DIRS`` - DAZ Studio SDK include directories. + DAZ Studio SDK include directory. ``DAZStudioSDK_LIBRARY_DIRS`` Link directories for DAZ Studio SDK libraries. -``DAZStudioSDK_ROOT`` - DAZ Studio SDK root directory. - ``DAZStudioSDK_LIBRARIES`` - DAZ Studio SDK libraries to be linked. + DAZ Studio SDK library to be linked. ``DAZStudioSDK_VERSION`` DAZ Studio SDK version number in ``W.X.Y.Z`` format. @@ -50,12 +47,18 @@ This module defines the following variables: ``DAZStudioSDK_VERSION_MINOR`` DAZ Studio SDK major version number (``X`` in ``W.X.Y.Z``). -``DAZStudioSDK_VERSION_REV`` +``DAZStudioSDK_VERSION_PATCH`` DAZ Studio SDK revision version number (``Y`` in ``W.X.Y.Z``). ``DAZStudioSDK_VERSION_BUILD`` DAZ Studio SDK build version number (``Z`` in ``W.X.Y.Z``). +``DAZStudioSDK_DAZ_STUDIO_DIR`` + DAZ Studio directory. + +``DAZStudioSDK_DAZ_STUDIO_PLUGIN_DIR`` + DAZ Studio plugin directory. + Cache variables ^^^^^^^^^^^^^^^ @@ -64,30 +67,46 @@ Search results are saved persistently in CMake cache entries: ``DAZStudioSDK_INCLUDE_DIR`` Directory containing DAZ Studio SDK headers. -``DAZStudioSDK_LIBRARY_DIR`` - Directory containing DAZ Studio SDK libraries. +``DAZStudioSDK_LIBRARY`` + DAZ Studio SDK library to be linked. -Hints -^^^^^ +``DAZStudioSDK_DPC_EXECUTABLE`` + DAZ Studio SDK PreCompiler. -This module reads hints about search locations from a variable: +``DAZStudioSDK_EXPORTED_SYMBOLS_FILE`` + DAZ Studio plugin exported symbols file (Apple only) ``DAZStudioSDK_ROOT_DIR`` - Preferred installation prefix. + DAZ Studio SDK root directory. -Users may set this hint or results as ``CACHE`` entries. Projects -should not read these entries directly but instead use the above -result variables. One may specify this hint as an environment -variable if it is not specified as a CMake variable or cache entry. +``DAZStudioSDK_DAZ_STUDIO_EXECUTABLE`` + DAZ Studio executable. Imported Targets ^^^^^^^^^^^^^^^^ This module defines the following :prop_tgt:`IMPORTED` targets: -``DAZStudioSDK::DAZStudioSDK`` +``DAZStudioSDK::DzCore`` Target for dependencies. +``DAZStudioSDK::Plugin`` + Target for plugin dependencies. + +``DAZStudioSDK::PreCompiler`` + Target for precompiler. + +Hints +^^^^^ + +This module uses the following environment variables as hints if set: + +``DAZStudioSDK_ROOT`` + DAZ Studio SDK directory. + +``DAZStudio_ROOT`` + DAZ Studio directory. + Examples ^^^^^^^^ @@ -97,7 +116,7 @@ Find DAZ Studio SDK libraries and use imported target: find_package(DAZStudioSDK 4.5 REQUIRED) add_executable(foo foo.cc) - target_link_libraries(foo DAZStudioSDK::DAZStudioSDK) + target_link_libraries(foo DAZStudioSDK::DzCore) .. code-block:: cmake @@ -108,23 +127,71 @@ Find DAZ Studio SDK libraries and use imported target: target_link_libraries(foo ${DAZStudioSDK_LIBRARIES}) endif() #]=======================================================================] - include (FindPackageHandleStandardArgs) -# Get user specified directory to search -set (DAZStudioSDK_ROOT_DIR "${DAZStudioSDK_ROOT_DIR}" CACHE PATH "Directory to search") +function (get_sdk_version include_dir) + # Get the SDK version + file (STRINGS ${include_dir}/dzversion.h _temp REGEX "^#define DZ_SDK_VERSION_(MAJOR|MINOR|REV|BUILD)[ \t]+([0-9]+)$") + if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_MAJOR[ \t]+([0-9]+)") + set (DAZStudioSDK_VERSION_MAJOR ${CMAKE_MATCH_1}) + endif() + if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_MINOR[ \t]+([0-9]+)") + set (DAZStudioSDK_VERSION_MINOR ${CMAKE_MATCH_1}) + endif() + if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_REV[ \t]+([0-9]+)") + set (DAZStudioSDK_VERSION_PATCH ${CMAKE_MATCH_1}) + endif() + if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_BUILD[ \t]+([0-9]+)") + set (DAZStudioSDK_VERSION_BUILD ${CMAKE_MATCH_1}) + endif() + set (DAZStudioSDK_VERSION "${DAZStudioSDK_VERSION_MAJOR}.${DAZStudioSDK_VERSION_MINOR}.${DAZStudioSDK_VERSION_PATCH}.${DAZStudioSDK_VERSION_BUILD}" PARENT_SCOPE) + return (PROPAGATE DAZStudioSDK_VERSION_MAJOR DAZStudioSDK_VERSION_MINOR DAZStudioSDK_VERSION_PATCH DAZStudioSDK_VERSION_BUILD) +endfunction() + +function (is_requested_version_sdk validator_result_var item) + if (DAZStudioSDK_FIND_VERSION_COMPLETE) + get_sdk_version (${item}) + if (NOT DAZStudioSDK_VERSION VERSION_GREATER_EQUAL DAZStudioSDK_FIND_VERSION_COMPLETE) + set (${validator_result_var} FALSE PARENT_SCOPE) + endif() + endif() +endfunction() + +function (search_install_locations result_var) + # Check Windows registry for DAZ Studio install locations + if (WIN32) + # Get architecture bitness + if (CMAKE_SIZEOF_VOID_P EQUAL 4) + set (_BITNESS 32) + else() + set (_BITNESS 64) + endif() + + execute_process( + COMMAND powershell + (Get-ItemProperty -Path 'HKCU:\\Software\\DAZ\\Studio${DAZStudioSDK_VERSION_MAJOR}*\\' -Name 'InstallPath-*' | + Select-Object -ExpandProperty 'InstallPath-${_BITNESS}' | + Sort-Object -Unique) + OUTPUT_VARIABLE _SEARCH_PATHS + ) + + string (REGEX REPLACE "\n" ";" _SEARCH_PATHS "${_SEARCH_PATHS}") + + set (${result_var} ${_SEARCH_PATHS} PARENT_SCOPE) + endif() +endfunction() # Check Windows registry for DAZ Studio Content paths to search (DIM installs the SDK here) if (WIN32) execute_process( COMMAND powershell (Get-ItemProperty -Path 'HKCU:\\Software\\DAZ\\Studio*\\' -Name 'ContentDir*' | - Select ContentDir* | - ForEach-Object { $_.PSObject.Properties | ForEach-Object { $_.Value} } | - Sort-Object -Unique - ) -replace ' ', '\\ ' - OUTPUT_VARIABLE _SEARCH_PATHS + Select-Object 'ContentDir*' | + ForEach-Object { $_.PSObject.Properties.Value } | + Sort-Object -Unique) + OUTPUT_VARIABLE _SDK_SEARCH_PATHS ) + string (REGEX REPLACE "\n" ";" _SEARCH_PATHS "${_SEARCH_PATHS}") endif() @@ -134,144 +201,216 @@ find_path (DAZStudioSDK_INCLUDE_DIR dzversion.h HINTS ${DAZStudioSDK_ROOT_DIR} - $ENV{DAZStudioSDK_ROOT_DIR} - ${_SEARCH_PATHS} + ${_SDK_SEARCH_PATHS} PATH_SUFFIXES include/ DAZStudio4.5+\ SDK/include/ + VALIDATOR + is_requested_version_sdk + DOC + "DAZ Studio SDK include directory" ) -# Export the include directories -set (DAZStudioSDK_INCLUDE_DIRS ${DAZStudioSDK_INCLUDE_DIR}) - -# Find the included Qt include directories -foreach (inc ActiveQt phonon Qt3Support QtCore QtDBus QtDeclarative QtDesigner QtGui QtHelp QtMultimedia QtNetwork QtOpenGl QtOpenVG QtScript QtScriptTools QtSql QtSvg QtTest QtUiTools QtWebKit QtXml QtXmlPatterns) - find_path (DAZStudioSDK_INC_${inc} - NAMES - ${inc} - HINTS - ${DAZStudioSDK_INCLUDE_DIR}/${inc} - NO_DEFAULT_PATH - ) - if (DAZStudioSDK_INC_${inc}) - list (APPEND DAZStudioSDK_INCLUDE_DIRS ${DAZStudioSDK_INC_${inc}}) +if (DAZStudioSDK_INCLUDE_DIR) + set (DAZStudioSDK_INCLUDE_DIRS ${DAZStudioSDK_INCLUDE_DIR}) + + if (NOT DAZStudioSDK_VERSION) + get_sdk_version (${DAZStudioSDK_INCLUDE_DIR}) endif() -endforeach() -# Get the SDK directory root -cmake_path (GET DAZStudioSDK_INCLUDE_DIR PARENT_PATH DAZStudioSDK_ROOT) -set (DAZStudioSDK_ROOT "${DAZStudioSDK_ROOT}" CACHE PATH "SDK root directory") + # Get the SDK directory root + cmake_path (GET DAZStudioSDK_INCLUDE_DIR PARENT_PATH DAZStudioSDK_ROOT_DIR) + set (DAZStudioSDK_ROOT_DIR ${DAZStudioSDK_ROOT_DIR} CACHE PATH "DAZ Studio SDK root directory") -# Get the SDK version -if (DAZStudioSDK_INCLUDE_DIR) - file (STRINGS ${DAZStudioSDK_INCLUDE_DIR}/dzversion.h _temp REGEX "^#define DZ_SDK_VERSION_(MAJOR|MINOR|REV|BUILD)[ \t]+([0-9]+)$") - if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_MAJOR[ \t]+([0-9]+)") - set (DAZStudioSDK_VERSION_MAJOR ${CMAKE_MATCH_1}) - endif() - if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_MINOR[ \t]+([0-9]+)") - set (DAZStudioSDK_VERSION_MINOR ${CMAKE_MATCH_1}) - endif() - if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_REV[ \t]+([0-9]+)") - set (DAZStudioSDK_VERSION_REV ${CMAKE_MATCH_1}) - endif() - if ("${_temp}" MATCHES "#define DZ_SDK_VERSION_BUILD[ \t]+([0-9]+)") - set (DAZStudioSDK_VERSION_BUILD ${CMAKE_MATCH_1}) + # Setup library path prefixes and library suffixes + if (WIN32) + set (_QT_LIB_SUFFIX 4) + + if (CMAKE_SIZEOF_VOID_P EQUAL 4) + set (_LIB_PATH_SUFFIX Win32) + else() + set (_LIB_PATH_SUFFIX x64) + endif() + elseif (APPLE) + set (_QT_LIB_SUFFIX "") + + if (CMAKE_SIZEOF_VOID_P EQUAL 4) + set (_LIB_PATH_SUFFIX Mac32) + else() + set (_LIB_PATH_SUFFIX Mac64) + endif() endif() - set (DAZStudioSDK_VERSION "${DAZStudioSDK_VERSION_MAJOR}.${DAZStudioSDK_VERSION_MINOR}.${DAZStudioSDK_VERSION_REV}.${DAZStudioSDK_VERSION_BUILD}") -endif() -# Setup library path prefixes and library suffixes -if (WIN32) - set (_QT_LIB_SUFFIX ${DAZStudioSDK_VERSION_MAJOR}) + # Find dzcore library + find_library (DAZStudioSDK_LIBRARY + NAMES + dzcore + HINTS + ${DAZStudioSDK_ROOT_DIR} + PATH_SUFFIXES + lib/${_LIB_PATH_SUFFIX} + DOC + "DAZ Studio SDK DzCore library" + NO_DEFAULT_PATH + ) + set (DAZStudioSDK_LIBRARIES ${DAZStudioSDK_LIBRARY}) + + # Get the library directory + cmake_path (GET DAZStudioSDK_LIBRARY PARENT_PATH DAZStudioSDK_LIBRARY_DIRS) + + # Find DAZ PreCompiler + find_program (DAZStudioSDK_DPC_EXECUTABLE + NAMES + dpc + HINTS + ${DAZStudioSDK_ROOT_DIR} + PATH_SUFFIXES + bin/${_LIB_PATH_SUFFIX} + DOC + "DAZ Studio SDK PreCompiler" + NO_DEFAULT_PATH + ) - if (CMAKE_SIZEOF_VOID_P EQUAL 4) - set (_LIB_PATH_SUFFIX Win32) - else() - set (_LIB_PATH_SUFFIX x64) + # Get the binary directory + cmake_path (GET DAZStudioSDK_DPC_EXECUTABLE PARENT_PATH DAZStudioSDK_BINARY_DIR) + + # Set the autogen directory + set (_autogen_dir ${CMAKE_CURRENT_BINARY_DIR}/DAZStudioSDK_autogen) + + # Setup exported symbols files + if (WIN32) + set (DAZStudioSDK_DEF_FILE "${_autogen_dir}/module-definition-file.def") + if (NOT EXISTS ${DAZStudioSDK_DEF_FILE}) + file (WRITE ${DAZStudioSDK_DEF_FILE} +"EXPORTS + getSDKVersion @1 + getPluginDefinition @2 +SECTIONS + .data READ WRITE" + ) + endif() + elseif (APPLE) + find_file (DAZStudioSDK_EXPORTED_SYMBOLS_FILE + NAMES + exportedPluginSymbols.txt + PATHS + ${DAZStudioSDK_INCLUDE_DIR} + DOC + "DAZ Studio SDK Exported Symbols File" + NO_DEFAULT_PATH + ) endif() -elseif (APPLE) - set (_QT_LIB_SUFFIX "") - if (CMAKE_SIZEOF_VOID_P EQUAL 4) - set (_LIB_PATH_SUFFIX Mac32) + # Pass thru REQUIRED + if (DAZStudioSDK_FIND_REQUIRED) + set (_components_required "REQUIRED") else() - set (_LIB_PATH_SUFFIX Mac64) + set (_components_required "OPTIONAL_COMPONENTS") endif() -endif() -# Find dzcore library -find_library (DAZStudioSDK_LIB_DzCore - NAMES - dzcore - HINTS - ${DAZStudioSDK_ROOT} - ${DAZStudioSDK_ROOT_DIR} - $ENV{DAZStudioSDK_ROOT_DIR} - PATH_SUFFIXES - lib/${_LIB_PATH_SUFFIX} -) + # Pass thru QUIET + if (DAZStudioSDK_FIND_QUIETLY) + set (_quiet "QUIET") + else() + set (_quiet "") + endif() -# Get the library directory -cmake_path (GET DAZStudioSDK_LIB_DzCore PARENT_PATH DAZStudioSDK_LIBRARY_DIRS) - -# Find the Qt libraries dzcore uses -foreach (lib Qt3Support QtCore QtGui QtNetwork QtOpenGl QtScript QtSql QtXml aa) - find_library (DAZStudioSDK_LIB_${lib} - NAMES - ${lib}${_QT_LIB_SUFFIX} - HINTS - ${DAZStudioSDK_LIBRARY_DIRS} - NO_DEFAULT_PATH - ) - if (DAZStudioSDK_LIB_${lib}) - list (APPEND _QT_LIBRARIES ${DAZStudioSDK_LIB_${lib}}) + # Find Qt4 for DAZ Studio SDK 4 + if (DAZStudioSDK_VERSION_MAJOR VERSION_EQUAL 4) + if (NOT Qt4_FOUND) # Use SDK included minimal Qt4 + # Find QMake + find_program (QT_QMAKE_EXECUTABLE + NAMES + qmake + HINTS + ${DAZStudioSDK_BINARY_DIR} + NO_DEFAULT_PATH + ) + + # Find QtCore library + find_library (QT_QTCORE_LIBRARY_RELEASE + NAMES + QtCore${_QT_LIB_SUFFIX} + HINTS + ${DAZStudioSDK_LIBRARY_DIRS} + NO_DEFAULT_PATH + ) + + # Find QtCore include directory + find_path (QT_QTCORE_INCLUDE_DIR + NAMES + qconfig.h + HINTS + ${DAZStudioSDK_INCLUDE_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES + QtCore + ) + + # Pre-populate Qt4 binary directory location + set (QT_BINARY_DIR ${DAZStudioSDK_BINARY_DIR} CACHE PATH "") + set (QT_HEADERS_DIR ${DAZStudioSDK_INCLUDE_DIR} CACHE PATH "") + + # Provide fake Qt MKSPECS directory + set (QT_MKSPECS_DIR "${_autogen_dir}/fake_mkspecs" CACHE PATH "") + file (MAKE_DIRECTORY "${QT_MKSPECS_DIR}/default") + + message (WARNING "DAZ Studio SDK does not include all Qt4 components. Call find_package (Qt4 ...) before find_package (DAZStudioSDK) if additional components are required.") + endif() + find_package (Qt4 4.8.1 ${_quiet} ${_components_required} QtCore QtGui QtNetwork QtOpenGL QtScript QtSql QtXml) endif() -endforeach() - -# Export the library directory, libraries, and import target -if (EXISTS ${DAZStudioSDK_LIB_DzCore}) - set (DAZStudioSDK_LIBRARIES ${DAZStudioSDK_LIB_DzCore}) - foreach (lib ${_QT_LIBRARIES}) - list (APPEND DAZStudioSDK_LIBRARIES ${lib}) - endforeach() - - add_library (DAZStudioSDK::DAZStudioSDK SHARED IMPORTED) - set_target_properties (DAZStudioSDK::DAZStudioSDK - PROPERTIES - INTERFACE_LINK_LIBRARIES - "${_QT_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES - "${DAZStudioSDK_INCLUDE_DIRS}" + + # Find DAZ Studio + search_install_locations (_EXEC_SEARCH_PATHS) + find_program (DAZStudioSDK_DAZ_STUDIO_EXECUTABLE + NAMES + DAZStudio + HINTS + ENV DAZStudio_ROOT + ${_EXEC_SEARCH_PATHS} + DOC + "DAZ Studio Executable" ) - - if (WIN32) - set_property (TARGET DAZStudioSDK::DAZStudioSDK PROPERTY IMPORTED_IMPLIB ${DAZStudioSDK_LIB_DzCore}) - if (CMAKE_SIZEOF_VOID_P EQUAL 4) - add_compile_definitions (_WIN32_WINNT=0x0501) - else() - add_compile_definitions (_WIN32_WINNT=0x0502) + cmake_path (GET DAZStudioSDK_DAZ_STUDIO_EXECUTABLE PARENT_PATH DAZStudioSDK_DAZ_STUDIO_DIR) + cmake_path (APPEND DAZStudioSDK_DAZ_STUDIO_DIR plugins OUTPUT_VARIABLE DAZStudioSDK_DAZ_STUDIO_PLUGIN_DIR) + + # Export libraries, and import target + if (EXISTS ${DAZStudioSDK_LIBRARY}) + add_library (DAZStudioSDK::DzCore SHARED IMPORTED) + target_link_libraries (DAZStudioSDK::DzCore INTERFACE ${DAZStudioSDK_LIBRARY}) + target_include_directories (DAZStudioSDK::DzCore INTERFACE ${DAZStudioSDK_INCLUDE_DIR}) + + add_library (DAZStudioSDK::Plugin INTERFACE IMPORTED) + target_link_libraries (DAZStudioSDK::Plugin INTERFACE DAZStudioSDK::DzCore) + + if (WIN32) + target_compile_definitions (DAZStudioSDK::DzCore INTERFACE _WIN32_WINNT=$,0x0501,0x0502>) + set_target_properties (DAZStudioSDK::DzCore PROPERTIES IMPORTED_IMPLIB ${DAZStudioSDK_LIBRARY}) + target_sources (DAZStudioSDK::Plugin INTERFACE ${DAZStudioSDK_DEF_FILE}) + elseif (APPLE) + set_target_properties (DAZStudioSDK::DzCore PROPERTIES IMPORTED_LOCATION ${DAZStudioSDK_LIBRARY}) + set_target_properties (DAZStudioSDK::Plugin PROPERTIES XCODE_ATTRIBUTE_EXPORTED_SYMBOLS_FILE ${DAZStudioSDK_EXPORTED_SYMBOLS_FILE}) endif() - else() - set_property (TARGET DAZStudioSDK::DAZStudioSDK PROPERTY IMPORTED_LOCATION ${DAZStudioSDK_LIB_DzCore}) + + add_executable (DAZStudioSDK::PreCompiler IMPORTED) + set_target_properties (DAZStudioSDK::PreCompiler PROPERTIES IMPORTED_LOCATION ${DAZStudioSDK_DPC_EXECUTABLE}) endif() -endif() -# Check the toolkit -set (DAZStudioSDK_TOOLKIT_INCOMPATIBLE NO) -if (WIN32) - if (DAZStudioSDK_VERSION_MAJOR EQUAL 4) + # Check the toolkit + set (DAZStudioSDK_TOOLKIT_INCOMPATIBLE NO) + if (DAZStudioSDK_VERSION_MAJOR VERSION_EQUAL 4 AND WIN32) if (NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v100") if (NOT CMAKE_GENERATOR_TOOLSET STREQUAL "Windows7.1SDK") - message (WARNING "DAZ Studio ${DAZStudioSDK_VERSION_MAJOR} SDK requires MSVC toolkit v100 or Windows7.1SDK") + message (WARNING "DAZ Studio 4 SDK requires MSVC toolkit v100 or Windows7.1SDK") set (DAZStudioSDK_TOOLKIT_INCOMPATIBLE YES) endif() endif() endif() -endif() -# Cleanup CMake UI -mark_as_advanced (DAZStudioSDK_INCLUDE_DIR DAZStudioSDK_LIB_DzCore DAZStudioSDK_LIB_Qt3Support DAZStudioSDK_LIB_QtCore DAZStudioSDK_LIB_QtGui DAZStudioSDK_LIB_QtNetwork DAZStudioSDK_LIB_QtOpenGl DAZStudioSDK_LIB_QtScript DAZStudioSDK_LIB_QtSql DAZStudioSDK_LIB_QtXml) + # Cleanup CMake UI + mark_as_advanced (DAZStudioSDK_LIBRARY DAZStudioSDK_INCLUDE_DIR DAZStudioSDK_DPC_EXECUTABLE DAZStudioSDK_DAZ_STUDIO_EXECUTABLE DAZStudioSDK_EXPORTED_SYMBOLS_FILE) +endif() # Report problems -find_package_handle_standard_args (DAZStudioSDK REQUIRED_VARS DAZStudioSDK_LIBRARY_DIRS DAZStudioSDK_INCLUDE_DIRS DAZStudioSDK_ROOT DAZStudioSDK_LIBRARIES VERSION_VAR DAZStudioSDK_VERSION) \ No newline at end of file +find_package_handle_standard_args (DAZStudioSDK REQUIRED_VARS DAZStudioSDK_LIBRARY DAZStudioSDK_INCLUDE_DIR DAZStudioSDK_DPC_EXECUTABLE DAZStudioSDK_ROOT_DIR VERSION_VAR DAZStudioSDK_VERSION) diff --git a/src/exportedPluginSymbols.txt b/src/exportedPluginSymbols.txt deleted file mode 100644 index 0602855..0000000 --- a/src/exportedPluginSymbols.txt +++ /dev/null @@ -1,2 +0,0 @@ -_getSDKVersion -_getPluginDefinition