-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cmake/install refactor #5121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cmake/install refactor #5121
Changes from all commits
e08f1f7
c9ec090
9f5f6fe
76a08e2
40b9a35
c9df21f
0bf02f4
e08d5c9
e2c9a97
9b50183
88e7e86
d937775
f2b782f
488b19f
74a278d
9491d85
61bd86f
bd703f5
4ee6fac
93724b6
be9f2a0
d102b57
66b4908
75bba03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| SET(PLUGIN_FILES "") | ||
| IF(LMMS_BUILD_WIN32) | ||
| INSTALL(FILES $<TARGET_FILE:Qt5::QWindowsIntegrationPlugin> DESTINATION platforms) | ||
| ENDIF() | ||
|
|
||
| IF(LMMS_BUILD_WIN32 OR LMMS_INSTALL_DEPENDENCIES) | ||
| # Install system libraries | ||
| include(InstallRequiredSystemLibraries) | ||
| include(InstallTargetDependencies) | ||
|
|
||
| # Collect directories to search for DLLs | ||
| GET_FILENAME_COMPONENT(QTBIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) | ||
| set(LIB_DIRS "${QTBIN_DIR}") | ||
|
|
||
| GET_PROPERTY(PLUGINS_BUILT GLOBAL PROPERTY PLUGINS_BUILT) | ||
|
|
||
| IF(LMMS_BUILD_WIN32) | ||
| SET(LMMS_DEP_DESTINATION ${BIN_DIR}) | ||
| SET(PLUGIN_DEP_DESTINATION ${BIN_DIR}) | ||
| ELSE() | ||
| SET(LMMS_DEP_DESTINATION ${LIB_DIR}) | ||
| SET(PLUGIN_DEP_DESTINATION ${LIB_DIR}) | ||
| ENDIF() | ||
|
|
||
| INSTALL_TARGET_DEPENENCIES( | ||
| NAME "main_binary" | ||
| TARGETS lmms | ||
| DESTINATION "${LMMS_DEP_DESTINATION}" | ||
| LIB_DIRS ${LIB_DIRS} "${BIN_DIR}" "${CMAKE_FIND_ROOT_PATH}" | ||
| LIB_DIRS_SUFFIXES "bin" "lib" "../bin" | ||
| ) | ||
|
|
||
| INSTALL_TARGET_DEPENENCIES( | ||
| NAME "plugins" | ||
| TARGETS ${PLUGINS_BUILT} | ||
| DESTINATION ${PLUGIN_DEP_DESTINATION} | ||
| LIB_DIRS ${LIB_DIRS} "${BIN_DIR}" "${PLUGIN_DIR}" "${CMAKE_FIND_ROOT_PATH}" | ||
| LIB_DIRS_SUFFIXES "bin" "lib" "../bin" | ||
| ) | ||
| ENDIF() | ||
|
|
||
| IF(LMMS_BUILD_APPLE) | ||
| INSTALL(CODE "EXECUTE_PROCESS(COMMAND chmod u+x ${CMAKE_BINARY_DIR}/install_apple.sh)") | ||
| INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_BINARY_DIR}/install_apple.sh)") | ||
| ENDIF() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # List of DLLs considered to be system libraries. | ||
| # This is needed when cross-compiling for Windows. | ||
| ADVAPI32.dll | ||
| COMCTL32.dll | ||
| comdlg32.dll | ||
| dwmapi.dll | ||
| GDI32.dll | ||
| IMM32.dll | ||
| KERNEL32.dll | ||
| MPR.DLL | ||
| msvcrt.dll | ||
| ole32.dll | ||
| OLEAUT32.dll | ||
| OPENGL32.DLL | ||
| SHELL32.dll | ||
| USER32.dll | ||
| UxTheme.dll | ||
| VERSION.dll | ||
| WINMM.DLL | ||
| WS2_32.dll | ||
| RPCRT4.dll | ||
| dsound.dll | ||
| SETUPAPI.dll |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| define_property(GLOBAL PROPERTY "CreateTempFile_counter" BRIEF_DOCS "counter for CreateTempFile" | ||
| FULL_DOCS "counter for CreateTempFile") | ||
|
|
||
| function(CreateTempFilePath) | ||
| set(options) | ||
| set(oneValueArgs OUTPUT_VAR) | ||
| set(multiValueArgs) | ||
| cmake_parse_arguments(TEMP "${options}" "${oneValueArgs}" | ||
| "${multiValueArgs}" ${ARGN} ) | ||
|
|
||
| get_property(counter GLOBAL PROPERTY CreateTempFile_counter) | ||
| if(NOT ${counter}) | ||
| set(counter 0) | ||
| endif() | ||
|
|
||
| math(EXPR counter "${counter} + 1") | ||
| set_property(GLOBAL PROPERTY CreateTempFile_counter ${counter}) | ||
|
|
||
| set(${TEMP_OUTPUT_VAR} "${CMAKE_BINARY_DIR}/temp${counter}" PARENT_SCOPE) | ||
| endfunction() |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||
| # This functions forwards a variable to | ||||||
| # the install stage. | ||||||
| # Parameters: | ||||||
| # CONTENT: Variable content. | ||||||
| # NAME: Variable name. | ||||||
| # Options: | ||||||
| # GENERATOR_EXPRESSION: Support generator expression for CONTENT. | ||||||
| function(DEFINE_INSTALL_VAR) | ||||||
| set(options GENERATOR_EXPRESSION) | ||||||
| set(oneValueArgs NAME ) | ||||||
| set(multiValueArgs CONTENT) | ||||||
| cmake_parse_arguments(VAR "${options}" "${oneValueArgs}" | ||||||
| "${multiValueArgs}" ${ARGN} ) | ||||||
|
|
||||||
| # install(CODE) does not support generator expression in ver<3.14 | ||||||
| if(VAR_GENERATOR_EXPRESSION AND ${CMAKE_VERSION} VERSION_LESS "3.14.0") | ||||||
| include(CreateTempFilePath) | ||||||
| CreateTempFilePath(OUTPUT_VAR file_path) | ||||||
| file(GENERATE OUTPUT "${file_path}" CONTENT "${VAR_CONTENT}") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The counter logic doesn't work because the CMake script is evaluated only once. For the MSVC generator,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NVM, I misunderstood the purpose of it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, I still wonder: Can we create files with unique names(more readable if possible) without a counter? |
||||||
| install(CODE "file(READ ${file_path} \"${VAR_NAME}\")") | ||||||
| else() | ||||||
| cmake_policy(SET CMP<0087> NEW) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Also, why did you use spaces instead of tabs in some new files? |
||||||
| install(CODE "set(\"${VAR_NAME}\" \"${VAR_CONTENT}\")") | ||||||
| endif() | ||||||
| endfunction() | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a side note,
CMP0087should be set to use generator expressions inCMake >= 3.14.