From dcea35a1bfc12d5ff35929971cba5a48638deb85 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sat, 4 Nov 2023 01:58:40 +0100 Subject: cmake: integrate systemc build into cmake build (offer source/external integration, mainly for own cmake experiments) --- Makefile | 54 ++++++++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 360a8b9..795540f 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ ifeq ($V,1) endif SRCS = $(shell find src test -type f -name \*.h -or -name \*.cc) -BINS = $(SRCS:src/%.cc=BUILD/PLAYGROUND/%) +BINS = $(SRCS:src/%.cc=BUILD/pg-%) # -- SYSTEMC PLAYGROUND -------------------------------------------------------- -build: $(SYSTEMC_HOME)/lib/libsystemc.a BUILD/PLAYGROUND/CMakeCache.txt $(SRCS) - ninja -C BUILD/PLAYGROUND $(NINJA_FLAGS) +build: config + ninja -C BUILD $(NINJA_FLAGS) run: build @for B in $(BINS); do \ @@ -23,48 +23,38 @@ run: build $$B; \ done -run/%: $(SYSTEMC_HOME)/lib/libsystemc.a BUILD/PLAYGROUND/CMakeCache.txt src/%.cc - ninja -C BUILD/PLAYGROUND $(NINJA_FLAGS) $* - BUILD/PLAYGROUND/$* +run/%: config + ninja -C BUILD $(NINJA_FLAGS) pg-$* + BUILD/pg-$* test: build - cd BUILD/PLAYGROUND/test && ctest --output-on-failure $(CCTEST_FLAGS) + cd BUILD/test && ctest --output-on-failure $(CCTEST_FLAGS) -BUILD/PLAYGROUND/CMakeCache.txt: CMakeLists.txt - cmake -B BUILD/PLAYGROUND $@ -S . \ +config: BUILD/CMakeCache.txt cmake/CMakeLists-sysc-external.txt cmake/CMakeLists-sysc-fetch.txt +BUILD/CMakeCache.txt: CMakeLists.txt + # SystemC options: + # BUILD_SHARED_LIBS + cmake -B BUILD -S . \ -G Ninja \ -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ -DCMAKE_BUILD_TYPE=DEBUG \ - #-DCMAKE_FIND_DEBUG_MODE=ON - ln -sfn BUILD/PLAYGROUND/compile_commands.json - #ninja -C $@ -t compdb > compile_commands.json - -# -- SYSTEMC ------------------------------------------------------------------- - -$(SYSTEMC_HOME)/lib/libsystemc.a: BUILD/SYSC/CMakeCache.txt - ninja -C BUILD/SYSC install $(NINJA_FLAGS) - -BUILD/SYSC/CMakeCache.txt: systemc - cmake -B BUILD/SYSC -S systemc \ - -G Ninja \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ - -DCMAKE_BUILD_TYPE=DEBUG \ - -DCMAKE_INSTALL_PREFIX=$(SYSTEMC_HOME) \ + -DCMAKE_CXX_STANDARD=14 \ -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_CXX_STANDARD=14 - -systemc: - git clone --depth=1 https://github.com/accellera-official/systemc.git + #-DCMAKE_FIND_DEBUG_MODE=ON + ln -sfn BUILD/compile_commands.json # -- UTIL ---------------------------------------------------------------------- +targets: + ninja -C BUILD -t targets + fmt: - clang-format -i $(shell find src test -type f -name \*.h -or -name \*.cc) + clang-format -i $(SRCS) # -- CLEAN --------------------------------------------------------------------- clean: - $(RM) -r BUILD/PLAYGROUND compile_commands.json + ninja -C BUILD clean -distclean: clean - $(RM) -r BUILD $(SYSTEMC_HOME) systemc +distclean: + $(RM) -r BUILD compile_commands.json -- cgit v1.2.3