Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bgfx_compile_shaders incorrectly generating output path, and generat quality of life update for all tool util functions #255

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ This defines a bin2c command to generate a specified `OUTPUT_FILE` header with a

Adding these `INPUT_FILE` as source files to a target will run `bin2c` at build time and they will rebuild if either the contents of the `INPUT_FILE` change.

Logs generated from compilation will be located in the `bgfx_tool_logs` directory within the build folder.

#### Examples: Generating an image as a header
```cmake
bgfx_compile_binary_to_header(
Expand Down Expand Up @@ -86,6 +88,31 @@ bgfx_compile_texture(
)
```

Logs generated from compilation will be located in the `bgfx_tool_logs` directory within the build folder.

### `bgfx_compile_geometry`
Add a build rule for a geometry to the generated build system be compiled using geometryc.
```cmake
bgfx_compile_geometry(
FILE filename
OUTPUT filename
[SCALE scale]
[CCW]
[FLIPV]
[OBB num steps]
[PACKNORMAL 0|1]
[PACKUV 0|1]
[TANGENT]
[BARYCENTRIC]
[COMPRESS]
[LH_UP_Y|LH_UP_Z|RH_UP_Y|RH_UP_Z]
)

```

Logs generated from compilation will be located in the `bgfx_tool_logs` directory within the build folder.


