File tree Expand file tree Collapse file tree 6 files changed +21
-14
lines changed Expand file tree Collapse file tree 6 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ set(CMAKE_C_STANDARD 11)
10
10
set (CMAKE_C_STANDARD_REQUIRED ON )
11
11
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
12
12
13
+ option (BUILD_SHARED_LIBS "Build using shared libraries" ON )
14
+
13
15
if (MSVC )
14
16
add_compile_definitions (_CRT_SECURE_NO_WARNINGS )
15
17
endif ()
@@ -99,20 +101,11 @@ endif()
99
101
100
102
include (CMakePackageConfigHelpers )
101
103
102
- install (TARGETS api EXPORT shady_export_set )
103
- install (TARGETS shady EXPORT shady_export_set ARCHIVE DESTINATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} )
104
-
105
104
if (TARGET vcc )
106
105
add_subdirectory (vcc-std )
107
106
endif ()
108
107
109
- if (TARGET runtime )
110
- install (TARGETS runtime EXPORT shady_export_set ARCHIVE DESTINATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} )
111
- endif ()
112
-
113
- install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /include/shady DESTINATION include )
114
108
install (EXPORT shady_export_set DESTINATION share/cmake/shady/ NAMESPACE shady:: FILE shady-targets.cmake )
115
109
116
110
configure_file (cmake/shady-config.cmake.in shady-config.cmake @ONLY )
117
111
install (FILES "${CMAKE_CURRENT_BINARY_DIR} /shady-config.cmake" DESTINATION share/cmake/shady )
118
- #install(FILES "${CMAKE_CURRENT_BINARY_DIR}/shady-config.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/shady)
Original file line number Diff line number Diff line change 1
1
add_library (common STATIC list .c dict.c log .c portability.c util.c growy.c arena.c printer.c )
2
- target_include_directories (common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} )
3
2
target_link_libraries (common PRIVATE "$<BUILD_INTERFACE:murmur3>" )
4
3
set_property (TARGET common PROPERTY POSITION_INDEPENDENT_CODE ON )
5
4
5
+ # We need to export 'common' because otherwise when using static libraries we will not be able to resolve those symbols
6
+ install (TARGETS common EXPORT shady_export_set )
7
+
8
+ # But we don't want projects outside this to be able to see these APIs and call into them
9
+ # (Also we couldn't since the header files live with the source anyways)
10
+ add_library (common_api INTERFACE )
11
+ target_include_directories (common_api INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} )
12
+ target_link_libraries (common INTERFACE "$<BUILD_INTERFACE:common_api>" )
13
+
6
14
add_executable (embedder embed.c )
7
15
8
16
function (embed_file TYPE NAME SRC )
@@ -14,3 +22,4 @@ function(embed_file TYPE NAME SRC)
14
22
add_dependencies (${NAME} "${NAME} _h" )
15
23
target_include_directories (${NAME} INTERFACE ${CMAKE_CURRENT_BINARY_DIR} )
16
24
endfunction ()
25
+
Original file line number Diff line number Diff line change 1
1
add_library (driver driver.c cli.c )
2
- target_link_libraries (driver PUBLIC "$<BUILD_INTERFACE: api> " )
3
- target_link_libraries (driver PUBLIC "$<BUILD_INTERFACE: shady> " )
2
+ target_link_libraries (driver PUBLIC "api" )
3
+ target_link_libraries (driver PUBLIC "shady" )
4
4
set_target_properties (driver PROPERTIES OUTPUT_NAME "shady_driver" )
5
5
install (TARGETS driver EXPORT shady_export_set )
6
6
Original file line number Diff line number Diff line change @@ -7,3 +7,5 @@ add_subdirectory(cuda)
7
7
8
8
add_executable (runtime_test runtime_test.c )
9
9
target_link_libraries (runtime_test runtime )
10
+
11
+ install (TARGETS runtime EXPORT shady_export_set ARCHIVE DESTINATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} )
Original file line number Diff line number Diff line change @@ -111,6 +111,8 @@ add_subdirectory(internal)
111
111
add_subdirectory (emit )
112
112
113
113
target_link_libraries (shady PRIVATE "api" )
114
- target_link_libraries (shady INTERFACE "$<BUILD_INTERFACE:common>" )
115
- target_link_libraries (shady PRIVATE "$<BUILD_INTERFACE:SPIRV-Headers::SPIRV-Headers>" )
114
+ target_link_libraries (shady INTERFACE "common" )
116
115
target_link_libraries (shady PRIVATE "$<BUILD_INTERFACE:m>" )
116
+
117
+ install (DIRECTORY ${CMAKE_SOURCE_DIR} /include/shady DESTINATION include )
118
+ install (TARGETS shady EXPORT shady_export_set ARCHIVE DESTINATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} )
Original file line number Diff line number Diff line change @@ -11,3 +11,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grammar_generated.h DESTINATION includ
11
11
add_generated_file (FILE_NAME primops_generated.h TARGET_NAME generate-primops-headers SOURCES generator_primops.c )
12
12
add_dependencies (api INTERFACE generate-primops-headers )
13
13
install (FILES ${CMAKE_CURRENT_BINARY_DIR} /primops_generated.h DESTINATION include )
14
+ install (TARGETS api EXPORT shady_export_set )
You can’t perform that action at this time.
0 commit comments