TARGET = DRAMSys_gem5
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

# gem5 parameters:
gem5_arch = 'ARM'
gem5_variant = 'opt'
gem5_root = $$(GEM5)

systemc_home = $$(SYSTEMC_HOME)
isEmpty(systemc_home) {
    systemc_home = /opt/systemc
}
message(SystemC home is $${systemc_home})

systemc_target_arch = $$(SYSTEMC_TARGET_ARCH)
isEmpty(systemc_target_arch) {
    systemc_target_arch = linux64
}

message(SystemC target architecture is $${systemc_target_arch})

unix:!macx {
        message(Building on a GNU/Linux)
        QMAKE_RPATHDIR += $${systemc_home}/lib-$${systemc_target_arch}
        QMAKE_RPATHDIR += $${gem5_root}/build/$${gem5_arch}
        message(Linker options QMAKE_RPATHDIR is $${QMAKE_RPATHDIR})
}

DEFINES += TIXML_USE_STL
DEFINES += SC_INCLUDE_DYNAMIC_PROCESSES
DEFINES += DRAMSYS_GEM5

dramsys_disable_coverage_check = $$(DRAMSYS_DISABLE_COVERAGE_CHECK)
isEmpty(dramsys_disable_coverage_check) {
	coverage_check = true
    message(Coverage check ENABLED)
} else {
	coverage_check = false
    message(Coverage check DISABLED)
}

unix:!macx {
	QMAKE_CXXFLAGS += -std=c++11 -O0 -g
	$$eval(coverage_check) {
		QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage -fPIC -O0
		QMAKE_LFLAGS += -lgcov --coverage
	}
}

macx: {
	CONFIG += c++11
	QMAKE_CXXFLAGS += -std=c++0x -stdlib=libc++ -O0 -g
	$$eval(coverage_check) {
		QMAKE_CXXFLAGS += --coverage
		QMAKE_LFLAGS += --coverage
	}
}

INCLUDEPATH += ../library/src/simulation/
INCLUDEPATH += $${systemc_home}/include
INCLUDEPATH += ../library/src/common/third_party/DRAMPower/src
INCLUDEPATH += ../library/src/common/third_party/DRAMPower/src/libdrampower
INCLUDEPATH += $${gem5_root}/build/$${gem5_arch}/
INCLUDEPATH += $${gem5_root}/util/tlm/examples/slave_port
INCLUDEPATH += $${gem5_root}/util/tlm/examples/common
INCLUDEPATH += $${gem5_root}/util/tlm/src/
INCLUDEPATH += $${gem5_root}/util/systemc

LIBS += -L$${systemc_home}/lib-$${systemc_target_arch} -lsystemc
LIBS += ../library/libDRAMSys.a
LIBS += ../../DRAMSys/library/src/common/third_party/DRAMPower/src/libdrampower.a
LIBS += -lsqlite3
LIBS += -L$${gem5_root}/build/$${gem5_arch} -lgem5_$${gem5_variant}

SOURCES += $${gem5_root}/util/systemc/sc_gem5_control.cc
SOURCES += $${gem5_root}/util/systemc/sc_logger.cc
SOURCES += $${gem5_root}/util/systemc/sc_module.cc
SOURCES += $${gem5_root}/util/systemc/stats.cc
SOURCES += $${gem5_root}/util/tlm/examples/common/cli_parser.cc
SOURCES += $${gem5_root}/util/tlm/examples/common/report_handler.cc
SOURCES += $${gem5_root}/util/tlm/src/master_transactor.cc
SOURCES += $${gem5_root}/util/tlm/src/sc_master_port.cc
SOURCES += $${gem5_root}/util/tlm/src/sc_slave_port.cc
SOURCES += $${gem5_root}/util/tlm/src/slave_transactor.cc
SOURCES += $${gem5_root}/util/tlm/src/sc_ext.cc
SOURCES += $${gem5_root}/util/tlm/src/sc_mm.cc
SOURCES += $${gem5_root}/util/tlm/src/sim_control.cc

SOURCES += main.cpp

DISTFILES += ../DRAMSys.astylerc

