TARGET = DRAMSys

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

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})

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 {
	message(Building on a GNU/Linux)
	QMAKE_RPATHDIR += $${systemc_home}/lib-$${systemc_target_arch}
	message(Linker options QMAKE_RPATHDIR is $${QMAKE_RPATHDIR})
}

DEFINES += TIXML_USE_STL
DEFINES += SC_INCLUDE_DYNAMIC_PROCESSES

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

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

PRE_TARGETDEPS += ../library/libDRAMSys.a

SOURCES += main.cpp

DISTFILES += ../DRAMSys.astylerc
