Skip to content

Commit

Permalink
Moved to a codal.py based build, merging bootstrap directly into codal
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVidler committed Feb 5, 2023
1 parent db75902 commit 90812ba
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ foreach(var ${device})
string(REGEX MATCH "[^device\.cmake_definitions\.]([A-Z,a-z,0-9,_,]+)" CODAL_CMAKE_DEFINITION "${var}")

set(${CODAL_CMAKE_DEFINITION} ${${var}})
endforeach()
endforeach()

#define any additional symbols specified by the target.
if("${device.definitions}" STRGREATER "")
Expand Down Expand Up @@ -183,12 +183,12 @@ if("${CODAL_DEFINITIONS}" STRGREATER "")
file(WRITE "${EXTRA_INCLUDES_NEW_PATH}" ${CODAL_DEFINITIONS})
configure_file(${EXTRA_INCLUDES_NEW_PATH} ${EXTRA_INCLUDES_PATH} COPYONLY)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include \"${EXTRA_INCLUDES_PATH}\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${EXTRA_INCLUDES_PATH}\"")

This comment has been minimized.

Copy link
@carlosperate

carlosperate Feb 6, 2023

Contributor

I'm not sure how the merge was done, so maybe this is reverted somewhere else, but I removing the \" here is reverting changes needed for Windows paths with spaces in them.

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${EXTRA_INCLUDES_PATH}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${EXTRA_INCLUDES_PATH}")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I\"${PLATFORM_INCLUDES_PATH}\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I\"${PLATFORM_INCLUDES_PATH}\"")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PLATFORM_INCLUDES_PATH}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${PLATFORM_INCLUDES_PATH}")

# a define for cmake if statements to detect if within the CODAL build environment
set(CODAL_BUILD_SYSTEM TRUE)
Expand Down Expand Up @@ -221,8 +221,10 @@ if("${device.libraries}" STRGREATER "")
MESSAGE (STATUS "Override branch: ${BRANCH}")
endif()

INSTALL_DEPENDENCY(${LIB_DEST} ${device.libraries_${i}.name} ${URL} ${BRANCH} ${device.libraries_${i}.type})
list(APPEND CODAL_DEPS "${device.libraries_${i}.name}")
if( NOT "${device.libraries_${i}.name}" STREQUAL "codal" )
INSTALL_DEPENDENCY(${LIB_DEST} ${device.libraries_${i}.name} ${URL} ${BRANCH} ${device.libraries_${i}.type})
list(APPEND CODAL_DEPS "${device.libraries_${i}.name}")
endif()
endforeach()
endif()

Expand All @@ -242,8 +244,10 @@ if("${codal.libraries}" STRGREATER "")
MESSAGE (STATUS "Override branch: ${BRANCH}")
endif()

INSTALL_DEPENDENCY(${LIB_DEST} ${codal.libraries_${i}.name} ${URL} ${BRANCH} ${codal.libraries_${i}.type})
list(APPEND CODAL_DEPS "${codal.libraries_${i}.name}")
if( NOT "${codal.libraries_${i}.name}" STREQUAL "codal" )
INSTALL_DEPENDENCY(${LIB_DEST} ${codal.libraries_${i}.name} ${URL} ${BRANCH} ${codal.libraries_${i}.type})
list(APPEND CODAL_DEPS "${codal.libraries_${i}.name}")
endif()
endforeach()
endif()

Expand Down
21 changes: 18 additions & 3 deletions codal.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,27 @@
"test_ignore": true,
"dev": true
},
"config":{
"libraries": [
{
"name": "codal",
"url": "https://github.com/lancaster-university/codal",
"branch": "feature/bootstrap-refactor",
"type": "git"
},
{
"url": "https://github.com/JohnVidler/codal-field-testing.git",
"name": "codal-field-testing",
"branch": "Master",
"type": "git"
}
],
"config": {
"DEVICE_DMESG": 1,
"DMESG_SERIAL_DEBUG": 1,
"CODAL_DEBUG": 1,
"MICROBIT_BLE_ENABLED" : 0,
"DEVICE_BLE": 0,
"MICROBIT_BLE_ENABLED": 0,
"MICROBIT_BLE_PAIRING_MODE": 0,
"CONFIG_MICROBIT_ERASE_USER_DATA_ON_REFLASH": 1
}
}
}
15 changes: 7 additions & 8 deletions build.py → codal.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@
from importlib import import_module
from genericpath import exists

BOOTSTRAP_TAG = "main"
BOOTSTRAP_TAG = "feature/bootstrap-refactor"
TARGET_LIST = [
"https://raw.githubusercontent.com/lancaster-university/codal/master/utils/targets.json"
]
BASE_ROOT = os.getcwd()
BOOTSTRAP_ROOT = os.path.join( BASE_ROOT, 'libraries', 'codal-bootstrap' )
CODAL_ROOT = os.path.join( BASE_ROOT, 'libraries', 'codal' )

# Minimum folder structure:
if not exists( os.path.join( BASE_ROOT, 'libraries' ) ):
os.mkdir( os.path.join( BASE_ROOT, 'libraries' ) );

# Grab the latest library
if not exists( os.path.join( BASE_ROOT, 'libraries', 'codal-bootstrap' ) ):
if not exists( os.path.join( BASE_ROOT, 'libraries', 'codal' ) ):
print( "Downloading codal-bootstrap..." )
if not exists( os.path.join( BOOTSTRAP_ROOT, '.git' ) ):
os.system( f'git clone --recurse-submodules --branch "{BOOTSTRAP_TAG}" "https://github.com/lancaster-university/codal-bootstrap.git" "{BOOTSTRAP_ROOT}"' )
if not exists( os.path.join( CODAL_ROOT, '.git' ) ):
os.system( f'git clone --recurse-submodules --branch "{BOOTSTRAP_TAG}" "https://github.com/lancaster-university/codal.git" "{CODAL_ROOT}"' )

# Jump into the current upstream code
sys.path.append( BOOTSTRAP_ROOT )
bootstrap = import_module( f'libraries.codal-bootstrap.bootstrap' )
bootstrap.go_bootstrap( TARGET_LIST )
sys.path.append( CODAL_ROOT )
import_module( f'libraries.codal.codal' )

0 comments on commit 90812ba

Please sign in to comment.