summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 64fd73f4409858038f2c6c3ab200737a73a88f2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
# Project configuration
#

cmake_minimum_required(VERSION 2.6)
project(pChase)

SET(CMAKE_BUILD_TYPE "Release")

option(CROSS_32BIT "Cross-build a 32-bit binary on a 64-bit system" OFF)
if (CROSS_32BIT)
	message(STATUS "NOTICE: building a 32-bit binary")
	add_definitions(-m32)
	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
	set(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -m32")
	set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -m32")
endif ()

set (pChase_VERSION_MAJOR 0)
set (pChase_VERSION_MINOR 4)

find_package(Threads)

find_library(LIBNUMA numa)
option(USE_LIBNUMA "Build against NUMA libraries" ON) 

include_directories(lib)
add_subdirectory(lib/AsmJit)


#
# Code compilation
#

add_library(experiment src/experiment.h src/experiment.cpp)

add_library(thread src/thread.h src/thread.cpp)

add_library(lock src/lock.h src/lock.cpp)

add_library(output src/output.h src/output.cpp)

add_library(run src/run.h src/run.cpp)
target_link_libraries(run lock thread)

add_library(spinbarrier src/spinbarrier.h src/spinbarrier.cpp)

add_library(timer src/timer.h src/timer.cpp)

add_executable (chase src/main.cpp)
target_link_libraries(chase run timer output experiment spinbarrier)
target_link_libraries(chase ${CMAKE_THREAD_LIBS_INIT})
if (USE_LIBNUMA)
	if(LIBNUMA)
		target_link_libraries(pChase ${LIBNUMA})
	else ()
		message(STATUS "WARNING: libnuma not found, not compiling against it")
	endif ()
endif ()
target_link_libraries(chase AsmJit)