Update CMakeLists.txt to allow optional building of tools & ppc libs.

This commit is contained in:
James Benton 2018-06-13 18:54:28 +01:00
parent 6344e56090
commit 0b5ff33be1

View File

@ -3,16 +3,10 @@ project(wut)
include(ExternalProject) include(ExternalProject)
option(WUT_BUILD_DOCS "Build documentation" OFF) option(WUT_BUILD_DOCS "Build documentation" OFF)
option(WUT_BUILD_TOOLS "Build tools" ON)
set(DEVKITPPC $ENV{DEVKITPPC} CACHE STRING "Path to devkitPPC install") option(WUT_BUILD_PPC "Build PPC code using devkitPPC" ON)
# Check for DEVKITPPC
if(NOT DEVKITPPC)
message(FATAL_ERROR "You must have defined DEVKITPPC before calling cmake.")
endif()
set(WUT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) set(WUT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(WUT_TOOLCHAIN "${CMAKE_CURRENT_SOURCE_DIR}/share/wut.toolchain.cmake")
set(WUT_STAGING "${CMAKE_BINARY_DIR}/staging") set(WUT_STAGING "${CMAKE_BINARY_DIR}/staging")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
@ -31,7 +25,18 @@ if(WUT_BUILD_DOCS)
add_subdirectory(docs) add_subdirectory(docs)
endif() endif()
if(WUT_BUILD_TOOLS)
add_subdirectory(tools) add_subdirectory(tools)
endif()
if(WUT_BUILD_PPC)
set(DEVKITPPC $ENV{DEVKITPPC} CACHE STRING "Path to devkitPPC install")
if(NOT DEVKITPPC)
message(FATAL_ERROR "You must have defined DEVKITPPC to build PPC libraries.")
endif()
set(WUT_TOOLCHAIN "${CMAKE_CURRENT_SOURCE_DIR}/share/wut.toolchain.cmake")
externalproject_add(cafe externalproject_add(cafe
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cafe" SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cafe"
@ -56,6 +61,7 @@ externalproject_add(libraries
-DCMAKE_TOOLCHAIN_FILE:filepath=${WUT_TOOLCHAIN} -DCMAKE_TOOLCHAIN_FILE:filepath=${WUT_TOOLCHAIN}
-DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR> -DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR>
BUILD_ALWAYS 1) BUILD_ALWAYS 1)
endif()
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/" install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include" DESTINATION "${CMAKE_INSTALL_PREFIX}/include"