File: CMakeLists.txt

package info (click to toggle)
cmake 4.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 152,456 kB
  • sloc: ansic: 403,896; cpp: 303,920; sh: 4,105; python: 3,583; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 111; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (50 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download | duplicates (5)
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
cmake_minimum_required(VERSION 3.18)
project(ISPCObjectGenex CXX ISPC)

if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
  set(CMAKE_ISPC_INSTRUCTION_SETS "neon-i32x4")
  set(numberOfTargets 1)
else()
  set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
  list(LENGTH CMAKE_ISPC_INSTRUCTION_SETS numberOfTargets)
  math(EXPR numberOfTargets "${numberOfTargets}+1")
endif()

add_library(ispc_objects OBJECT
  simple.ispc
  )
target_compile_definitions(ispc_objects PRIVATE
  $<$<COMPILE_LANG_AND_ID:ISPC,Intel>:M_PI=3.1415926535f>
)
set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
  set_source_files_properties(simple.ispc PROPERTIES COMPILE_OPTIONS "--arch=x86")
endif()


#Test ObjectFiles with file(GENERATE)
file(GENERATE
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gen_$<LOWER_CASE:$<CONFIG>/>path_to_objs.h
     CONTENT [[
#ifndef path_to_objs
#define path_to_objs

#include <string>

static std::string obj_paths = "$<TARGET_OBJECTS:ispc_objects>";

#endif

]]
)


add_executable(ISPCObjectGenex main.cxx)
add_dependencies(ISPCObjectGenex ispc_objects)

target_compile_definitions(ISPCObjectGenex PRIVATE
    "ExpectedISPCObjects=${numberOfTargets}"
    "CONFIG_TYPE=gen_$<LOWER_CASE:$<CONFIG>>"
    )
target_include_directories(ISPCObjectGenex PRIVATE ${CMAKE_CURRENT_BINARY_DIR} )
target_compile_features(ISPCObjectGenex PRIVATE cxx_std_11)