Skip to content

Commit

Permalink
Add workshop01 project with GLFW hello-world. Also added stb_image.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reedbeta committed Aug 1, 2016
1 parent 3bdfa37 commit 269ba97
Show file tree
Hide file tree
Showing 4 changed files with 6,849 additions and 6 deletions.
26 changes: 20 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,36 @@
cmake_minimum_required(VERSION 3.6.1)
project(gfx-workshops)

# Allow debug and release configurations for all projects
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)

# Use only static linking to avoid hassle of shared libraries
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)

# Allow debug and release configurations for all projects
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
# Use static linking for MSVC runtime as well
# See: https://cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
if (MSVC)
foreach (flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
if (${flag} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
endif()
if (${flag} MATCHES "/MDd")
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
endif()
endforeach()
endif()

# First build GLFW, following instructions from: http://www.glfw.org/docs/latest/build_guide.html#build_link_cmake_source
# Build GLFW, following instructions from: http://www.glfw.org/docs/latest/build_guide.html#build_link_cmake_source
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
if (WIN32)
set(GLFW_USE_HYBRID_HPG ON CACHE BOOL "" FORCE)
endif()
if (MSVC)
set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF CACHE BOOL "" FORCE)
endif()
add_subdirectory(glfw)

# Build the individual workshop projects
set(WORKSHOPS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(workshop01)
8 changes: 8 additions & 0 deletions workshop01/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.6.1)
project(workshop01)
add_executable(workshop01
workshop01.cpp
../glad/src/glad.c
stb_image.h)
target_include_directories(workshop01 PRIVATE "${WORKSHOPS_ROOT_DIR}/glad/include")
target_link_libraries(workshop01 glfw)
Loading

0 comments on commit 269ba97

Please sign in to comment.