blob: 935c3b3f8d4500529e59c3ef1012852cbb8fa1d3 (
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
|
cmake_minimum_required(VERSION 3.10)
project(extent-sampling VERSION 0.1.0)
find_package(GSL REQUIRED)
find_program(SC NAMES sc REQUIRED)
find_program(INDENT NAMES indent)
# Generate C source files from SC source files, and optionally indent
# them.
file(GLOB SC_SOURCES "src/*.sc")
foreach(sc_source ${SC_SOURCES})
get_filename_component(source_basename ${sc_source} NAME_WE)
set(c_file ${source_basename}.c)
if(${INDENT} STREQUAL INDENT-NOTFOUND)
add_custom_command(
OUTPUT ${c_file}
COMMAND ${SC} ${sc_source} ${c_file}
DEPENDS ${sc_source} src/macros/macros.sc
VERBATIM)
else()
add_custom_command(
OUTPUT ${c_file}
COMMAND ${SC} ${sc_source} ${c_file}
COMMAND ${INDENT} ${c_file}
DEPENDS ${sc_source} src/macros/macros.sc
VERBATIM)
endif()
list(APPEND C_SOURCES ${c_file})
endforeach()
include_directories("include")
include(GNUInstallDirs)
add_library(extentsampling SHARED ${C_SOURCES})
set_target_properties(extentsampling PROPERTIES
PUBLIC_HEADER "include/extent-sampling.h;include/gaussian-nd-random.h;include/nd-random.h;include/oracles.h")
install(TARGETS extentsampling LIBRARY
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/extent-sampling)
|