aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt12
-rw-r--r--Makefile10
-rw-r--r--test/CMakeLists.txt2
3 files changed, 12 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19e92ae..f632b41 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14)
project(systemc_playground CXX)
-set(SRC ${CMAKE_CURRENT_SOURCE_DIR}/src)
+set(src ${CMAKE_CURRENT_SOURCE_DIR}/src)
set (CMAKE_PREFIX_PATH $ENV{SYSTEMC_HOME})
find_package(SystemCLanguage CONFIG REQUIRED)
@@ -9,11 +9,11 @@ find_package(SystemCLanguage CONFIG REQUIRED)
# Set CXX std based on SystemC configuration.
set (CMAKE_CXX_STANDARD ${SystemC_CXX_STANDARD} CACHE STRING "C++ standard to build all targets.")
-foreach (X IN ITEMS event sc_export sc_export2 minimal_socket browse lt_bus)
- add_executable(${X} ${SRC}/${X}.cc)
- target_include_directories(${X} PRIVATE ${SRC})
- target_compile_options(${X} PRIVATE -Wall -Wextra)
- target_link_libraries(${X} SystemC::systemc)
+foreach (x IN ITEMS event sc_export sc_export2 minimal_socket browse lt_bus)
+ add_executable(${x} ${src}/${x}.cc)
+ target_include_directories(${x} PRIVATE ${src})
+ target_compile_options(${x} PRIVATE -Wall -Wextra)
+ target_link_libraries(${x} SystemC::systemc)
endforeach()
# Include tests.
diff --git a/Makefile b/Makefile
index 83d3544..54ac0ae 100644
--- a/Makefile
+++ b/Makefile
@@ -9,12 +9,12 @@ ifeq ($V,1)
CCTEST_FLAGS += --verbose
endif
-SRCS = $(wildcard src/*.cc)
+SRCS = $(shell find src test -type f -name \*.h -or -name \*.cc)
BINS = $(SRCS:src/%.cc=BUILD/PLAYGROUND/%)
# -- SYSTEMC PLAYGROUND --------------------------------------------------------
-build: INSTALL/lib/libsystemc.a BUILD/PLAYGROUND/CMakeCache.txt $(SRCS)
+build: $(SYSTEMC_HOME)/lib/libsystemc.a BUILD/PLAYGROUND/CMakeCache.txt $(SRCS)
ninja -C BUILD/PLAYGROUND $(NINJA_FLAGS)
run: build
@@ -37,7 +37,7 @@ BUILD/PLAYGROUND/CMakeCache.txt: CMakeLists.txt
# -- SYSTEMC -------------------------------------------------------------------
-INSTALL/lib/libsystemc.a: BUILD/SYSC/CMakeCache.txt
+$(SYSTEMC_HOME)/lib/libsystemc.a: BUILD/SYSC/CMakeCache.txt
ninja -C BUILD/SYSC install $(NINJA_FLAGS)
BUILD/SYSC/CMakeCache.txt: systemc
@@ -45,7 +45,7 @@ BUILD/SYSC/CMakeCache.txt: systemc
-G Ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE=DEBUG \
- -DCMAKE_INSTALL_PREFIX=$(PWD)/INSTALL \
+ -DCMAKE_INSTALL_PREFIX=$(SYSTEMC_HOME) \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_STANDARD=14
@@ -63,4 +63,4 @@ clean:
$(RM) -r BUILD/PLAYGROUND compile_commands.json
distclean: clean
- $(RM) -r BUILD INSTALL systemc
+ $(RM) -r BUILD $(SYSTEMC_HOME) systemc
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 714e18a..1d6b55c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -17,7 +17,7 @@ include(GoogleTest)
macro(test_int name kind)
set(target test-${name})
add_executable(${target} ${name}.cc)
- target_include_directories(${target} PRIVATE ${SRC})
+ target_include_directories(${target} PRIVATE ${src})
target_compile_options(${target} PRIVATE -Wall -Wextra)
if(${kind} STREQUAL "gtest")
target_link_libraries(${target} GTest::gmock_main)