Got rid of empty.c and empty program.o manipulations.

This commit is contained in:
Alexander Gorshenev
2018-02-26 15:05:09 +03:00
committed by alexander-gorshenev
parent ac6c3443eb
commit d285a45159
3 changed files with 16 additions and 14 deletions
+11 -2
View File
@@ -3,8 +3,17 @@ project(NONE)
add_library(libsupcpp STATIC IMPORTED)
set_property(TARGET libsupcpp PROPERTY IMPORTED_LOCATION $ENV{GCCARMEMB_TOOLCHAIN_PATH}/arm-none-eabi/lib/thumb/libsupc++.a )
set_property(TARGET libsupcpp PROPERTY IMPORTED_LOCATION $ENV{GCCARMEMB_TOOLCHAIN_PATH}/arm-none-eabi/lib/thumb/libsupc++.a)
target_link_libraries(app libsupcpp)
target_sources(app PRIVATE src/empty.c build/program.o )
set_property(TARGET app PROPERTY LINKER_LANGUAGE C)
target_sources(app PRIVATE build/program.o)
set_source_files_properties(program.o PROPERTIES EXTERNAL_OBJECT true GENERATED true)
add_custom_command(
OUTPUT program.o
COMMAND cp kotlin/program.o program.o
)
+5 -10
View File
@@ -28,28 +28,23 @@ mkdir -p $DIR/build && cd $DIR/build
export ZEPHYR_GCC_VARIANT=gccarmemb
export GCCARMEMB_TOOLCHAIN_PATH=$GCC_ARM
# This is a kind of forward declaration for `program.o`. See below.
touch program.o
[ -f CMakeCache.txt ] || cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBOARD=$BOARD .. || exit 1
# We need generated headers to be consumed by `cinterop`,
# so we preconfigure the project with `make zephyr`.
make zephyr
. $DIR/c_interop/platforms/$BOARD.sh
# We need generated headers to be consumed by `cinterop`,
# so we preconfigure the project with `make zephyr`.
# But `program.o` should exist at that stage to be detected by the configuration tools.
# So we create an empty `program.o` above, and then override it with the compiler result below.
# TODO: do something with this mess.
rm -f program.o
mkdir -p $DIR/build/kotlin
konanc $DIR/src/main.kt \
-target zephyr_$BOARD \
-r $DIR/c_interop/platforms/build \
-l $BOARD \
-opt -g -o program || exit 1
-opt -g -o $DIR/build/kotlin/program || exit 1
make || exit 1
-2
View File
@@ -1,2 +0,0 @@
// This is a placeholder empty C file.
// It is needed for Zephyr to detect the project as C project.