Skip to content

Commit

Permalink
Merge branch 'release/release-2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidZemon committed Apr 3, 2016
2 parents 90f1ca4 + 33f7ed6 commit 8bdc29c
Show file tree
Hide file tree
Showing 81 changed files with 1,896 additions and 726 deletions.
10 changes: 7 additions & 3 deletions CMakeCPack.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
set(CPACK_GENERATOR
ZIP
DEB
RPM
NSIS
)

if (PACKAGE_LINUX OR PACKAGE_RPI2)
list(APPEND CPACK_GENERATOR RPM DEB)
endif ()
if (PACKAGE_WIN32)
list(APPEND CPACK_GENERATOR NSIS)
endif ()

set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_BINARY_DIR}"
Expand Down
4 changes: 2 additions & 2 deletions CMakeCPackOptions.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
if (CPACK_GENERATOR MATCHES "ZIP")
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE OFF)
set(CPACK_COMPONENTS_IGNORE_GROUPS ON)
set(CPACK_COMPONENTS_ALL propware examples win_cmake cmake osx_cmake)
set(CPACK_COMPONENTS_ALL propware examples win_cmake cmake osx_cmake standalone-cmake)
elseif (CPACK_GENERATOR MATCHES "NSIS")
set(CPACK_COMPONENTS_ALL propware examples win_cmake win_spin2cpp)
elseif (CPACK_GENERATOR MATCHES "DEB")
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
set(CPACK_COMPONENTS_ALL propware examples cmake linux_spin2cpp)
set(CPACK_COMPONENTS_ALL propware examples cmake pi2_cmake linux_spin2cpp rpi_spin2cpp)
elseif (CPACK_GENERATOR MATCHES "RPM")
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
set(CPACK_COMPONENTS_ALL propware examples cmake linux_spin2cpp)
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ endif ()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
find_package(PropWare REQUIRED)

# Allow using `if (VAR IN_LIST MY_LIST)`. Requires CMake 3.3
cmake_policy(SET CMP0057 NEW)

# Set the project, version number and all languages used
project(PropWare
VERSION ${VERSION}
Expand All @@ -34,6 +31,11 @@ if (DOXYGEN_FOUND)
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
endif ()

option(PACKAGE_LINUX "Create complete package for Linux" OFF)
option(PACKAGE_WIN32 "Create complete package for Windows" OFF)
option(PACKAGE_OSX "Create complete package for Mac OSX" OFF)
option(PACKAGE_PI2 "Create complete package for Raspberry Pi 2" OFF)

include(ExternalProject)
include(./DownloadCMakeBinaries.cmake)
include(./DownloadSpin2cpp.cmake)
Expand Down
6 changes: 5 additions & 1 deletion CMakeModules/CMakeCOGCInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ set(CMAKE_INCLUDE_FLAG_COGC ${CMAKE_INCLUDE_FLAG_C})
set(CMAKE_COGC_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
set(CMAKE_COGC_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND})
set(CMAKE_COGC_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH})

if (CMAKE_VERSION VERSION_EQUAL "3.4.0" OR CMAKE_VERSION VERSION_GREATER "3.4.0")
set(INCLUDES "<INCLUDES>")
endif ()
set(CMAKE_COGC_COMPILE_OBJECT
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_COGC_FLAGS_INIT} <FLAGS> -o <OBJECT> <SOURCE>"
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_COGC_FLAGS_INIT} <FLAGS> ${INCLUDES} -o <OBJECT> <SOURCE>"
"${CMAKE_COMMAND} -DOBJCOPY=\"${CMAKE_OBJCOPY}\" -DFILE=<OBJECT> -P ${PROPWARE_RUN_OBJCOPY}")

