Skip to content

Commit

Permalink
Make sure build works for Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
obhi-d committed Nov 27, 2024
1 parent acac50d commit ab051f8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,20 @@ configure_package_config_file(
INSTALL_DESTINATION cmake
)

install(TARGETS slang EXPORT SlangExportTarget)

install(
EXPORT SlangExportTarget
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION cmake
)
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
install(TARGETS slang EXPORT SlangExportTarget)
install(
EXPORT SlangExportTarget
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION cmake
)
endif()

install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION cmake
)

18 changes: 16 additions & 2 deletions cmake/SlangConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@

@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/slangTargets.cmake")
check_required_components("slang")
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
include("${CMAKE_CURRENT_LIST_DIR}/slangTargets.cmake")
check_required_components("slang")
endif()

if(@SLANG_ENABLE_SLANGC@)

find_program(SLANGC_EXECUTABLE "slangc" HINTS ENV PATH "${PACKAGE_PREFIX_DIR}/bin")

if (NOT SLANGC_EXECUTABLE)
message(STATUS "slangc executable not found; ensure it is available in your PATH.")
endif()

set(SLANG_EXECUTABLE ${SLANGC_EXECUTABLE} CACHE STRING "Path to the slangc executable")

endif()

0 comments on commit ab051f8

Please sign in to comment.