DISTFILES += etrace_single/config.ini
DISTFILES += etrace_single_L2/HPCG-47MB/config.ini
DISTFILES += etrace_single_L2/Pathfinder/config.ini
DISTFILES += etrace_single_L2/hpcc-linpack/config.ini
DISTFILES += etrace_single_L2/hpcc-fft/config.ini
DISTFILES += etrace_single_L2/config.ini
DISTFILES += etrace_single_L2/hpcc-dgemm/config.ini
DISTFILES += etrace_single_L2/hpcc-gups/config.ini
DISTFILES += configs/singleElasticTraceReplayWithL2.ini
DISTFILES += configs/nvdimmp.ini
DISTFILES += configs/hello.ini
DISTFILES += configs/dualElasticTraceReplay.ini
DISTFILES += configs/singleElasticTraceReplay.ini
DISTFILES += configs/boot_linux.ini
DISTFILES += gem5_fs/stream/config.ini
DISTFILES += gem5_fs/stream/stream_1_cores.rcS
DISTFILES += gem5_fs/parsec/simmedium/fluidanimate/fluidanimate_simmedium_2.rcS
DISTFILES += gem5_fs/parsec/simmedium/fluidanimate/config.ini
DISTFILES += gem5_fs/parsec/simmedium/ferret/config.ini
DISTFILES += gem5_fs/parsec/simmedium/ferret/ferret_simmedium_2.rcS
DISTFILES += gem5_fs/parsec/simmedium/blackscholes/blackscholes_simmedium_2.rcS
DISTFILES += gem5_fs/parsec/simmedium/blackscholes/config.ini
DISTFILES += gem5_fs/parsec/simlarge/streamcluster/config.ini
DISTFILES += gem5_fs/parsec/simlarge/streamcluster/streamcluster_simlarge_2.rcS
DISTFILES += gem5_fs/parsec/simsmall/fluidanimate/fluidanimate_simsmall_2.rcS
DISTFILES += gem5_fs/parsec/simsmall/fluidanimate/config.ini
DISTFILES += gem5_fs/parsec/simsmall/bodytrack/bodytrack_simsmall_2.rcS
DISTFILES += gem5_fs/parsec/simsmall/bodytrack/config.ini
DISTFILES += gem5_fs/parsec/simsmall/ferret/config.ini
DISTFILES += gem5_fs/parsec/simsmall/ferret/ferret_simsmall_2.rcS
DISTFILES += gem5_fs/parsec/simsmall/blackscholes/config.ini
DISTFILES += gem5_fs/parsec/simsmall/blackscholes/blackscholes_simsmall_2.rcS
DISTFILES += gem5_fs/parsec/simdev/fluidanimate/config.ini
DISTFILES += gem5_fs/parsec/simdev/fluidanimate/fluidanimate_simdev_2.rcS
DISTFILES += gem5_fs/parsec/simdev/blackscholes/blackscholes_simdev_2.rcS
DISTFILES += gem5_fs/parsec/simdev/blackscholes/config.ini
DISTFILES += examples/tlm_elastic_slave.py
DISTFILES += examples/tlm_elastic_slave_mc_direct.py
DISTFILES += examples/tlm_elastic_slave_with_l2.py
DISTFILES += gem5_se/almabench/config.ini
DISTFILES += gem5_se/fldry/config.ini
DISTFILES += gem5_se/Queens/config.ini
DISTFILES += gem5_se/chomp/config.ini
DISTFILES += gem5_se/l1_cache/Queens/config.ini
DISTFILES += gem5_se/l1_cache/chomp/config.ini
DISTFILES += gem5_se/l1_cache/Puzzle/config.ini
DISTFILES += gem5_se/l1_cache/RealMM/config.ini
DISTFILES += gem5_se/l1_cache/Perm/config.ini
DISTFILES += gem5_se/l1_cache/Treesort/config.ini
DISTFILES += gem5_se/l1_cache/Bubblesort/config.ini
DISTFILES += gem5_se/l1_cache/misr/config.ini
DISTFILES += gem5_se/l1_cache/exptree/config.ini
DISTFILES += gem5_se/l1_cache/Quicksort/config.ini
DISTFILES += gem5_se/l1_cache/IntMM/config.ini
DISTFILES += gem5_se/l1_cache/Oscar/config.ini
DISTFILES += gem5_se/l1_cache/FloatMM/config.ini
DISTFILES += gem5_se/l1_cache/Towers/config.ini
DISTFILES += gem5_se/run.sh
DISTFILES += gem5_se/Puzzle/config.ini
DISTFILES += gem5_se/RealMM/config.ini
DISTFILES += gem5_se/Perm/config.ini
DISTFILES += gem5_se/Treesort/config.ini
DISTFILES += gem5_se/Bubblesort/config.ini
DISTFILES += gem5_se/misr/config.ini
DISTFILES += gem5_se/lpbench/config.ini
DISTFILES += gem5_se/8_cores/config.ini
DISTFILES += gem5_se/exptree/config.ini
DISTFILES += gem5_se/Quicksort/config.ini
DISTFILES += gem5_se/IntMM/config.ini
DISTFILES += gem5_se/Oscar/config.ini
DISTFILES += gem5_se/FloatMM/config.ini
DISTFILES += gem5_se/Towers/config.ini