mark_as_advanced(
Expand Down
5 changes: 4 additions & 1 deletion CMakeModules/CMakeCOGCXXInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ set(CMAKE_INCLUDE_FLAG_COGCXX ${CMAKE_INCLUDE_FLAG_C})
set(CMAKE_COGCXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
set(CMAKE_COGCXX_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND})
set(CMAKE_COGCXX_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH})
if (CMAKE_VERSION VERSION_EQUAL "3.4.0" OR CMAKE_VERSION VERSION_GREATER "3.4.0")
set(INCLUDES "<INCLUDES>")
endif ()
set(CMAKE_COGCXX_COMPILE_OBJECT
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_COGCXX_FLAGS_INIT} <FLAGS> -o <OBJECT> <SOURCE>"
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_COGCXX_FLAGS_INIT} <FLAGS> ${INCLUDES} -o <OBJECT> <SOURCE>"
"${CMAKE_COMMAND} -DOBJCOPY=\"${CMAKE_OBJCOPY}\" -DFILE=<OBJECT> -P ${PROPWARE_RUN_OBJCOPY}")

mark_as_advanced(
Expand Down
20 changes: 17 additions & 3 deletions CMakeModules/CMakeDatSymbolConverter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.0)
# OBJCOPY GCC's objcopy executable
# SOURCE File for objcopy to run over
# OUTPUT Output file
# STRIP Remove this string from the output filename

get_filename_component(SOURCE_FILE_DIRECTORY "${SOURCE}" DIRECTORY)
get_filename_component(SOURCE_FILE_DIRECTORY "${SOURCE_FILE_DIRECTORY}" ABSOLUTE)
Expand All @@ -14,7 +15,7 @@ get_filename_component(OUTPUT_FILE_NAME "${OUTPUT}" NAME)

# Copy file to binary directory only if it isn't already there
if (NOT SOURCE_FILE_DIRECTORY STREQUAL WORKING_DIR)
if (ENV{VERBOSE})
if ($ENV{VERBOSE})
message("${CMAKE_COMMAND} -E copy ${SOURCE} ${WORKING_DIR}/${INPUT_FILE_NAME}")
endif ()
execute_process(
Expand All @@ -23,12 +24,22 @@ if (NOT SOURCE_FILE_DIRECTORY STREQUAL WORKING_DIR)
)
endif ()

# If STRIP is set, remove it from the input filename
if (NOT STRIP STREQUAL "")
set(ORIGINAL_INPUT_FILE_NAME "${INPUT_FILE_NAME}")
string(REPLACE "${STRIP}" "" INPUT_FILE_NAME "${INPUT_FILE_NAME}")
if ($ENV{VERBOSE})
message("mv ${WORKING_DIR}/${ORIGINAL_INPUT_FILE_NAME} ${WORKING_DIR}/${INPUT_FILE_NAME}")
endif ()
file(RENAME "${WORKING_DIR}/${ORIGINAL_INPUT_FILE_NAME}" "${WORKING_DIR}/${INPUT_FILE_NAME}")
endif ()

if (CMD_PASS)
message(FATAL_ERROR "${CMD_PASS}")
else ()
# Object copy
if (ENV{VERBOSE})
message("${OBJCOPY} -Ibinary -Opropeller-elf-gcc -Bpropeller ${INPUT_FILE_NAME} ${INPUT_FILE_NAME}")
if ($ENV{VERBOSE})
message("cd ${WORKING_DIR} && ${OBJCOPY} -Ibinary -Opropeller-elf-gcc -Bpropeller ${INPUT_FILE_NAME} ${INPUT_FILE_NAME}")
endif ()
execute_process(
COMMAND ${OBJCOPY} -Ibinary -Opropeller-elf-gcc -Bpropeller "${INPUT_FILE_NAME}" "${INPUT_FILE_NAME}"
Expand All @@ -40,4 +51,7 @@ else ()
endif ()
endif ()

if ($ENV{VERBOSE})
message("mv ${WORKING_DIR}/${INPUT_FILE_NAME} ${WORKING_DIR}/${OUTPUT_FILE_NAME}")
endif ()
file(RENAME "${WORKING_DIR}/${INPUT_FILE_NAME}" "${WORKING_DIR}/${OUTPUT_FILE_NAME}")
2 changes: 1 addition & 1 deletion CMakeModules/CMakeDetermineSPIN2DATCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeSPIN2DATCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeSPIN2DATCompiler.cmake
@ONLY
)
set(CMAKE_SPIN2DAT_COMPILER_ENV_VAR "FOO")
set(CMAKE_SPIN2DAT_COMPILER_ENV_VAR "SPIN2CPP")
5 changes: 4 additions & 1 deletion CMakeModules/CMakeECOGCInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ set(CMAKE_INCLUDE_FLAG_ECOGC ${CMAKE_INCLUDE_FLAG_C})
set(CMAKE_ECOGC_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
set(CMAKE_ECOGC_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND})
set(CMAKE_ECOGC_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH})
if (CMAKE_VERSION VERSION_EQUAL "3.4.0" OR CMAKE_VERSION VERSION_GREATER "3.4.0")
set(INCLUDES "<INCLUDES>")
endif ()
set(CMAKE_ECOGC_COMPILE_OBJECT
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_ECOGC_FLAGS_INIT} <FLAGS> -o <OBJECT> -c <SOURCE>"
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_ECOGC_FLAGS_INIT} <FLAGS> ${INCLUDES} -o <OBJECT> -c <SOURCE>"
"${CMAKE_COMMAND} -DOBJCOPY=\"${CMAKE_OBJCOPY}\" -DFILE=<OBJECT> -P ${PROPWARE_RUN_OBJCOPY}")

