Skip to content

Commit

Permalink
[#150] Restore CMake binaries to Windows package only
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidZemon committed Jan 19, 2019
1 parent 0dcbb77 commit 3a598c5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -27,6 +27,7 @@ option(PACKAGE_PI2 "Create complete package for Raspberry Pi 2" OFF)

include(./PropWareSources.cmake)
include(./DownloadSpin2cpp.cmake)
include(./DownloadCMake.cmake)
include(./PropWareInstall.cmake)
include(./PropWareCPack.cmake)
include(./DocumentationConfig.cmake)
27 changes: 27 additions & 0 deletions DownloadCMake.cmake
@@ -0,0 +1,27 @@
if (PACKAGE_WIN32)
set(CMAKE_DOWNLOAD_VERSION 3.13.3)

# These variables are needed at install time
set(CMAKE_BINARY_SHORT_VERSION 3.13)
set(CMAKE_UNZIP_DIR "${CMAKE_BINARY_DIR}/CMakeBinary/unzipped")
set(CMAKE_BINARY_INSTALLABLE_DIRECTORY "${CMAKE_UNZIP_DIR}/cmake-${CMAKE_DOWNLOAD_VERSION}-win64-x64/")

set(CMAKE_BIN_FILE "${CMAKE_BINARY_DIR}/CMakeBinary/zipped/cmake-${CMAKE_DOWNLOAD_VERSION}-win64-x64.zip")
if (NOT EXISTS "${CMAKE_BIN_FILE}")
file(DOWNLOAD https://github.com/Kitware/CMake/releases/download/v${CMAKE_DOWNLOAD_VERSION}/cmake-${CMAKE_DOWNLOAD_VERSION}-win64-x64.zip
"${CMAKE_BIN_FILE}"
SHOW_PROGRESS
)
execute_process(COMMAND "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_UNZIP_DIR}")
endif ()

add_custom_target(win_cmake ALL DEPENDS "${CMAKE_BINARY_INSTALLABLE_DIRECTORY}/bin/cmake.exe")
add_custom_command(OUTPUT "${CMAKE_UNZIP_DIR}"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_UNZIP_DIR}"
)
add_custom_command(OUTPUT "${CMAKE_BINARY_INSTALLABLE_DIRECTORY}/bin/cmake.exe"
COMMAND "${CMAKE_COMMAND}" -E tar -xf "${CMAKE_BIN_FILE}"
DEPENDS "${CMAKE_BIN_FILE}" "${CMAKE_UNZIP_DIR}"
WORKING_DIRECTORY "${CMAKE_UNZIP_DIR}"
)
endif ()
2 changes: 2 additions & 0 deletions PropWareCPack.cmake
Expand Up @@ -76,6 +76,8 @@ set(CPACK_COMPONENT_PROPWARE_DISPLAY_NAME "Headers/Libraries")
set(CPACK_COMPONENT_PROPWARE_DESCRIPTION "Headers and static libraries for PropWare, Simple and libpropeller")
set(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
set(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Examples projects for each of PropWare, Simple and libpropeller using the PropWare build system")
set(CPACK_COMPONENT_WIN_CMAKE_DISPLAY_NAME "CMake")
set(CPACK_COMPONENT_WIN_CMAKE_DESCRIPTION "Complete CMake installation with additional files for easy Propeller development")
set(CPACK_COMPONENT_LINUX_SPIN2CPP_DISPLAY_NAME "Spin2Cpp")
set(CPACK_COMPONENT_LINUX_SPIN2CPP_DESCRIPTION "Compile Spin files for use in C/C++ projects")
set(CPACK_COMPONENT_WIN_SPIN2CPP_DISPLAY_NAME "${CPACK_COMPONENT_LINUX_SPIN2CPP_DISPLAY_NAME}")
Expand Down
5 changes: 4 additions & 1 deletion PropWareInstall.cmake
Expand Up @@ -8,7 +8,10 @@ if (PACKAGE_LINUX)
endif ()

if (PACKAGE_WIN32)
install(DIRECTORY CMakeModules
install(DIRECTORY CMakeModules/
DESTINATION share/cmake-${CMAKE_BINARY_SHORT_VERSION}/Modules
COMPONENT win_cmake)
install(DIRECTORY "${CMAKE_BINARY_INSTALLABLE_DIRECTORY}/"
DESTINATION .
COMPONENT win_cmake)
install(PROGRAMS ${CMAKE_BINARY_DIR}/Spin2Cpp/Windows/spin2cpp.exe
Expand Down

0 comments on commit 3a598c5

Please sign in to comment.