Compare commits

..

1 Commits

Author SHA1 Message Date
DawidPietrykowski
d84a7a93da WIP Static libraries on windows 2023-06-05 00:21:47 +02:00
2 changed files with 54 additions and 7 deletions

View File

@ -55,13 +55,51 @@ set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
find_package(glfw3 REQUIRED)
#find_path(GLFW_INCLUDE_DIR GLFW/glfw3.h
#HINTS
#${CMAKE_CURRENT_SOURCE_DIR}/include
#${CMAKE_CURRENT_SOURCE_DIR}/lib
#${GLFW_ROOT}
#${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()
find_package(glfw3 CONFIG REQUIRED)
# Find GLEW
# unset (GLEW_USE_STATIC_LIBS CACHE)
# unset (GLEW_LIBRARIES CACHE)
# set(GLEW_USE_STATIC_LIBS TRUE)
# set(GLEW_VERBOSE TRUE)
# SET(GLEW_DIR "C:\\Desktop\\git\\vcpkg\\downloads\\tools\\cmake-3.25.1-windows\\cmake-3.25.1-windows-i386\\share\\cmake-3.25\\Modules")
set(VCPKG_TARGET_TRIPLET x64-windows-static)
find_package(GLEW REQUIRED)
set(VCPKG_TARGET_TRIPLET x64-windows)
if(GLEW_FOUND)
set(GLEW_INCLUDE_DIR ${GLEW_INCLUDE_DIRS})
#get_filename_component(GLEW_LIBRARIES ${GLEW_LIBRARIES} DIRECTORY)
message(STATUS "GLEW_INCLUDE_DIR: ${GLEW_INCLUDE_DIR}")
message(STATUS "GLEW_LIBRARIES: ${GLEW_LIBRARIES}")
else()
@ -74,8 +112,18 @@ if(NOT WIN32)
endif()
# Find stb_image
find_package(Stb REQUIRED)
#find_path(stb_image_INCLUDE_DIR stb_image.h
# HINTS
# ${CMAKE_CURRENT_SOURCE_DIR}/include
# ${CMAKE_CURRENT_SOURCE_DIR}/include/stb
# ${CMAKE_CURRENT_SOURCE_DIR}/lib
# ${CMAKE_CURRENT_SOURCE_DIR}
# "/usr/include/stb"
# ${stb_image_ROOT})
if(Stb_INCLUDE_DIR)
message(STATUS "Stb_INCLUDE_DIR: ${Stb_INCLUDE_DIR}")
else()
@ -92,11 +140,12 @@ ${GLEW_INCLUDE_DIR})
target_link_directories(${PROJECT_NAME} PUBLIC ${GLFW_LIB_DIR} ${GLEW_LIBRARIES})
if(WIN32)
target_link_libraries(${PROJECT_NAME} glfw GLEW::GLEW)
target_link_libraries(${PROJECT_NAME} glfw GLEW::glew_s)
else()
target_link_libraries(${PROJECT_NAME} glfw OpenGL::GL GLEW::GLEW)
target_link_libraries(${PROJECT_NAME} glfw OpenGL::GL GLEW::glew_s)
endif()
# Header files
file(COPY src/ComputeEngine.h DESTINATION ${CMAKE_BINARY_DIR}/include)
file(COPY src/Timer.h DESTINATION ${CMAKE_BINARY_DIR}/include)

View File

@ -1,8 +1,6 @@
@echo off
set GLFW_ROOT=
set GLEW_ROOT=
set stb_image_ROOT=
set vcpkg_ROOT=C:\Desktop\git\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake -B build -S . -DGLFW_ROOT=%GLFW_ROOT% -DGLEW_ROOT=%GLEW_ROOT% -Dstb_image_ROOT=%stb_image_ROOT%
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=%vcpkg_ROOT% -DGLEW_VERBOSE=TRUE -DGLEW_USE_STATIC_LIBS=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static
cmake --build build --config Release