Skip to content

Commit

Permalink
Fix build scripts for installation into correct path.
Browse files Browse the repository at this point in the history
Issues #146 and #150.
  • Loading branch information
David Cattermole authored and David Cattermole committed Oct 15, 2020
1 parent aa7068b commit 9b7b7ea
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ()

Expand Down
39 changes: 18 additions & 21 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")
22 changes: 14 additions & 8 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand All @@ -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 ()
Expand All @@ -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)

0 comments on commit 9b7b7ea

Please sign in to comment.