This repository has been archived by the owner on Nov 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
100 lines (82 loc) · 3.89 KB
/
CMakeLists.txt
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 2.8)
project(SPIRVCrossj)
enable_testing()
set(default_build_type, "Release")
FIND_PACKAGE(SWIG 3.0 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
FIND_PACKAGE(JNI REQUIRED)
FIND_PACKAGE (Threads REQUIRED)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/target/classes")
if(${CMAKE_GENERATOR} MATCHES "Makefile")
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "Build out of tree to avoid overwriting Makefile")
endif()
endif()
set(SPIRVCROSS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-cross")
set(GLSLANG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/glslang")
add_subdirectory("${GLSLANG_DIR}")
set(CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/graphics/scenery/spirvcrossj")
set(CMAKE_SWIG_FLAGS -package graphics.scenery.spirvcrossj)
SET_SOURCE_FILES_PROPERTIES(libspirvcrossj.i PROPERTIES CPLUSPLUS ON)
#SET_PROPERTY(SOURCE libspirvcrossj.i PROPERTY CPLUSPLUS ON)
#FILE(GLOB GLSLANG_CODEGEN_SOURCES ${GLSLANG_DIR}/glslang/GenericCodeGen/*.cpp)
#FILE(GLOB GLSLANG_MI_SOURCES ${GLSLANG_DIR}/glslang/MachineIndependent/*.cpp)
#FILE(GLOB GLSLANG_PREPROCESSOR_SOURCES ${GLSLANG_DIR}/glslang/MachineIndependent/preprocessor/*.cpp)
#FILE(GLOB GLSLANG_HLSL_SOURCES ${GLSLANG_DIR}/hlsl/*.cpp)
#FILE(GLOB GLSLANG_SPIRV_SOURCES ${GLSLANG_DIR}/SPIRV/*.cpp)
#FILE(GLOB GLSLANG_OGLDLL_SOURCES ${GLSLANG_DIR}/OGLCompilersDLL/*.cpp)
#
#if(WIN32)
# FILE(GLOB GLSLANG_MD_SOURCES ${GLSLANG_DIR}/glslang/OSDependent/Windows/*.cpp)
#elseif(UNIX)
# FILE(GLOB GLSLANG_MD_SOURCES ${GLSLANG_DIR}/glslang/OSDependent/Unix/*.cpp)
#endif(WIN32)
SWIG_ADD_MODULE(spirvcrossj java libspirvcrossj.i
${SPIRVCROSS_DIR}/GLSL.std.450.h
${SPIRVCROSS_DIR}/spirv_cross.cpp
${SPIRVCROSS_DIR}/spirv_glsl.cpp
${SPIRVCROSS_DIR}/spirv_cross_parsed_ir.cpp
${SPIRVCROSS_DIR}/spirv_cross_util.cpp
${SPIRVCROSS_DIR}/spirv_reflect.cpp
${SPIRVCROSS_DIR}/spirv_parser.cpp
${SPIRVCROSS_DIR}/spirv_cpp.cpp
${SPIRVCROSS_DIR}/spirv_msl.cpp
${SPIRVCROSS_DIR}/spirv_cfg.cpp
${GLSLANG_DIR}/glslang/Public/ShaderLang.h
${GLSLANG_DIR}/StandAlone/ResourceLimits.h)
# ${GLSLANG_MI_SOURCES}
# ${GLSLANG_PREPROCESSOR_SOURCES}
# ${GLSLANG_CODEGEN_SOURCES}
# ${GLSLANG_MD_SOURCES}
# ${GLSLANG_SPIRV_SOURCES}
# ${GLSLANG_HLSL_SOURCES}
# ${GLSLANG_OGLDLL_SOURCES})
set(GLSLANG_LIBRARIES
glslang
SPIRV
SPVRemapper
glslang-default-resource-limits)
SWIG_LINK_LIBRARIES(spirvcrossj ${GLSLANG_LIBRARIES})
SWIG_LINK_LIBRARIES(spirvcrossj ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(spirvcrossj PUBLIC "${GLSLANG_DIR}/glslang/Include")
target_include_directories(spirvcrossj PUBLIC "${GLSLANG_DIR}/glslang/Public")
target_include_directories(spirvcrossj PUBLIC "${GLSLANG_DIR}/hlsl")
target_include_directories(spirvcrossj PUBLIC "${GLSLANG_DIR}/SPIRV")
target_include_directories(spirvcrossj PUBLIC "${GLSLANG_DIR}/OGLCompilersDLL")
target_include_directories(spirvcrossj PUBLIC "${GLSLANG_DIR}/glslang/OSDependent")
target_include_directories(spirvcrossj PUBLIC ${JNI_INCLUDE_DIRS})
target_include_directories(spirvcrossj PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-cross")
# To specify special debug or optimization options, use
# -DCMAKE_CXX_COMPILE_FLAGS
# However, we require the C++11 dialect.
if (NOT "${MSVC}")
set(spirv-compiler-options -std=gnu++11 -Wall -Wextra -pthread -Wshadow)
target_compile_options(spirvcrossj PRIVATE ${spirv-compiler-options})
set_source_files_properties( ${swig_generated_file_fullname}
PROPERTIES COMPILE_FLAGS ${spirv-compiler-options})
endif(NOT "${MSVC}")
if ("${MSVC}")
set_target_properties( spirvcrossj PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} )
set_target_properties( spirvcrossj PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set_target_properties( spirvcrossj PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
endif ( "${MSVC}" )