2017-03-23 13:17:00 +01:00
|
|
|
cmake_minimum_required(VERSION 3.2)
|
2018-05-23 12:09:48 +02:00
|
|
|
project(wut)
|
2017-03-23 13:17:00 +01:00
|
|
|
include(ExternalProject)
|
|
|
|
|
2018-05-23 12:09:48 +02:00
|
|
|
option(WUT_BUILD_DOCS "Build documentation" OFF)
|
|
|
|
|
2017-03-23 13:17:00 +01:00
|
|
|
set(DEVKITPPC $ENV{DEVKITPPC} CACHE STRING "Path to devkitPPC install")
|
|
|
|
|
|
|
|
# Check for DEVKITPPC
|
|
|
|
if(NOT DEVKITPPC)
|
|
|
|
message(FATAL_ERROR "You must have defined DEVKITPPC before calling cmake.")
|
|
|
|
endif()
|
|
|
|
|
2018-05-23 00:08:13 +02:00
|
|
|
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")
|
|
|
|
|
2018-05-25 14:54:58 +02:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
|
2018-05-23 12:09:48 +02:00
|
|
|
if(WUT_BUILD_DOCS)
|
|
|
|
add_subdirectory(docs)
|
|
|
|
endif()
|
|
|
|
|
2018-05-25 14:54:58 +02:00
|
|
|
add_subdirectory(tools)
|
2018-05-23 00:08:13 +02:00
|
|
|
|
|
|
|
externalproject_add(cafe
|
|
|
|
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cafe"
|
2018-05-25 13:22:39 +02:00
|
|
|
CMAKE_GENERATOR "Unix Makefiles"
|
2018-05-23 00:08:13 +02:00
|
|
|
INSTALL_DIR "${WUT_STAGING}"
|
|
|
|
CMAKE_CACHE_ARGS
|
2018-05-27 13:10:58 +02:00
|
|
|
-DDEVKITPPC:string=${DEVKITPPC}
|
2018-05-23 00:08:13 +02:00
|
|
|
-DWUT_ROOT:filepath=${WUT_ROOT}
|
2018-05-30 19:54:41 +02:00
|
|
|
-DWUT_RPLIMPORTGEN:filepath=$<TARGET_FILE:rplimportgen>
|
2018-05-23 00:08:13 +02:00
|
|
|
-DCMAKE_TOOLCHAIN_FILE:filepath=${WUT_TOOLCHAIN}
|
|
|
|
-DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR>
|
2018-05-30 19:54:41 +02:00
|
|
|
DEPENDS rplimportgen
|
2018-05-23 00:08:13 +02:00
|
|
|
BUILD_ALWAYS 1)
|
2017-03-23 13:17:00 +01:00
|
|
|
|
2018-05-23 12:10:10 +02:00
|
|
|
externalproject_add(libraries
|
|
|
|
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries"
|
2018-05-25 13:22:39 +02:00
|
|
|
CMAKE_GENERATOR "Unix Makefiles"
|
2018-05-23 12:10:10 +02:00
|
|
|
INSTALL_DIR "${WUT_STAGING}"
|
|
|
|
CMAKE_CACHE_ARGS
|
2018-05-27 13:10:58 +02:00
|
|
|
-DDEVKITPPC:string=${DEVKITPPC}
|
2018-05-23 12:10:10 +02:00
|
|
|
-DWUT_ROOT:filepath=${WUT_ROOT}
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE:filepath=${WUT_TOOLCHAIN}
|
|
|
|
-DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR>
|
|
|
|
BUILD_ALWAYS 1)
|
|
|
|
|
2017-03-23 13:17:00 +01:00
|
|
|
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
|
2018-05-23 00:08:13 +02:00
|
|
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
|
|
|
FILES_MATCHING PATTERN "*.h*")
|
2017-03-23 13:17:00 +01:00
|
|
|
|
2018-05-23 00:08:13 +02:00
|
|
|
install(DIRECTORY "${CMAKE_SOURCE_DIR}/share/"
|
|
|
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/share")
|
2017-03-23 13:17:00 +01:00
|
|
|
|
|
|
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/staging/"
|
2018-05-23 00:08:13 +02:00
|
|
|
DESTINATION "${CMAKE_INSTALL_PREFIX}")
|