### `bgfx_compile_shaders`
Add a build rule for a `*.sc` shader to the generated build system using shaderc.
```cmake
Expand All @@ -103,6 +130,8 @@ The generated headers will have names in the format of `${RENDERING_API}/${SHADE

Adding these `SHADERS` as source files to a target will run `shaderc` at build time and they will rebuild if either the contents of the `SHADERS` or the `VARYING_DEF` change.

Logs generated from compilation will be located in the `bgfx_tool_logs` directory within the build folder.

#### Examples: Generating shaders as headers
```cmake
bgfx_compile_shaders(
Expand Down
101 changes: 83 additions & 18 deletions cmake/bgfxToolUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,28 @@ if(TARGET bgfx::bin2c)
OUTPUT_FILE ${ARG_OUTPUT_FILE}
ARRAY_NAME ${ARG_ARRAY_NAME}
)

get_filename_component(OUTPUT_DIR "${ARG_OUTPUT_FILE}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist
Comment on lines +59 to +60

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
get_filename_component(OUTPUT_DIR "${ARG_OUTPUT_FILE}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist
get_filename_component(OUTPUT_DIR "${ARG_OUTPUT_FILE}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bgfx_tool_logs) # create log path if it does not exist
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_INPUT_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT_FILE})
Comment on lines +62 to +63

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_INPUT_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT_FILE})
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_INPUT_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT_FILE})


string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows
Comment on lines +65 to +67

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}
)# probably need this for windows


add_custom_command(
OUTPUT ${ARG_OUTPUT_FILE} #
COMMAND bgfx::bin2c ${CLI} #
COMMAND bgfx::bin2c ${CLI} > bgfx_tool_logs/binary_to_header_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this work on windows?

COMMENT "Compiling ${INPUT_FILE_RELATIVE} as header" #
Comment on lines +71 to +72

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
COMMAND bgfx::bin2c ${CLI} > bgfx_tool_logs/binary_to_header_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE} as header" #
COMMAND bgfx::bin2c ${CLI} >
bgfx_tool_logs/binary_to_header_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE} as header" #

MAIN_DEPENDENCY ${ARG_INPUT_FILE} #
)

add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT_FILE} #
)
Comment on lines +76 to +79

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT_FILE} #
)
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT_FILE} #
)

endfunction()
endif()

Expand Down Expand Up @@ -212,11 +229,28 @@ if(TARGET bgfx::texturec)
${ARGN} #
)
_bgfx_texturec_parse(CLI ${ARGV})

get_filename_component(OUTPUT_DIR "${ARG_OUTPUT}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist
Comment on lines +233 to +234

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
get_filename_component(OUTPUT_DIR "${ARG_OUTPUT}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist
get_filename_component(OUTPUT_DIR "${ARG_OUTPUT}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bgfx_tool_logs) # create log path if it does not exist
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT})
Comment on lines +236 to +237

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT})
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT})


string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows
Comment on lines +239 to +241

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}
)# probably need this for windows


add_custom_command(
OUTPUT ${ARG_OUTPUT} #
COMMAND bgfx::texturec ${CLI} #
COMMAND bgfx::texturec ${CLI} > bgfx_tool_logs/texture_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE}" #
Comment on lines +245 to +246

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
COMMAND bgfx::texturec ${CLI} > bgfx_tool_logs/texture_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE}" #
COMMAND bgfx::texturec ${CLI} >
bgfx_tool_logs/texture_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE}" #

MAIN_DEPENDENCY ${ARG_FILE} #
)

add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT} #
)
Comment on lines +250 to +253

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT} #
)
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT} #
)

endfunction()
endif()

Expand Down Expand Up @@ -349,11 +383,28 @@ if(TARGET bgfx::geometryc)
${ARGN} #
)
_bgfx_geometryc_parse(CLI ${ARGV})

get_filename_component(OUTPUT_DIR "${ARG_OUTPUT}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist
Comment on lines +387 to +388

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
get_filename_component(OUTPUT_DIR "${ARG_OUTPUT}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist
get_filename_component(OUTPUT_DIR "${ARG_OUTPUT}" DIRECTORY)
file(MAKE_DIRECTORY ${OUTPUT_DIR}) # create output path if it does not exist

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bgfx_tool_logs) # create log path if it does not exist
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT})
Comment on lines +390 to +391

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT})
file(RELATIVE_PATH INPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_FILE})
file(RELATIVE_PATH OUTPUT_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${ARG_OUTPUT})


string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows
Comment on lines +393 to +395

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_FILE_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}
)# probably need this for windows


add_custom_command(
OUTPUT ${ARG_OUTPUT} #
COMMAND bgfx::geometryc ${CLI} #
COMMAND bgfx::geometryc ${CLI} > bgfx_tool_logs/geometry_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE}" #
Comment on lines +399 to +400

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
COMMAND bgfx::geometryc ${CLI} > bgfx_tool_logs/geometry_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE}" #
COMMAND bgfx::geometryc ${CLI} >
bgfx_tool_logs/geometry_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log #
COMMENT "Compiling ${INPUT_FILE_RELATIVE}" #

MAIN_DEPENDENCY ${ARG_FILE} #
)

add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT} #
)
Comment on lines +404 to +407

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT} #
)
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${ARG_OUTPUT} #
)

endfunction()
endif()

Expand Down Expand Up @@ -605,17 +656,19 @@ if(TARGET bgfx::shaderc)
get_filename_component(SHADER_FILE_NAME_WE ${SHADER_FILE} NAME_WE)
get_filename_component(SHADER_FILE_ABSOLUTE ${SHADER_FILE} ABSOLUTE)

file(RELATIVE_PATH SHADER_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${SHADER_FILE_ABSOLUTE})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
file(RELATIVE_PATH SHADER_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${SHADER_FILE_ABSOLUTE})
file(RELATIVE_PATH SHADER_FILE_RELATIVE ${CMAKE_BINARY_DIR} ${SHADER_FILE_ABSOLUTE})


# Build output targets and their commands
set(OUTPUTS "")
set(COMMANDS "")
set(MKDIR_COMMANDS "")
foreach(PROFILE ${PROFILES})
_bgfx_get_profile_path_ext(${PROFILE} PROFILE_PATH_EXT)
_bgfx_get_profile_ext(${PROFILE} PROFILE_EXT)
if(ARGS_AS_HEADERS)
set(HEADER_PREFIX .h)
endif()
set(OUTPUT ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT}/${SHADER_FILE_BASENAME}.bin${HEADER_PREFIX})
file(MAKE_DIRECTORY ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
file(MAKE_DIRECTORY ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT})
file(MAKE_DIRECTORY ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT})

set(PLATFORM_I ${PLATFORM})
if(PROFILE STREQUAL "spirv")
set(PLATFORM_I LINUX)
Expand All @@ -637,24 +690,36 @@ if(TARGET bgfx::shaderc)
)
list(APPEND OUTPUTS ${OUTPUT})
list(APPEND ALL_OUTPUTS ${OUTPUT})
list(
APPEND
MKDIR_COMMANDS
COMMAND
${CMAKE_COMMAND}
-E
make_directory
${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT}
)
list(APPEND COMMANDS COMMAND bgfx::shaderc ${CLI})

file(RELATIVE_PATH OUTPUT_RELATIVE ${CMAKE_BINARY_DIR} ${OUTPUT})

string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows

list(APPEND COMMANDS COMMAND bgfx::shaderc ${CLI} > bgfx_tool_logs/shader_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log)
Comment on lines +694 to +700

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
file(RELATIVE_PATH OUTPUT_RELATIVE ${CMAKE_BINARY_DIR} ${OUTPUT})
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}) # probably need this for windows
list(APPEND COMMANDS COMMAND bgfx::shaderc ${CLI} > bgfx_tool_logs/shader_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log)
file(RELATIVE_PATH OUTPUT_RELATIVE ${CMAKE_BINARY_DIR} ${OUTPUT})
string(REPLACE " " "_" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${OUTPUT_RELATIVE})
string(REPLACE "/" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH})
string(REPLACE "\\" "-" FILE_NAME_APPROPRIATE_OUTPUT_PATH ${FILE_NAME_APPROPRIATE_OUTPUT_PATH}
)# probably need this for windows
list(
APPEND
COMMANDS
COMMAND
bgfx::shaderc
${CLI}
>
bgfx_tool_logs/shader_compile_output_${FILE_NAME_APPROPRIATE_OUTPUT_PATH}.log
)

endforeach()

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bgfx_tool_logs)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bgfx_tool_logs)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bgfx_tool_logs)


# This is to prevent error if compiling as binary and header in same output path
set(TARGET_NAME "${SHADER_FILE_RELATIVE}")
if(ARGS_AS_HEADERS)
set(TARGET_NAME "${SHADER_FILE_RELATIVE} as header")
endif()
Comment on lines +705 to +709

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
# This is to prevent error if compiling as binary and header in same output path
set(TARGET_NAME "${SHADER_FILE_RELATIVE}")
if(ARGS_AS_HEADERS)
set(TARGET_NAME "${SHADER_FILE_RELATIVE} as header")
endif()
# This is to prevent error if compiling as binary and header in same output path
set(TARGET_NAME "${SHADER_FILE_RELATIVE}")
if(ARGS_AS_HEADERS)
set(TARGET_NAME "${SHADER_FILE_RELATIVE} as header")
endif()


add_custom_command(
OUTPUT ${OUTPUTS}
COMMAND ${MKDIR_COMMANDS} ${COMMANDS}
MAIN_DEPENDENCY ${SHADER_FILE_ABSOLUTE}
DEPENDS ${ARGS_VARYING_DEF}
OUTPUT ${OUTPUTS} #
COMMAND ${COMMANDS} #
MAIN_DEPENDENCY ${SHADER_FILE_ABSOLUTE} #
COMMENT "Compiling ${TARGET_NAME}" #

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
COMMENT "Compiling ${TARGET_NAME}" #
COMMENT "Compiling ${TARGET_NAME}" #

DEPENDS ${ARGS_VARYING_DEF} #
)

add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${OUTPUTS} #
)
Comment on lines +719 to +722

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cmake-format] reported by reviewdog 🐶

Suggested change
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${OUTPUTS} #
)
add_custom_target(
${FILE_NAME_APPROPRIATE_OUTPUT_PATH} ALL #
DEPENDS ${OUTPUTS} #
)

endforeach()

if(DEFINED ARGS_OUT_FILES_VAR)
Expand Down
Loading