software/demo: Make hellocpp optional (only build with --with-cxx) to avoid adding g++ as a dependency for an optional feature.
This commit is contained in:
parent
31ac6659c9
commit
7e3912aaef
|
@ -3,7 +3,10 @@ BUILD_DIR?=../build/
|
|||
include $(BUILD_DIR)/software/include/generated/variables.mak
|
||||
include $(SOC_DIRECTORY)/software/common.mak
|
||||
|
||||
OBJECTS=isr.o donut.o helloc.o hellocpp.o main.o
|
||||
OBJECTS = isr.o donut.o helloc.o main.o
|
||||
ifdef WITH_CXX
|
||||
OBJECTS += hellocpp.o
|
||||
endif
|
||||
|
||||
all: demo.bin
|
||||
|
||||
|
@ -33,6 +36,7 @@ donut.o: CFLAGS += -w
|
|||
helloc.o: CFLAGS += -w
|
||||
|
||||
hellocpp.o: CXXFLAGS += -w
|
||||
|
||||
%.o: %.cpp
|
||||
$(compilexx)
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ from distutils.dir_util import copy_tree
|
|||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="LiteX Bare Metal Demo App.")
|
||||
parser.add_argument("--build-path", help="Target's build path (ex build/board_name)", required=True)
|
||||
parser.add_argument("--build-path", help="Target's build path (ex build/board_name).", required=True)
|
||||
parser.add_argument("--with-cxx", action="store_true", help="Enable CXX support.")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Create demo directory
|
||||
|
@ -24,7 +25,7 @@ def main():
|
|||
|
||||
# Compile demo
|
||||
build_path = args.build_path if os.path.isabs(args.build_path) else os.path.join("..", args.build_path)
|
||||
os.system(f"export BUILD_DIR={build_path} && cd demo && make")
|
||||
os.system(f"export BUILD_DIR={build_path} && {'export WITH_CXX=1 &&' if args.with_cxx else ''} cd demo && make")
|
||||
|
||||
# Copy demo.bin
|
||||
os.system("cp demo/demo.bin ./")
|
||||
|
|
|
@ -88,7 +88,9 @@ static void help(void)
|
|||
#endif
|
||||
puts("donut - Spinning Donut demo");
|
||||
puts("helloc - Hello C");
|
||||
#ifdef WITH_CXX
|
||||
puts("hellocpp - Hello C++");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
@ -148,6 +150,7 @@ static void helloc_cmd(void)
|
|||
helloc();
|
||||
}
|
||||
|
||||
#ifdef WITH_CXX
|
||||
extern void hellocpp(void);
|
||||
|
||||
static void hellocpp_cmd(void)
|
||||
|
@ -155,6 +158,8 @@ static void hellocpp_cmd(void)
|
|||
printf("Hello C++ demo...\n");
|
||||
hellocpp();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Console service / Main */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
@ -179,8 +184,10 @@ static void console_service(void)
|
|||
donut_cmd();
|
||||
else if(strcmp(token, "helloc") == 0)
|
||||
helloc_cmd();
|
||||
#ifdef WITH_CXX
|
||||
else if(strcmp(token, "hellocpp") == 0)
|
||||
hellocpp_cmd();
|
||||
#endif
|
||||
prompt();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue