aboutsummaryrefslogtreecommitdiffstats
path: root/examples/scriptableapplication/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2018-05-07 17:45:51 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2018-05-08 08:28:00 +0000
commit65afd324370d2a9788d52ef5213dc88f5e3912a0 (patch)
tree47c252cbd1ea07b82f693d9e9b6db8d5036e88f9 /examples/scriptableapplication/CMakeLists.txt
parent928a5249dad9543a669ab07a0108aca26c0642cb (diff)
Fix a few scriptableapplication bugs
1) Remove LIBPATH because that causes linker warnings on macOS, and its usage is deprecated on Windows. 2) Remove all qmake clang related code, as well as clang code from pyside2_config.py. It used to be needed on Windows because we didn't deploy libclang.dll to the PySide2 dir. Now that we do, the code is unnecessary. 3) Remove README.txt reference. 4) Add clarifying comments in README.md. 5) Remove NO_DEFAULT_PATH from find_library because that causes a failure to find the python library on Ubuntu (makes sense because the specified libdir is /usr/lib, but the actual library is under /usr/lib/[arch], and disabling the option forces CMake not to look under the arch dir. 6) Fix rpath to PySide2 dir not being embedded on Linux (presumably because the link flags style changed to absolute paths, not sure). 7) Fix README to be more precise about how MSBuild needs to be invoked, and how to run the executable. 8) Improve the error handling in the project files. 9) Refactor pyside2_config.py usage. Change-Id: I402d5c42ef7e01e94d3827682564e95ee280b40b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples/scriptableapplication/CMakeLists.txt')
-rw-r--r--examples/scriptableapplication/CMakeLists.txt15
1 files changed, 6 insertions, 9 deletions
diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt
index be5b17398..7e57a291b 100644
--- a/examples/scriptableapplication/CMakeLists.txt
+++ b/examples/scriptableapplication/CMakeLists.txt
@@ -28,7 +28,7 @@ macro(pyside2_config option output_var)
OUTPUT_STRIP_TRAILING_WHITESPACE)
if ("${${output_var}}" STREQUAL "")
- message(FATAL_ERROR "Got empty string when running: pyside2_config.py ${option}")
+ message(FATAL_ERROR "Error: Calling pyside2_config.py ${option} returned no output.")
endif()
if(is_list)
string (REPLACE " " ";" ${output_var} "${${output_var}}")
@@ -43,14 +43,11 @@ if(NOT EXISTS ${SHIBOKEN_PATH})
message(FATAL_ERROR "Shiboken executable not found at path: ${SHIBOKEN_PATH}")
endif()
+pyside2_config(--pyside2 PYSIDE2_DIR)
pyside2_config(--python-include PYTHON_INCLUDE_DIR)
pyside2_config(--pyside2-include PYSIDE2_INCLUDE_DIR 1)
-pyside2_config(--pyside2-shared-libraries-cmake PYSIDE2_SHARED_LIBRARIES 1)
-if(WIN32)
+pyside2_config(--pyside2-shared-libraries-cmake PYSIDE2_SHARED_LIBRARIES 0)
pyside2_config(--python-link-cmake PYTHON_LINKING_DATA 0)
-else()
-pyside2_config(--python-link-cmake PYTHON_LINKING_DATA 1)
-endif()
# Get all relevant Qt include dirs, to pass them on to shiboken.
get_property(QT_CORE_INCLUDE_DIRS TARGET Qt5::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
@@ -124,8 +121,8 @@ endforeach()
# =============================================================================================
# Enable rpaths so that the example can be executed from the build dir.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
-set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-SET(CMAKE_INSTALL_RPATH "")
+set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+set(CMAKE_INSTALL_RPATH ${PYSIDE2_DIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# =============================================================================================
# !!! End of dubious section.
@@ -152,7 +149,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${PYSIDE2_SHARED_LIBRARIES})
# Find and link to the python library.
list(GET PYTHON_LINKING_DATA 0 PYTHON_LIBDIR)
list(GET PYTHON_LINKING_DATA 1 PYTHON_LIB)
-find_library(PYTHON_LINK_FLAGS ${PYTHON_LIB} PATHS ${PYTHON_LIBDIR} HINTS ${PYTHON_LIBDIR} NO_DEFAULT_PATH)
+find_library(PYTHON_LINK_FLAGS ${PYTHON_LIB} PATHS ${PYTHON_LIBDIR} HINTS ${PYTHON_LIBDIR})
target_link_libraries(${PROJECT_NAME} PRIVATE ${PYTHON_LINK_FLAGS})
# Same as CONFIG += no_keywords to avoid syntax errors in object.h due to the usage of the word Slot