Skip to content

Commit

Permalink
(#9556) [diligent-core] package file2string tool
Browse files Browse the repository at this point in the history
* package file2string tool

* add test for file2string

* export FILE2STRING_PATH variable

* add .exe file extension on windows

* Apply suggestions from code review

Co-authored-by: ericLemanissier <[email protected]>

* Update recipes/diligent-core/all/conanfile.py

Co-authored-by: SpaceIm <[email protected]>

* Update recipes/diligent-core/all/conanfile.py

Co-authored-by: ericLemanissier <[email protected]>

* Update recipes/diligent-core/all/conanfile.py

Co-authored-by: ericLemanissier <[email protected]>

Co-authored-by: ericLemanissier <[email protected]>
Co-authored-by: SpaceIm <[email protected]>
  • Loading branch information
3 people authored Mar 7, 2022
1 parent d8bb4ad commit c23140c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/diligent-core/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ def package(self):
self.copy(pattern="*.dylib", dst="lib", keep_path=False)
self.copy(pattern="*.so", dst="lib", keep_path=False)
self.copy(pattern="*.dll", dst="bin", keep_path=False)
self.copy(pattern="*.fxh", dst="res", keep_path=False)

self.copy("File2String*", src=os.path.join(self._build_subfolder, "bin"), dst="bin", keep_path=False)
tools.remove_files_by_mask(self.package_folder, "*.pdb")

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
Expand Down
15 changes: 15 additions & 0 deletions recipes/diligent-core/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

if(WIN32)
set(FILE2STRING_PATH "${CONAN_BIN_DIRS_DILIGENT-CORE}/File2String.exe")
else()
set(FILE2STRING_PATH "${CONAN_BIN_DIRS_DILIGENT-CORE}/File2String")
endif()

set(FILE "${CONAN_RES_DIRS_DILIGENT}/HLSLDefinitions.fxh")
set(CONVERTED_FILE "${PROJECT_BINARY_DIR}/HLSLDefinitions.h")

add_custom_command(OUTPUT ${CONVERTED_FILE}
COMMAND ${FILE2STRING_PATH} ${FILE} ${CONVERTED_FILE}
MAIN_DEPENDENCY ${FILE} # the primary input source file to the command
COMMENT "Processing shader ${FILE}"
VERBATIM)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)

0 comments on commit c23140c

Please sign in to comment.