Skip to content

Commit

Permalink
Cleanup some CMake stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
exjam committed Jun 14, 2018
1 parent 546a356 commit e89b248
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Expand Up @@ -30,10 +30,12 @@ if(WUT_BUILD_TOOLS)
endif()

if(WUT_BUILD_PPC)
set(DEVKITPPC $ENV{DEVKITPPC} CACHE STRING "Path to devkitPPC install")
if(NOT WUT_BUILD_TOOLS)
message(FATAL_ERROR "WUT_BUILD_PPC requires WUT_BUILD_TOOLS.")
endif()

if(NOT DEVKITPPC)
message(FATAL_ERROR "You must have defined DEVKITPPC to build PPC libraries.")
if(NOT DEFINED ENV{DEVKITPPC})
message(FATAL_ERROR "You must have defined DEVKITPPC in your environment to build PPC libraries.")
endif()

set(WUT_TOOLCHAIN "${CMAKE_CURRENT_SOURCE_DIR}/share/wut.toolchain.cmake")
Expand All @@ -43,7 +45,6 @@ if(WUT_BUILD_PPC)
CMAKE_GENERATOR "Unix Makefiles"
INSTALL_DIR "${WUT_STAGING}"
CMAKE_CACHE_ARGS
-DDEVKITPPC:string=${DEVKITPPC}
-DWUT_ROOT:filepath=${WUT_ROOT}
-DWUT_RPLIMPORTGEN:filepath=$<TARGET_FILE:rplimportgen>
-DCMAKE_TOOLCHAIN_FILE:filepath=${WUT_TOOLCHAIN}
Expand All @@ -56,7 +57,6 @@ if(WUT_BUILD_PPC)
CMAKE_GENERATOR "Unix Makefiles"
INSTALL_DIR "${WUT_STAGING}"
CMAKE_CACHE_ARGS
-DDEVKITPPC:string=${DEVKITPPC}
-DWUT_ROOT:filepath=${WUT_ROOT}
-DCMAKE_TOOLCHAIN_FILE:filepath=${WUT_TOOLCHAIN}
-DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR>
Expand Down
19 changes: 9 additions & 10 deletions share/wut.toolchain.cmake
Expand Up @@ -5,21 +5,20 @@ set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR "ppc")
set(CMAKE_CROSSCOMPILING 1)

set(DEVKITPPC $ENV{DEVKITPPC} CACHE STRING "Path to devkitPPC install")
set(WUT_ROOT $ENV{WUT_ROOT} CACHE STRING "Path to wut install")

if(NOT DEVKITPPC)
if(NOT DEFINED ENV{DEVKITPPC})
message(FATAL_ERROR "You must have defined DEVKITPPC before calling cmake.")
endif()

if(NOT WUT_ROOT)
get_filename_component(WUT_ROOT ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
if(NOT DEFINED ENV{WUT_ROOT})
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../share/wut.cmake)
get_filename_component(ENV{WUT_ROOT} ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
else()
message(FATAL_ERROR "You must have defined WUT_ROOT before calling cmake.")
endif()
endif()

if(WIN32)
# Because "Unix Makefiles" generator does not set this, even if on Windows
set(CMAKE_EXECUTABLE_SUFFIX ".exe")
endif()
set(DEVKITPPC $ENV{DEVKITPPC})
set(WUT_ROOT $ENV{WUT_ROOT})

set(CMAKE_ASM_COMPILER "${DEVKITPPC}/bin/powerpc-eabi-gcc${CMAKE_EXECUTABLE_SUFFIX}" CACHE PATH "")
set(CMAKE_C_COMPILER "${DEVKITPPC}/bin/powerpc-eabi-gcc${CMAKE_EXECUTABLE_SUFFIX}" CACHE PATH "")
Expand Down

0 comments on commit e89b248

Please sign in to comment.