-
Notifications
You must be signed in to change notification settings - Fork 53
/
ISPC.cmake
67 lines (59 loc) · 1.94 KB
/
ISPC.cmake
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
61
62
63
64
65
66
67
set(ISPC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source/thirdparty/bc7_compressor/ISPCTextureCompressor/ispc)
set(ISPC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/ispc_build)
set(TEXCOMP_DIR ${ISPC_SOURCE_DIR}/ispc_texcomp)
set(ISPC_FLAGS -O2 -woff --arch=x86-64 --target=sse2,avx --opt=fast-math --pic)
if(APPLE)
set(ISPC_EXEC "ispc_osx")
elseif(LINUX)
set(ISPC_EXEC "ispc_linux")
endif()
add_custom_command(
OUTPUT
${ISPC_BUILD_DIR}/kernel_astc_ispc.o
${ISPC_BUILD_DIR}/kernel_astc_ispc_sse2.o
${ISPC_BUILD_DIR}/kernel_astc_ispc_avx.o
${ISPC_BUILD_DIR}/kernel_astc_ispc.h
COMMAND
mkdir -p ${ISPC_BUILD_DIR} &&
${ISPC_SOURCE_DIR}/${ISPC_EXEC} ${ISPC_FLAGS} -o ${ISPC_BUILD_DIR}/kernel_astc_ispc.o
-h ${ISPC_BUILD_DIR}/kernel_astc_ispc.h ${TEXCOMP_DIR}/kernel_astc.ispc
DEPENDS
${TEXCOMP_DIR}/kernel_astc.ispc
)
add_custom_command(
OUTPUT
${ISPC_BUILD_DIR}/kernel_ispc.o
${ISPC_BUILD_DIR}/kernel_ispc_sse2.o
${ISPC_BUILD_DIR}/kernel_ispc_avx.o
${ISPC_BUILD_DIR}/kernel_ispc.h
COMMAND
mkdir -p ${ISPC_BUILD_DIR} &&
${ISPC_SOURCE_DIR}/${ISPC_EXEC} ${ISPC_FLAGS} -o ${ISPC_BUILD_DIR}/kernel_ispc.o
-h ${ISPC_BUILD_DIR}/kernel_ispc.h ${TEXCOMP_DIR}/kernel.ispc
DEPENDS
${TEXCOMP_DIR}/kernel.ispc
)
add_library(
ispc_pre OBJECT
${TEXCOMP_DIR}/ispc_texcomp.cpp
${TEXCOMP_DIR}/ispc_texcomp_astc.cpp
${ISPC_BUILD_DIR}/kernel_astc_ispc.h
${ISPC_BUILD_DIR}/kernel_ispc.h
)
target_include_directories(
ispc_pre PRIVATE
${ISPC_BUILD_DIR}
)
set_target_properties(ispc_pre PROPERTIES COMPILE_FLAGS "-w")
add_library(
ispc_texcomp SHARED
${TEXCOMP_DIR}/ispc_texcomp.h
$<TARGET_OBJECTS:ispc_pre>
${ISPC_BUILD_DIR}/kernel_astc_ispc.o
${ISPC_BUILD_DIR}/kernel_astc_ispc_sse2.o
${ISPC_BUILD_DIR}/kernel_astc_ispc_avx.o
${ISPC_BUILD_DIR}/kernel_ispc.o
${ISPC_BUILD_DIR}/kernel_ispc_sse2.o
${ISPC_BUILD_DIR}/kernel_ispc_avx.o
)
set_target_properties(ispc_texcomp PROPERTIES COMPILE_FLAGS "-w")