mark_as_advanced(
Expand Down
5 changes: 4 additions & 1 deletion CMakeModules/CMakeECOGCXXInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ set(CMAKE_INCLUDE_FLAG_ECOGCXX ${CMAKE_INCLUDE_FLAG_C})
set(CMAKE_ECOGCXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
set(CMAKE_ECOGCXX_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND})
set(CMAKE_ECOGCXX_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH})
if (CMAKE_VERSION VERSION_EQUAL "3.4.0" OR CMAKE_VERSION VERSION_GREATER "3.4.0")
set(INCLUDES "<INCLUDES>")
endif ()
set(CMAKE_ECOGCXX_COMPILE_OBJECT
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_ECOGCXX_FLAGS_INIT} <FLAGS> -o <OBJECT> -c <SOURCE>"
"<CMAKE_C_COMPILER> <DEFINES> ${CMAKE_ECOGCXX_FLAGS_INIT} <FLAGS> ${INCLUDES} -o <OBJECT> -c <SOURCE>"
"${CMAKE_COMMAND} -DOBJCOPY=\"${CMAKE_OBJCOPY}\" -DFILE=<OBJECT> -P ${PROPWARE_RUN_OBJCOPY}")

mark_as_advanced(
Expand Down
54 changes: 54 additions & 0 deletions CMakeModules/CMakeElfSizer.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.0)

# Variables that should be passed into this script
# SIZE_EXE PropGCC's propeller-elf-size executable
# BINARY Binary file to check

execute_process(
COMMAND "${SIZE_EXE}" "${BINARY}"
RESULT_VARIABLE RETURN_CODE
OUTPUT_VARIABLE STDOUT
ERROR_VARIABLE STDERR
)

function(remove_empty_elements_and_trim out_list in_list)
foreach (item IN LISTS ${in_list})
if (NOT item STREQUAL "")
string(REPLACE " " "" item "${item}")
list(APPEND formatted_list "${item}")
endif ()
endforeach ()

set(${out_list} "${formatted_list}" PARENT_SCOPE)
endfunction()

if (NOT RETURN_CODE)
# Remove carriage returns
string(REPLACE "\r" "" STDOUT "${STDOUT}")

# Split into multiple lines and save as separate variables
string(REPLACE "\n" ";" LINES "${STDOUT}")
list(GET LINES 0 HEADER)
list(GET LINES 1 SIZES)

# Split lines into words
string(REPLACE "\t" ";" HEADER_WORDS_TEMP "${HEADER}")
remove_empty_elements_and_trim(HEADER_WORDS HEADER_WORDS_TEMP)
string(REPLACE "\t" ";" SIZE_WORDS_TEMP "${SIZES}")
remove_empty_elements_and_trim(SIZE_WORDS SIZE_WORDS_TEMP)

# Determine index of "bss" and "dec" word
list(FIND HEADER_WORDS "bss" BSS_INDEX)
list(FIND HEADER_WORDS "dec" DEC_INDEX)

