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

Linux and GLFW fixes #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ set (CMAKE_DEBUG_POSTFIX "_d")

find_package(OpenGL REQUIRED)

if (UNIX)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -std=c++11)
endif()

set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(lib/glfw)

if(WIN32)
set(COMMON_LIBS vermilion ${OPENGL_LIBRARIES} optimized glfw3 debug glfw3_d)
set(COMMON_LIBS vermilion ${OPENGL_LIBRARIES} glfw ${GLFW_LIBRARIES})
elseif (UNIX)
set(COMMON_LIBS vermilion ${OPENGL_LIBRARIES} glfw ${GLFW_LIBRARIES} GL rt dl)
set(COMMON_LIBS vermilion ${OPENGL_LIBRARIES} glfw ${GLFW_LIBRARIES} rt ${CMAKE_DL_LIBS})
else()
set(COMMON_LIBS vermilion)
endif()
Expand Down Expand Up @@ -101,7 +110,5 @@ ENDIF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
include_directories( include )
include_directories(lib/glfw/include)

add_subdirectory(lib/glfw)

ADD_CUSTOM_TARGET(debug ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE:STRING=Debug ${PROJECT_SOURCE_DIR})
ADD_CUSTOM_TARGET(release ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE:STRING=Release ${PROJECT_SOURCE_DIR})
6 changes: 0 additions & 6 deletions include/vapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ class VermilionApplication
static VermilionApplication * s_app;
GLFWwindow* m_pWindow;

#ifdef _WIN32
ULONGLONG m_appStartTime;
#else
struct timeval m_appStartTime;
#endif

static void window_size_callback(GLFWwindow* window, int width, int height);
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
static void char_callback(GLFWwindow* window, unsigned int codepoint);
Expand Down
4 changes: 3 additions & 1 deletion include/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

#ifdef WIN32
# define _USE_MATH_DEFINES 1
# include <math.h>
#else
# include <cmath>
#endif

#include <math.h>
#include <iostream>

const float DegreesToRadians = static_cast<float>(M_PI / 180.0f);
Expand Down
1 change: 1 addition & 0 deletions lib/LoadShaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//////////////////////////////////////////////////////////////////////////////

#include <cstdlib>
#include <cstdio>
#include <iostream>

#include <GL3/gl3w.h>
Expand Down
16 changes: 0 additions & 16 deletions lib/glfw/CMake/modules/FindEGL.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions lib/glfw/CMake/modules/FindGLESv1.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions lib/glfw/CMake/modules/FindGLESv2.cmake

This file was deleted.

34 changes: 34 additions & 0 deletions lib/glfw/CMake/modules/FindVulkan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Find Vulkan
#
# VULKAN_INCLUDE_DIR
# VULKAN_LIBRARY
# VULKAN_FOUND

if (WIN32)
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
"$ENV{VULKAN_SDK}/Include"
"$ENV{VK_SDK_PATH}/Include")
if (CMAKE_CL_64)
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
"$ENV{VULKAN_SDK}/Bin"
"$ENV{VK_SDK_PATH}/Bin")
find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
"$ENV{VULKAN_SDK}/Bin"
"$ENV{VK_SDK_PATH}/Bin")
else()
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
"$ENV{VULKAN_SDK}/Bin32"
"$ENV{VK_SDK_PATH}/Bin32")
endif()
else()
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
"$ENV{VULKAN_SDK}/include")
find_library(VULKAN_LIBRARY NAMES vulkan HINTS
"$ENV{VULKAN_SDK}/lib")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)

mark_as_advanced(VULKAN_INCLUDE_DIR VULKAN_LIBRARY VULKAN_STATIC_LIBRARY)

66 changes: 0 additions & 66 deletions lib/glfw/CMake/modules/FindWayland.cmake

This file was deleted.

26 changes: 26 additions & 0 deletions lib/glfw/CMake/modules/FindWaylandProtocols.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
find_package(PkgConfig)

pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION})

execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR
RESULT_VARIABLE _pkgconfig_failed)
if (_pkgconfig_failed)
message(FATAL_ERROR "Missing wayland-protocols pkgdatadir")
endif()

string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}")

find_package_handle_standard_args(WaylandProtocols
FOUND_VAR
WaylandProtocols_FOUND
REQUIRED_VARS
WaylandProtocols_PKGDATADIR
VERSION_VAR
WaylandProtocols_VERSION
HANDLE_COMPONENTS
)

set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND})
set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR})
set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION})
Loading