Skip to content

Commit

Permalink
Merge pull request #76 from Shturm0weak/RefactoringCMake
Browse files Browse the repository at this point in the history
Refactoring CMake
  • Loading branch information
Shturm0weak authored Jan 20, 2025
2 parents 3ca9f84 + 2db5d7a commit 24364c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions Pengine/Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ set(VULKAN_SOURCES
source_group("Vulkan" FILES ${VULKAN_SOURCES})

set(SPIRV_REFLECT_SOURCES
$ENV{SPIRV_REFLECT}/SPIRV-Reflect/spirv_reflect.c
$ENV{SPIRV_REFLECT}/SPIRV-Reflect/spirv_reflect.h
$ENV{VULKAN_SPIRV_REFLECT_PATH}/SPIRV-Reflect/spirv_reflect.c
$ENV{VULKAN_SPIRV_REFLECT_PATH}/SPIRV-Reflect/spirv_reflect.h
)
source_group("SpirvReflect" FILES ${SPIRV_REFLECT_SOURCES})

Expand Down Expand Up @@ -150,15 +150,15 @@ target_link_libraries(${PROJECT_NAME} PRIVATE YAML)
target_link_libraries(${PROJECT_NAME} PRIVATE ImGui)
target_link_libraries(${PROJECT_NAME} PRIVATE assimp)

find_library(GLFW_LIBRARY NAMES glfw glfw3 HINTS $ENV{GLFW_PATH_LIB} REQUIRED)
find_library(GLFW_LIBRARY NAMES glfw glfw3 HINTS $ENV{GLFW_LIB_PATH} REQUIRED)
if (GLFW_LIBRARY)
message(${GLFW_LIBRARY} " has been found")
target_link_libraries(${PROJECT_NAME} PRIVATE ${GLFW_LIBRARY})
else ()
message(FATAL_ERROR "GLFW library has not been found")
endif ()

find_library(VULKAN_LIBRARY NAMES vulkan vulkan-1 HINTS $ENV{VULKAN_LIB} REQUIRED)
find_library(VULKAN_LIBRARY NAMES vulkan vulkan-1 HINTS $ENV{VULKAN_LIB_PATH} REQUIRED)
if (VULKAN_LIBRARY)
message(${VULKAN_LIBRARY} " has been found")
target_link_libraries(${PROJECT_NAME} PRIVATE ${VULKAN_LIBRARY})
Expand All @@ -167,14 +167,14 @@ else ()
endif ()

if (WIN32)
find_library(SHADERC_COMBINED_R_LIBRARY NAMES shaderc_combined HINTS $ENV{VULKAN_LIB} REQUIRED)
find_library(SHADERC_COMBINED_R_LIBRARY NAMES shaderc_combined HINTS $ENV{VULKAN_LIB_PATH} REQUIRED)
if (SHADERC_COMBINED_R_LIBRARY)
message(${SHADERC_COMBINED_R_LIBRARY} " has been found")
else ()
message(FATAL_ERROR "Shaderc combined library release has not been found")
endif ()

find_library(SHADERC_COMBINED_D_LIBRARY NAMES shaderc_combinedd HINTS $ENV{VULKAN_LIB} REQUIRED)
find_library(SHADERC_COMBINED_D_LIBRARY NAMES shaderc_combinedd HINTS $ENV{VULKAN_LIB_PATH} REQUIRED)
if (SHADERC_COMBINED_D_LIBRARY)
message(${SHADERC_COMBINED_D_LIBRARY} " has been found")
else ()
Expand All @@ -183,7 +183,7 @@ if (WIN32)

target_link_libraries(${PROJECT_NAME} PRIVATE debug ${SHADERC_COMBINED_D_LIBRARY} optimized ${SHADERC_COMBINED_R_LIBRARY})
elseif (UNIX)
find_library(SHADERC_LIBRARY NAMES libshaderc_combined.a HINTS $ENV{VULKAN_LIB} REQUIRED)
find_library(SHADERC_LIBRARY NAMES libshaderc_combined.a HINTS $ENV{VULKAN_LIB_PATH} REQUIRED)
if (SHADERC_LIBRARY)
message(${SHADERC_LIBRARY} " has been found")
else ()
Expand All @@ -197,9 +197,9 @@ target_include_directories(${PROJECT_NAME} PRIVATE ../../Vendor/yaml-cpp)
target_include_directories(${PROJECT_NAME} PRIVATE ../../Vendor/imgui)
target_include_directories(${PROJECT_NAME} PRIVATE ../../Vendor/assimp/include)

target_include_directories(${PROJECT_NAME} PRIVATE $ENV{GLFW_INCLUDE})
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{VULKAN_INCLUDE})
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{SPIRV_REFLECT})
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{GLFW_INCLUDE_PATH})
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{VULKAN_INCLUDE_PATH})
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{VULKAN_SPIRV_REFLECT_PATH})

if (WIN32)
add_custom_command(TARGET ${PROJECT_NAME} PRE_LINK
Expand Down
2 changes: 1 addition & 1 deletion Vendor/imgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(${PROJECT_NAME} PRIVATE ../../Vendor/imgui)
target_include_directories(${PROJECT_NAME} PRIVATE ../../Vendor/imgui/backends)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/examples/libs/glfw/include)
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{VULKAN_INCLUDE})
target_include_directories(${PROJECT_NAME} PRIVATE $ENV{VULKAN_INCLUDE_PATH})

0 comments on commit 24364c0

Please sign in to comment.