slight reorganisation of cmake toolchain files to clean up dependencies in build

This commit is contained in:
Wolfgang Thaller 2015-07-20 21:38:01 +02:00
parent 436af616b8
commit b15b38d1b7
4 changed files with 35 additions and 18 deletions

View File

@ -19,12 +19,26 @@ cmake_minimum_required(VERSION 2.8)
project(Retro)
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
include(add_application)
configure_file(cmake/retro68.toolchain.cmake.in cmake/retro68.toolchain.cmake @ONLY)
install(DIRECTORY cmake/ DESTINATION cmake FILES_MATCHING PATTERN "*.cmake")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/retro68.toolchain.cmake DESTINATION cmake)
set(MAKE_APPL ${CMAKE_CURRENT_BINARY_DIR}/../build-host/MakeAPPL/MakeAPPL)
set(REZ ${CMAKE_CURRENT_BINARY_DIR}/../build-host/Rez/Rez)
set( REZ_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libretro:${CMAKE_INSTALL_PREFIX}/RIncludes" )
add_subdirectory(libretro)
# add library path so that GCC picks up the freshly-built libretro
link_directories(${CMAKE_CURRENT_BINARY_DIR}/libretro)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libretro)
add_subdirectory(Console)
add_subdirectory(TestApps)
add_subdirectory(Samples/HelloWorld)
@ -34,11 +48,9 @@ add_subdirectory(Samples/Dialog)
add_subdirectory(Samples/SystemExtension)
else()
set(RETRO68_ROOT ${CMAKE_INSTALL_PREFIX})
configure_file(cmake/retro68.toolchain.cmake.in cmake/retro68.toolchain.cmake @ONLY)
install(DIRECTORY cmake/ DESTINATION cmake FILES_MATCHING PATTERN "*.cmake")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/retro68.toolchain.cmake DESTINATION cmake)
add_subdirectory(ResourceFiles)
add_subdirectory(MakeAPPL)
add_subdirectory(ASFilter)

View File

@ -8,7 +8,8 @@ set_target_properties(SystemExtension PROPERTIES OUTPUT_NAME SystemExtension.flt
add_custom_command(
OUTPUT SystemExtension.bin SystemExtension.dsk
COMMAND ${REZ} ${CMAKE_CURRENT_SOURCE_DIR}/SystemExtension.r
COMMAND ${REZ} -I ${REZ_INCLUDE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/SystemExtension.r
--copy ${CMAKE_CURRENT_SOURCE_DIR}/Icons.rsrc.bin
-o SystemExtension.bin
-t INIT

View File

@ -17,6 +17,7 @@
SRC=$(cd `dirname $0` && pwd -P)
mkdir -p binutils-build
rm -rf toolchain
mkdir -p toolchain
PREFIX=`pwd`/toolchain/
set -e
@ -61,7 +62,7 @@ cd ..
sh "$SRC/prepare-headers.sh" "$SRC/CIncludes" toolchain/m68k-unknown-elf/include
mkdir -p toolchain/RIncludes
mkdir -p toolchain/m68k-unknown-elf/RIncludes
sh "$SRC/prepare-rincludes.sh" "$SRC/RIncludes" toolchain/m68k-unknown-elf/RIncludes
mkdir -p build-host
@ -70,18 +71,6 @@ cmake ${SRC} -DCMAKE_INSTALL_PREFIX=$PREFIX
cd ..
make -C build-host install
# create an empty libretrocrt.a so that cmake's compiler test doesn't fail
$PREFIX/bin/m68k-unknown-elf-ar cqs $PREFIX/m68k-unknown-elf/lib/libretrocrt.a
# the real libretrocrt.a is built and installed by `make -C build-target install` later
mkdir -p build-target
cd build-target
cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=$PREFIX/cmake/retro68.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release
cd ..
if test ! -e $PREFIX/bin/m68k-unknown-elf-as.real; then
mv $PREFIX/bin/m68k-unknown-elf-as $PREFIX/bin/m68k-unknown-elf-as.real
ln -s $PREFIX/bin/asfilter $PREFIX/bin/m68k-unknown-elf-as
@ -89,4 +78,17 @@ if test ! -e $PREFIX/bin/m68k-unknown-elf-as.real; then
ln -s $PREFIX/bin/asfilter $PREFIX/m68k-unknown-elf/bin/as
fi
# create an empty libretrocrt.a so that cmake's compiler test doesn't fail
$PREFIX/bin/m68k-unknown-elf-ar cqs $PREFIX/m68k-unknown-elf/lib/libretrocrt.a
# the real libretrocrt.a is built and installed by `make -C build-target install` later
mkdir -p build-target
cd build-target
cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/retro68.toolchain.cmake \
-DIN_RETRO68_TREE=True \
-DCMAKE_BUILD_TYPE=Release
cd ..
make -C build-target install

View File

@ -18,7 +18,7 @@
set( CMAKE_SYSTEM_NAME Retro68 )
set( CMAKE_SYSTEM_VERSION 1)
set( RETRO68_ROOT "@CMAKE_INSTALL_PREFIX@" CACHE PATH "path to root of Retro68 Toolchain" )
set( RETRO68_ROOT "@RETRO68_ROOT@" CACHE PATH "path to root of Retro68 Toolchain" )
set( CMAKE_INSTALL_PREFIX "${RETRO68_ROOT}/m68k-unknown-elf/" CACHE PATH "installation prefix" )
set( MAKE_APPL "${RETRO68_ROOT}/bin/MakeAPPL" )
@ -28,5 +28,7 @@ set( REZ_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/RIncludes" )
set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/m68k-unknown-elf-gcc" )
set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/m68k-unknown-elf-g++" )
if( NOT @IN_RETRO68_TREE@ )
list( APPEND CMAKE_MODULE_PATH "${RETRO68_ROOT}/cmake" )
include(add_application)
endif()