-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
137 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#============================================================================= | ||
# Copyright 2016 Sam Hanes | ||
# | ||
# Distributed under the OSI-approved BSD License (the "License"); | ||
# see accompanying file COPYING.txt for details. | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the License for more information. | ||
#============================================================================= | ||
# (To distribute this file outside of CMake-Microchip, | ||
# substitute the full License text for the above reference.) | ||
|
||
# this module is called by `Platform/MicrochipMCU-CXX` | ||
# to provide information specific to the XC32 compiler | ||
|
||
include(MicrochipPathSearch) | ||
if(NOT MICROCHIP_XC32_PATH) | ||
MICROCHIP_PATH_SEARCH(MICROCHIP_XC32_PATH xc32 | ||
CACHE "the path to a Microchip XC32 installation" | ||
STORE_VERSION MICROCHIP_CXX_COMPILER_VERSION | ||
) | ||
endif() | ||
|
||
if(NOT MICROCHIP_XC32_PATH) | ||
message(FATAL_ERROR | ||
"No Microchip XC32 compiler was found. Please provide the path" | ||
" to an XC32 installation on the command line, for example:\n" | ||
"cmake -DMICROCHIP_XC32_PATH=/opt/microchip/xc32/v1.42 ." | ||
) | ||
endif() | ||
|
||
set(CMAKE_FIND_ROOT_PATH ${MICROCHIP_XC32_PATH}) | ||
|
||
set(OS_SUFFIX "") | ||
if(WIN32) | ||
string(APPEND OS_SUFFIX ".exe") | ||
endif() | ||
|
||
set(CMAKE_CXX_COMPILER ${MICROCHIP_XC32_PATH}/bin/xc32-g++${OS_SUFFIX} CACHE STRING "" FORCE) | ||
set(MICROCHIP_CXX_COMPILER_ID XC32) | ||
|
||
set(CMAKE_CXX_FLAGS "-mprocessor=${MICROCHIP_MCU_MODEL}" CACHE STRING "" FORCE) | ||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG" CACHE STRING "" FORCE) | ||
set(CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING "" FORCE) | ||
set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf" CACHE STRING "" FORCE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#============================================================================= | ||
# Copyright 2016 Sam Hanes | ||
# | ||
# Distributed under the OSI-approved BSD License (the "License"); | ||
# see accompanying file COPYING.txt for details. | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the License for more information. | ||
#============================================================================= | ||
# (To distribute this file outside of CMake-Microchip, | ||
# substitute the full License text for the above reference.) | ||
|
||
# This module is loaded during the search for a CXX compiler | ||
# to provide the information necessary to find one. | ||
|
||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "PIC_32") | ||
include(Platform/MicrochipMCU-CXX-XC32) | ||
else() | ||
message(FATAL_ERROR | ||
"No CXX compiler for '${CMAKE_SYSTEM_PROCESSOR}'" | ||
" is supported yet." | ||
) | ||
endif() | ||
|
||
if(MICROCHIP_CXX_COMPILER_ID) | ||
message(STATUS | ||
"Using Microchip CXX compiler ${MICROCHIP_CXX_COMPILER_ID}" | ||
" ${MICROCHIP_CXX_COMPILER_VERSION}" | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#============================================================================= | ||
# Copyright 2016 Sam Hanes | ||
# | ||
# Distributed under the OSI-approved BSD License (the "License"); | ||
# see accompanying file COPYING.txt for details. | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the License for more information. | ||
#============================================================================= | ||
# (To distribute this file outside of CMake-Microchip, | ||
# substitute the full License text for the above reference.) | ||
|
||
# this module is called after the compiler has been determined | ||
# to set up information specific to Microchip GNU CXX compilers | ||
|
||
# for XC32, inject properties that may have been missed | ||
# see `Platform/MicrochipMCU-CXX-XC32` for explanation | ||
|
||
if(MICROCHIP_CXX_COMPILER_ID STREQUAL "XC32") | ||
if(NOT CMAKE_CXX_SIZEOF_DATA_PTR) | ||
set(CMAKE_CXX_SIZEOF_DATA_PTR 4) | ||
endif() | ||
|
||
if(NOT CMAKE_CXX_COMPILER_ABI) | ||
set(CMAKE_CXX_COMPILER_ABI ELF) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters