diff --git a/CMakeLists.txt b/CMakeLists.txt index d0c5fd808..de938bfbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,8 @@ endif () # Install misc files +# +# NOTE: ${MODULE_FULL_NAME} comes from module sub-directory. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/INSTALL.md @@ -160,12 +162,12 @@ set(CPACK_PACKAGE_FILE_NAME "${MODULE_FULL_NAME}") set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1) # Put the packages into the source directory, so that when we run # another build, it's not removed as part of the clean up. -SET(CPACK_OUTPUT_FILE_PREFIX "../packages") +SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/packages") if (WIN32 AND NOT UNIX) # .zip file for Windows. set(CPACK_GENERATOR "ZIP") elseif (UNIX AND NOT WIN32) - # .tar.gz for Linux. + # .tar.gz for Linux and MacOS set(CPACK_GENERATOR "TGZ") endif () diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 9e5b48eab..39c7a6045 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -20,28 +20,27 @@ # Build Documentation (using Python Sphinx) - set(input_files - ${CMAKE_SOURCE_DIR}/docs/source/index.rst - ${CMAKE_SOURCE_DIR}/docs/source/introduction.rst - ${CMAKE_SOURCE_DIR}/docs/source/commands.rst - ${CMAKE_SOURCE_DIR}/docs/source/nodes.rst - ${CMAKE_SOURCE_DIR}/docs/source/tools.rst - ${CMAKE_SOURCE_DIR}/docs/source/tutorial.rst - ${CMAKE_SOURCE_DIR}/docs/source/solver_design.rst - ${CMAKE_SOURCE_DIR}/docs/source/references.rst - ${CMAKE_SOURCE_DIR}/docs/source/mmSolver.api.rst - ${CMAKE_SOURCE_DIR}/docs/source/mmSolver.logger.rst - ${CMAKE_SOURCE_DIR}/docs/source/mmSolver.tools.rst - ${CMAKE_SOURCE_DIR}/docs/source/mmSolver.ui.rst - ${CMAKE_SOURCE_DIR}/docs/source/mmSolver.utils.rst + source/index.rst + source/introduction.rst + source/commands.rst + source/nodes.rst + source/tools.rst + source/tutorial.rst + source/solver_design.rst + source/references.rst + source/mmSolver.api.rst + source/mmSolver.logger.rst + source/mmSolver.tools.rst + source/mmSolver.ui.rst + source/mmSolver.utils.rst ) -set(output_file ${CMAKE_SOURCE_DIR}/docs/build/html/py-modindex.html) +set(output_file build/html/py-modindex.html) add_custom_command( OUTPUT ${output_file} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/docs/source/index.html ${CMAKE_SOURCE_DIR}/docs/build/html/index.html + COMMAND ${CMAKE_COMMAND} -E copy source/index.html build/html/index.html COMMAND make html - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${input_files} ) add_custom_target( @@ -54,7 +53,5 @@ if (BUILD_PLUGIN) endif () # Install Documentation -if (BUILD_DOCS) - install(DIRECTORY "docs/build/html/" - DESTINATION "${MODULE_FULL_NAME}/docs/html") -endif () +install(DIRECTORY "build/html/" + DESTINATION "${MODULE_FULL_NAME}/docs/html") diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 95b8b5188..1cd148821 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -20,12 +20,13 @@ # Module paths +set(MODULE_OS_NAME "unknown") if(CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(MODULE_OS_NAME mac) + set(MODULE_OS_NAME "mac") elseif(CMAKE_SYSTEM_NAME STREQUAL Linux) - set(MODULE_OS_NAME linux) + set(MODULE_OS_NAME "linux") elseif(CMAKE_SYSTEM_NAME STREQUAL Windows) - set(MODULE_OS_NAME win64) + set(MODULE_OS_NAME "win64") else () message(FATAL_ERROR "Only Linux, MacOS and Windows are supported.") endif () @@ -35,21 +36,20 @@ set(MODULE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") set(MODULE_FULL_NAME "${MODULE_NAME}-maya${MAYA_VERSION}-${MODULE_OS_NAME}") set(MODULE_BUILD_DIR "${CMAKE_BINARY_DIR}/${MODULE_FULL_NAME}") - # Create Module Description file. if(CMAKE_SYSTEM_NAME STREQUAL Darwin) configure_file( - ${CMAKE_SOURCE_DIR}/modules/mayaMatchMoveSolver_mac.mod + ${CMAKE_CURRENT_SOURCE_DIR}/mayaMatchMoveSolver_mac.mod ${CMAKE_BINARY_DIR}/${MODULE_FULL_NAME}.mod @ONLY) elseif(CMAKE_SYSTEM_NAME STREQUAL Linux) configure_file( - ${CMAKE_SOURCE_DIR}/modules/mayaMatchMoveSolver_linux.mod + ${CMAKE_CURRENT_SOURCE_DIR}/mayaMatchMoveSolver_linux.mod ${CMAKE_BINARY_DIR}/${MODULE_FULL_NAME}.mod @ONLY) elseif(CMAKE_SYSTEM_NAME STREQUAL Windows) configure_file( - ${CMAKE_SOURCE_DIR}/modules/mayaMatchMoveSolver_windows.mod + ${CMAKE_CURRENT_SOURCE_DIR}/mayaMatchMoveSolver_windows.mod ${CMAKE_BINARY_DIR}/${MODULE_FULL_NAME}.mod @ONLY) else () @@ -60,4 +60,10 @@ endif () # Install the Module Description file. install(FILES ${CMAKE_BINARY_DIR}/${MODULE_FULL_NAME}.mod - DESTINATION "./") + DESTINATION ${CMAKE_INSTALL_PREFIX}) + +# Set variables in parent scope (directory above). +set(MODULE_OS_NAME "${MODULE_OS_NAME}" PARENT_SCOPE) +set(MODULE_NAME "${MODULE_NAME}" PARENT_SCOPE) +set(MODULE_FULL_NAME "${MODULE_FULL_NAME}" PARENT_SCOPE) +set(MODULE_BUILD_DIR "${MODULE_BUILD_DIR}" PARENT_SCOPE)