Skip to content
Closed
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
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ project(${XSTUDIO_GLOBAL_NAME} VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX)
# Pre-create the target so Qt's FindWrapOpenGL early-returns and never hits the
# broken AGL block. Can be removed once the minimum supported Qt is >= 6.9.
if(APPLE AND NOT TARGET WrapOpenGL::WrapOpenGL)
find_package(OpenGL REQUIRED)
# Force the system framework to be found, otherwise
# xstudio crashes under Tahoe and it prevents codesigning.
# Note that vcpkg's glew port needs to be patched similarly.
block(SCOPE_FOR VARIABLES)
set(CMAKE_FIND_FRAMEWORK ONLY)
find_package(OpenGL REQUIRED)
endblock()

add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED)
target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::GL)
endif()
Expand Down Expand Up @@ -312,6 +319,11 @@ if (USE_VCPKG)
add_subdirectory("scripts/qt_install")
endif()

if (APPLE)
# Finalize the bundle by removing any absolute rpaths from and codesigning any binaries
add_subdirectory("scripts/macos_finalize_bundle")
endif()

if (WIN32)

include(InstallRequiredSystemLibraries)
Expand Down
2 changes: 1 addition & 1 deletion cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ macro(add_plugin_qml name _dir)
cmake_path(GET DIR FILENAME dirname)
add_custom_command(TARGET ${name}_COPY_QML POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_directory ${DIR} ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/PlugIns/xstudio/qml/${dirname})
copy_directory ${DIR} ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/Resources/qml/${dirname})
endif()
endforeach()
else()
Expand Down
14 changes: 14 additions & 0 deletions cmake/vcpkg_overlay_ports/glew/fix-LNK2019.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index 5649972..c0252ec 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -129,9 +129,6 @@ if (MSVC)
target_compile_options (glew PRIVATE -GS-)
target_compile_options (glew_s PRIVATE -GS-)
# remove stdlib dependency
- target_link_libraries (glew LINK_PRIVATE -nodefaultlib -noentry)
- target_link_libraries (glew LINK_PRIVATE libvcruntime.lib)
- target_link_libraries (glew LINK_PRIVATE msvcrt.lib )
string(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
elseif (WIN32 AND ((CMAKE_C_COMPILER_ID MATCHES "GNU") OR (CMAKE_C_COMPILER_ID MATCHES "Clang")))
# remove stdlib dependency on windows with GCC and Clang (for similar reasons
17 changes: 17 additions & 0 deletions cmake/vcpkg_overlay_ports/glew/opengl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -36,7 +36,13 @@
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif()

-find_package (OpenGL REQUIRED)
+if (APPLE)
+ set(CMAKE_FIND_FRAMEWORK ONLY)
+ find_package (OpenGL REQUIRED)
+ unset(CMAKE_FIND_FRAMEWORK)
+else()
+ find_package (OpenGL REQUIRED)
+endif()

# prefer GLVND
if (OPENGL_opengl_LIBRARY)
62 changes: 62 additions & 0 deletions cmake/vcpkg_overlay_ports/glew/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
if("x11" IN_LIST FEATURES)
message(WARNING "${PORT} requires the following libraries from the system package manager:\n libxmu-dev\n libxi-dev\n libgl-dev\n\nThese can be installed on Ubuntu systems via apt-get install libxmu-dev libxi-dev libgl-dev.")
endif()

# Don't change to vcpkg_from_github! The sources in the git repository (archives) are missing some files that are distributed inside releases.
# More info: https://github.com/nigels-com/glew/issues/31 and https://github.com/nigels-com/glew/issues/13
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/nigels-com/glew/releases/download/glew-${VERSION}/glew-${VERSION}.tgz"
FILENAME "glew-${VERSION}.tgz"
SHA512 cb4caecf32ec0f180c2691dc7769ffc99571c64f259a2663a2b80e788f1c2fd5362c59e0caaeefed6fb78a4070366d244666a657358049b09071b59fae2377e0
)

vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
SOURCE_BASE glew
PATCHES
fix-LNK2019.patch
trim-build.diff
opengl.patch
)

set(options "")
if(VCPKG_TARGET_IS_ANDROID)
list(APPEND options "-DGLEW_X11=OFF")
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
OPTIONS
${options}
-DBUILD_UTILS=OFF
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/glew)
vcpkg_fixup_pkgconfig()

# Burn-in CMake build config
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/GL/glew.h" "ifndef GLEW_NO_GLU" "if 0")

if(NOT VCPKG_BUILD_TYPE)
set(libname GLEW)
if(VCPKG_TARGET_IS_WINDOWS)
set(libname glew32)
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/glew.pc" " -l${libname}" " -l${libname}d")
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/GL/glew.h" "#ifdef GLEW_STATIC" "#if 1")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/GL/wglew.h" "#ifdef GLEW_STATIC" "#if 1")
endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
23 changes: 23 additions & 0 deletions cmake/vcpkg_overlay_ports/glew/trim-build.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index c5c1fb8..b1f41bf 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -162,8 +162,10 @@ endforeach()
set(targets_to_install "")
if(BUILD_SHARED_LIBS)
list(APPEND targets_to_install glew)
+ set_target_properties(glew_s PROPERTIES EXCLUDE_FROM_ALL 1)
else ()
list(APPEND targets_to_install glew_s)
+ set_target_properties(glew PROPERTIES EXCLUDE_FROM_ALL 1)
endif()