# Determine size of bss and dec sections
list(GET SIZE_WORDS ${BSS_INDEX} BSS_SIZE)
list(GET SIZE_WORDS ${DEC_INDEX} TOTAL_SIZE)

# Subtract bss from total to get code size
math(EXPR CODE_SIZE "${TOTAL_SIZE} - ${BSS_SIZE}")

# All done! Print it!
message("Code size = ${CODE_SIZE}")
message("Total size = ${TOTAL_SIZE}")
endif ()
8 changes: 5 additions & 3 deletions CMakeModules/CMakeRunObjcopy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ cmake_minimum_required(VERSION 3.0)

get_filename_component(WORKING_DIR ${FILE} DIRECTORY)
get_filename_component(FILE_NAME ${FILE} NAME)
get_filename_component(MODULES_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
set(LOCALIZE_LIST_FILE "${MODULES_DIR}/PropellerCogLocalizeSymbols.txt")

string(REPLACE "." ";" NAME_COMPONENTS ${FILE_NAME})
list(LENGTH NAME_COMPONENTS NUM_COMPONENTS)
Expand All @@ -24,11 +26,11 @@ string(SUBSTRING ${SHORT_NAME} 1 ${SHORT_NAME_LEN} SHORT_NAME)
file(RENAME "${FILE}" "${WORKING_DIR}/${SHORT_NAME}")

# Object copy
if (ENV{VERBOSE})
message("${OBJCOPY} --localize-text --rename-section .text=${SHORT_NAME} ${SHORT_NAME}")
if ($ENV{VERBOSE})
message("${OBJCOPY} --localize-text --localize-symbols=${LOCALIZE_LIST_FILE} --rename-section .text=${SHORT_NAME} ${SHORT_NAME}")
endif()
execute_process(
COMMAND ${OBJCOPY} --localize-text --rename-section .text=${SHORT_NAME} ${SHORT_NAME}
COMMAND "${OBJCOPY}" --localize-text "--localize-symbols=${LOCALIZE_LIST_FILE}" --rename-section .text=${SHORT_NAME} ${SHORT_NAME}
WORKING_DIRECTORY "${WORKING_DIR}"
RESULT_VARIABLE CMD_PASS)
if (${RESULT})
Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/CMakeSPIN2DATCompiler.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(CMAKE_SPIN2DAT_COMPILER "@SPIN2CPP_COMMAND@")
set(CMAKE_SPIN2DAT_COMPILER "@CMAKE_SPIN2DAT_COMPILER@")
set(CMAKE_SPIN2DAT_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
set(CMAKE_SPIN2DAT_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
set(CMAKE_SPIN2DAT_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
Expand Down
9 changes: 2 additions & 7 deletions CMakeModules/CMakeSPIN2DATInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ set(CMAKE_SPIN2DAT_ARCHIVE_APPEND "${CMAKE_C_ARCHIVE_APPEND}")
set(CMAKE_SPIN2DAT_ARCHIVE_FINISH "${CMAKE_C_ARCHIVE_FINISH}")

set(CMAKE_SPIN2DAT_COMPILE_OBJECT
"${CMAKE_COMMAND} \
-DOBJCOPY=\"${CMAKE_OBJCOPY}\" \
-DSOURCE=<SOURCE> \
-DOUTPUT=<OBJECT> \
-DSPIN2CPP_COMMAND=${SPIN2CPP_COMMAND} \
-DPropWare_DAT_SYMBOL_CONVERTER=\"${PropWare_DAT_SYMBOL_CONVERTER}\" \
-P ${PropWare_SPIN2DAT_SYMBOL_CONVERTER}"
"${CMAKE_SPIN2DAT_COMPILER} --dat -o <OBJECT> <SOURCE>"
"${CMAKE_COMMAND} -DOBJCOPY=\"${CMAKE_OBJCOPY}\" -DSTRIP=.spin -DSOURCE=<OBJECT> -DOUTPUT=<OBJECT> -P ${PropWare_DAT_SYMBOL_CONVERTER}"
)

mark_as_advanced(
Expand Down
45 changes: 0 additions & 45 deletions CMakeModules/CMakeSpin2DatSymbolConverter.cmake

This file was deleted.

Loading

0 comments on commit 8bdc29c

Please sign in to comment.