Made code possible to compile on linux

This commit is contained in:
Dawid Pietrykowski 2023-06-04 18:28:46 +02:00
parent 6e2257ceb1
commit 3b861fb1d2
10 changed files with 94 additions and 41 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "ComputeEngine"] [submodule "ComputeEngine"]
path = ComputeEngine path = ComputeEngine
url = https://git.dawidpietrykowski.com/Personal/ComputeEngine.git url = ssh://git@git.dawidpietrykowski.com:1025/Personal/ComputeEngine.git

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

2
.idea/GPURayTracer.iml generated Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

4
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/GPURayTracer.iml" filepath="$PROJECT_DIR$/.idea/GPURayTracer.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -56,33 +56,35 @@ set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
find_path(GLFW_INCLUDE_DIR GLFW/glfw3.h #find_path(GLFW_INCLUDE_DIR GLFW/glfw3.h
HINTS #HINTS
${CMAKE_CURRENT_SOURCE_DIR}/include #${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib #${CMAKE_CURRENT_SOURCE_DIR}/lib
${GLFW_ROOT} #${GLFW_ROOT}
${GLFW_ROOT}/include) #${GLFW_ROOT}/include)
#
#if(GLFW_INCLUDE_DIR)
#message(STATUS "GLFW_INCLUDE_DIR: ${GLFW_INCLUDE_DIR}")
#else()
#message(FATAL_ERROR "glfw3.h not found")
#endif()
#
#find_path(GLFW_LIB_DIR glfw3.lib
#HINTS
#${CMAKE_CURRENT_SOURCE_DIR}/include
#${CMAKE_CURRENT_SOURCE_DIR}/lib
#${GLFW_ROOT}/lib
#${GLFW_ROOT}/lib-vc2019
#${GLFW_ROOT}/lib-vc2017
#${GLFW_ROOT}/lib-vc2015)
#
#if(GLFW_LIB_DIR)
#message(STATUS "GLFW_LIB_DIR: ${GLFW_LIB_DIR}")
#else()
#message(FATAL_ERROR "glfw3.lib not found")
#endif()
if(GLFW_INCLUDE_DIR) find_package(glfw3 REQUIRED)
message(STATUS "GLFW_INCLUDE_DIR: ${GLFW_INCLUDE_DIR}")
else()
message(FATAL_ERROR "glfw3.h not found")
endif()
find_path(GLFW_LIB_DIR glfw3.lib
HINTS
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib
${GLFW_ROOT}/lib
${GLFW_ROOT}/lib-vc2019
${GLFW_ROOT}/lib-vc2017
${GLFW_ROOT}/lib-vc2015)
if(GLFW_LIB_DIR)
message(STATUS "GLFW_LIB_DIR: ${GLFW_LIB_DIR}")
else()
message(FATAL_ERROR "glfw3.lib not found")
endif()
# Find GLEW # Find GLEW
@ -105,13 +107,17 @@ endif()
# Find stb_image # Find stb_image
find_path(stb_image_INCLUDE_DIR stb_image.h find_path(stb_image_INCLUDE_DIR include/stb_image.h
HINTS HINTS
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include/stb ${CMAKE_CURRENT_SOURCE_DIR}/include/stb
${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}
"/usr/include/stb"
${stb_image_ROOT}) ${stb_image_ROOT})
#find_package(glfw3 REQUIRED)
if(stb_image_INCLUDE_DIR) if(stb_image_INCLUDE_DIR)
message(STATUS "stb_image_INCLUDE_DIR: ${stb_image_INCLUDE_DIR}") message(STATUS "stb_image_INCLUDE_DIR: ${stb_image_INCLUDE_DIR}")
else() else()
@ -120,7 +126,10 @@ endif()
# Find ComputeEngine # Find ComputeEngine
find_path(ComputeEngine_LIB_DIR ComputeEngine.lib find_path(ComputeEngine_LIB_DIR
NAMES
ComputeEngine.lib
libComputeEngine.a
HINTS HINTS
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/lib
@ -128,7 +137,11 @@ ${ComputeEngine_ROOT}
${ComputeEngine_ROOT}/lib ${ComputeEngine_ROOT}/lib
${ComputeEngine_ROOT}/lib/Release ${ComputeEngine_ROOT}/lib/Release
${ComputeEngine_ROOT}/build/lib ${ComputeEngine_ROOT}/build/lib
${ComputeEngine_ROOT}/build/lib/Release) ${ComputeEngine_ROOT}/build/lib/Release
ComputeEngine/lib
ComputeEngine/lib/Release
ComputeEngine/build/lib
ComputeEngine/build/lib/Release)
if(ComputeEngine_LIB_DIR) if(ComputeEngine_LIB_DIR)
message(STATUS "ComputeEngine_LIB_DIR: ${ComputeEngine_LIB_DIR}") message(STATUS "ComputeEngine_LIB_DIR: ${ComputeEngine_LIB_DIR}")
@ -138,6 +151,7 @@ endif()
find_path(ComputeEngine_INCLUDE_DIR ComputeEngine.h find_path(ComputeEngine_INCLUDE_DIR ComputeEngine.h
HINTS HINTS
${CMAKE_CURRENT_SOURCE_DIR}/ComputeEngine/src
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/lib
${ComputeEngine_ROOT} ${ComputeEngine_ROOT}
@ -150,19 +164,25 @@ else()
message(FATAL_ERROR "ComputeEngine.h not found") message(FATAL_ERROR "ComputeEngine.h not found")
endif() endif()
message(STATUS "GLFW_INCLUDE_DIR: ${GLFW_INCLUDE_DIR}")
message(STATUS "OPENGL_INCLUDE_DIR: ${OPENGL_INCLUDE_DIR}")
message(STATUS "stb_image_INCLUDE_DIR: ${stb_image_INCLUDE_DIR}")
message(STATUS "GLEW_INCLUDE_DIR: ${GLEW_INCLUDE_DIR}")
message(STATUS "ComputeEngine_INCLUDE_DIR: ${ComputeEngine_INCLUDE_DIR}")
# Add source # Add source
add_subdirectory(src) add_subdirectory(src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src
${GLFW_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${stb_image_INCLUDE_DIR} ${stb_image_INCLUDE_DIR}
${ComputeEngine_INCLUDE_DIR} ${ComputeEngine_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}) ${ComputeEngine_INCLUDE_DIRS}
${GLEW_INCLUDE_DIR}
${GLEW_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PUBLIC ${GLFW_LIB_DIR} ${GLEW_LIBRARIES} ${ComputeEngine_LIB_DIR}) target_link_directories(${PROJECT_NAME} PUBLIC ${GLFW_LIB_DIR} ${GLEW_LIBRARIES} ${ComputeEngine_LIB_DIR} ${ComputeEngine_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} "glfw3.lib" "opengl32.lib" "glew32s.lib" "ComputeEngine.lib") target_link_libraries(${PROJECT_NAME} glfw OpenGL::GL GLEW::GLEW ComputeEngine)
# Copy shaders, assets and configs for binaries to access # Copy shaders, assets and configs for binaries to access
file(COPY shaders DESTINATION ${CMAKE_BINARY_DIR}/Release) file(COPY shaders DESTINATION ${CMAKE_BINARY_DIR}/Release)

@ -1 +1 @@
Subproject commit c89dda21e209cd8284d44f27a666aeab2c3db096 Subproject commit 133701c4174c00b869988bdc8b21234dc6d5e718

1
build.nu Executable file
View File

@ -0,0 +1 @@
rm -rf cmake-build-debug try return 0 ; rm -fr build try return 0 ; cmake -B build -S . ; cmake --build build --config Release

View File

@ -1,3 +1,7 @@
#ifndef _WIN32
#include <sys/stat.h>
#endif
#include "Utils.h" #include "Utils.h"
float GetRand() { float GetRand() {