Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 38 additions & 11 deletions cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ macro(default_plugin_options name)
# ${CMAKE_INSTALL_PREFIX}/xstudio.bin.app/Contents/Resources/share/xstudio/plugin/lib${name}.dylib
# )

elseif(WIN32)
# On Windows for SHARED libs, RUNTIME_OUTPUT_DIRECTORY controls the .dll
# (LIBRARY_OUTPUT_DIRECTORY only controls the .lib import library).
# Build the .dll directly at the final location so the .pdb sits next to
# it — debuggers resolve symbols without ambiguity, and no POST_BUILD copy
# is needed.
set_target_properties(${name}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/share/xstudio/plugin"
)

else()
set_target_properties(${name}
PROPERTIES
Expand All @@ -209,12 +220,9 @@ macro(default_plugin_options name)
# We don't want the vcpkg install because it forces dependences; we just want the plugin.
_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION share/xstudio/plugin)

#For interactive debugging, we want only the output dll to be copied to the build plugins folder.
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${PROJECT_NAME}>" "${CMAKE_BINARY_DIR}/share/xstudio/plugin"
)
# Note: default_plugin_options sets RUNTIME_OUTPUT_DIRECTORY to
# ${CMAKE_BINARY_DIR}/share/xstudio/plugin on Windows, so the .dll is
# already linked at the final dev-tree location. No POST_BUILD copy needed.
endif()

endmacro()
Expand Down Expand Up @@ -380,9 +388,15 @@ macro(add_python_plugin NAME)

else()

add_custom_command(TARGET COPY_PY_PLUGIN_${NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${NAME} ${CMAKE_BINARY_DIR}/bin/plugin-python/${NAME})
if (WIN32)
add_custom_command(TARGET COPY_PY_PLUGIN_${NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${NAME} ${CMAKE_BINARY_DIR}/share/xstudio/plugin-python/${NAME})
else()
add_custom_command(TARGET COPY_PY_PLUGIN_${NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${NAME} ${CMAKE_BINARY_DIR}/bin/plugin-python/${NAME})
endif()

endif()

Expand Down Expand Up @@ -491,10 +505,17 @@ macro(add_resource name path target resource_type)

else()

add_custom_command(TARGET ${target} POST_BUILD
if (WIN32)
add_custom_command(TARGET ${target} POST_BUILD
BYPRODUCTS ${CMAKE_BINARY_DIR}/share/xstudio/${resource_type}/${name}
COMMAND ${CMAKE_COMMAND} -E copy ${path}/${name}
${CMAKE_BINARY_DIR}/share/xstudio/${resource_type}/${name})
else()
add_custom_command(TARGET ${target} POST_BUILD
BYPRODUCTS ${CMAKE_BINARY_DIR}/bin/${resource_type}/${name}
COMMAND ${CMAKE_COMMAND} -E copy ${path}/${name}
${CMAKE_BINARY_DIR}/bin/${resource_type}/${name})
endif()

if(INSTALL_XSTUDIO)
install(FILES
Expand Down Expand Up @@ -556,9 +577,15 @@ macro(add_font name path target)

else()

add_custom_command(TARGET ${target} POST_BUILD
if (WIN32)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${path}/${name}
${CMAKE_BINARY_DIR}/share/xstudio/fonts/${name})
else()
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${path}/${name}
${CMAKE_BINARY_DIR}/bin/fonts/${name})
endif()

if(INSTALL_XSTUDIO)
install(FILES
Expand Down
9 changes: 9 additions & 0 deletions extern/quickfuture/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ if(APPLE)
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/PlugIns/xstudio/qml/QuickFuture"
)
elseif(WIN32)
# On Windows for SHARED libs, RUNTIME_OUTPUT_DIRECTORY controls the .dll.
# qmldir declares `plugin quickfuture` so the .dll must be co-located with
# qmldir in the module directory at runtime.
set_target_properties(quickfuture
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/share/xstudio/plugin/qml/QuickFuture")
else()
set_target_properties(quickfuture
PROPERTIES
Expand All @@ -49,6 +56,8 @@ set(QML_FUTURE_FILES

if (APPLE)
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/PlugIns/xstudio/qml/QuickFuture)
elseif (WIN32)
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/share/xstudio/plugin/qml/QuickFuture)
else()
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/bin/plugin/qml/QuickFuture)
endif()
Expand Down
2 changes: 2 additions & 0 deletions extern/quickpromise/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ add_custom_target(COPY_PROMISE_QML)

if (APPLE)
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/PlugIns/xstudio/qml/QuickPromise)
elseif (WIN32)
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/share/xstudio/plugin/qml/QuickPromise)
else()
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/bin/plugin/qml/QuickPromise)
endif()
Expand Down
11 changes: 8 additions & 3 deletions share/snippets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
set(snippets)

macro(add_snip name)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/snippets/${name}
if (WIN32)
set(_snip_dest ${CMAKE_BINARY_DIR}/share/xstudio/snippets/${name})
else()
set(_snip_dest ${CMAKE_BINARY_DIR}/bin/snippets/${name})
endif()
add_custom_command(OUTPUT ${_snip_dest}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${name}
${CMAKE_BINARY_DIR}/bin/snippets/${name}
${_snip_dest}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name})
list(APPEND snippets ${CMAKE_BINARY_DIR}/bin/snippets/${name})
list(APPEND snippets ${_snip_dest})
endmacro()

add_snip(Demo/print_status.py)
Expand Down
1 change: 1 addition & 0 deletions src/launch/xstudio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ if(WIN32)
get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
file(TO_NATIVE_PATH "${_qt_bin_dir}" _qt_bin_dir)
file(TO_NATIVE_PATH "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin" _vcpkg_bin_dir)
configure_file(run_xstudio.bat.in ${CMAKE_BINARY_DIR}/run_xstudio.bat @ONLY)

elseif(APPLE)
Expand Down
2 changes: 1 addition & 1 deletion src/launch/xstudio/src/run_xstudio.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ REM Dev-only launcher for xstudio.exe from the build tree.
REM Adds Qt's bin directory to PATH so Qt DLLs resolve without needing
REM an install or windeployqt run. Generated by CMake; do not edit.

set "PATH=@_qt_bin_dir@;%~dp0bin;%PATH%"
set "PATH=@_qt_bin_dir@;@_vcpkg_bin_dir@;%~dp0bin;%PATH%"
"%~dp0bin\xstudio.exe" %*
4 changes: 0 additions & 4 deletions src/plugin_manager/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ target_link_libraries(plugin_test
xstudio::utility
CAF::core
)
set_target_properties(${name}
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugin"
)
set_target_properties(plugin_test
PROPERTIES
LINK_DEPENDS_NO_SHARED true
Expand Down
Loading