install ( TARGETS ${targets_to_install}
@@ -235,6 +237,7 @@ if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600))
DESTINATION ${CMAKE_INSTALL_LIBDIR}
CONFIGURATIONS Debug RelWithDebInfo
COMPONENT Runtime
+ OPTIONAL # subject to BUILD_SHARED_LIBS
)
endif()

14 changes: 14 additions & 0 deletions cmake/vcpkg_overlay_ports/glew/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
glew provides CMake targets:

# Legacy CMake find module
find_package(GLEW REQUIRED)
target_link_libraries(main PRIVATE GLEW::GLEW)

# Modern CMake config package
find_package(GLEW CONFIG REQUIRED)
target_link_libraries(main PRIVATE GLEW::GLEW)

glew provides pkg-config modules:

# The OpenGL Extension Wrangler library
glew
25 changes: 25 additions & 0 deletions cmake/vcpkg_overlay_ports/glew/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
include(SelectLibraryConfigurations)
_find_package(GLEW CONFIG)
if(GLEW_FOUND AND TARGET GLEW::GLEW AND NOT DEFINED GLEW_INCLUDE_DIRS)
get_target_property(GLEW_INCLUDE_DIRS GLEW::GLEW INTERFACE_INCLUDE_DIRECTORIES)
set(GLEW_INCLUDE_DIR ${GLEW_INCLUDE_DIRS})
get_target_property(_GLEW_DEFS GLEW::GLEW INTERFACE_COMPILE_DEFINITIONS)
if("${_GLEW_DEFS}" MATCHES "GLEW_STATIC")
get_target_property(GLEW_LIBRARY_DEBUG GLEW::GLEW IMPORTED_LOCATION_DEBUG)
get_target_property(GLEW_LIBRARY_RELEASE GLEW::GLEW IMPORTED_LOCATION_RELEASE)
else()
get_target_property(GLEW_LIBRARY_DEBUG GLEW::GLEW IMPORTED_IMPLIB_DEBUG)
get_target_property(GLEW_LIBRARY_RELEASE GLEW::GLEW IMPORTED_IMPLIB_RELEASE)
endif()
get_target_property(_GLEW_LINK_INTERFACE GLEW::GLEW IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE) # same for debug and release
list(APPEND GLEW_LIBRARIES ${_GLEW_LINK_INTERFACE})
list(APPEND GLEW_LIBRARY ${_GLEW_LINK_INTERFACE})
select_library_configurations(GLEW)
if("${_GLEW_DEFS}" MATCHES "GLEW_STATIC")
set(GLEW_STATIC_LIBRARIES ${GLEW_LIBRARIES})
else()
set(GLEW_SHARED_LIBRARIES ${GLEW_LIBRARIES})
endif()
unset(_GLEW_DEFS)
unset(_GLEW_LINK_INTERFACE)
endif()
18 changes: 18 additions & 0 deletions cmake/vcpkg_overlay_ports/glew/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "glew",
"version": "2.3.1",
"description": "The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.",
"homepage": "https://github.com/nigels-com/glew",
"supports": "!android",
"dependencies": [
"opengl",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
4 changes: 2 additions & 2 deletions extern/quickfuture/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(QML_FILES
if(APPLE)
set_target_properties(quickfuture
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/PlugIns/xstudio/qml/QuickFuture"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/Resources/qml/QuickFuture"
)
else()
set_target_properties(quickfuture
Expand All @@ -49,7 +49,7 @@ set(QML_FUTURE_FILES
)

if (APPLE)
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/PlugIns/xstudio/qml/QuickFuture)
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/Resources/qml/QuickFuture)
else()
set(QML_DEST_DIR ${CMAKE_BINARY_DIR}/bin/plugin/qml/QuickFuture)
endif()
Expand Down
12 changes: 8 additions & 4 deletions extern/quickpromise/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ else()
add_library(quickpromise SHARED)
endif()

# On Windows the DLL must be next to the QML files for Qt to load the plugin.
# (Install puts it at bin/ separately, see below.)
if(WIN32)
if(APPLE)
set_target_properties(quickpromise
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugin/qml/QuickPromise"
)
else()
set_target_properties(quickpromise
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugin/qml/QuickPromise"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugin/qml/QuickPromise")
endif()

Expand All @@ -68,7 +72,7 @@ endif()
add_custom_target(COPY_PROMISE_QML)

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

add_custom_target(python_module ALL DEPENDS __pybind_xstudio ${VCPKG_LOCATION}/xstudio/api)

# Here we copy the entire python installation into Frameworks
install(DIRECTORY ${VCPKG_LOCATION}/lib/${PYTHONVP} DESTINATION ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/Frameworks/lib/)
# Here we copy the entire python installation into Resources
install(DIRECTORY ${VCPKG_LOCATION}/lib/${PYTHONVP} DESTINATION ${CMAKE_BINARY_DIR}/xSTUDIO.app/Contents/Resources/python/lib)

elseif(WIN32)

Expand Down
10 changes: 10 additions & 0 deletions scripts/macos_finalize_bundle/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# After macdeployqt has done its thing to the bundle, it still needs
# some cleanup by removing absolute rpath's from and codesigning
# all the binaries.

find_package(Python COMPONENTS Interpreter REQUIRED)

set(_cmd "${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/macos_finalize_bundle.py ${CMAKE_BINARY_DIR}/xSTUDIO.app")

install(CODE "message(\"Running: ${_cmd}\")")
install(CODE "execute_process(COMMAND ${_cmd})")
Loading
Loading