Giter Club home page Giter Club logo

opengl_cmake_skeleton's Introduction

OpenGL CMake Skeleton Build Status

A ready to use C++11 CMake OpenGL skeleton using GLFW, Glew and glm. (use git submodules)

It compiles on:

  • WebAssembly (on branch webassembly. See instruction below)
  • Linux
  • Windows
  • Mac

It can compile for the Web with WebAssembly thanks to emscripten, as well as on Linux, Windows and Mac.

Shader class and example Application are included.

output result

I am open to any comments and contributions.

Clone (With submodules):

git clone --recursive [email protected]:ArthurSonzogni/OpenGL_CMake_Skeleton.git

Alternatively, if you don't used the --recursive option, you can type:

git submodule init
git submodule update

usage (WebAssembly) :

Switch to the webassembly branch

git checkout webassembly

Install emscripten, then

mkdir build_emscripten
cd build_emscripten
emcmake cmake ..
make
python -m SimpleHTTPServer 8000

Now, visit http://localhost:8000

usage (Linux) :

Install some standard library, fetch the project, build and run:

sudo apt-get install cmake libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev
git clone --recursive [email protected]:ArthurSonzogni/OpenGL_CMake_Skeleton.git
cd OpenGL_CMake_Skeleton
mkdir build
cd build
cmake ..
make -j
./opengl-cmake-skeleton

usage (Windows) :

For instance :

  • cmake-gui .
  • Configure (Choose for example Visual Studio generator)
  • Generate Launch the generated project in your favorite IDE and run it.

opengl_cmake_skeleton's People

Contributors

arthursonzogni avatar gruberchris avatar posva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

opengl_cmake_skeleton's Issues

problem build on mac

$ cmake ..                                                                                                                                                          [15:29:32]
-- Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Using Cocoa for window creation
CMake Deprecation Warning at lib/glew/CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at lib/glm/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at lib/glm/CMakeLists.txt:2 (cmake_policy):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   libglew_shared
   libglewmx_shared

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/fuzhengyin/CProjects/OpenGL_CMake_Skeleton/build

and build directory just like this. There is no "main". What wrong. What can I do. cmake -G "Xcode .." no help

fuzhengyin@fuzhengyindeMBP: ~/CProjects/OpenGL_CMake_Skeleton/build master!
$ l                                                                                                                                                                 [15:30:11]
total 112
drwxr-xr-x   9 fuzhengyin  staff   288B Nov 15 15:29 .
drwxr-xr-x  14 fuzhengyin  staff   448B Nov 15 15:27 ..
-rw-r--r--   1 fuzhengyin  staff    22K Nov 15 15:28 CMakeCache.txt
drwxr-xr-x  15 fuzhengyin  staff   480B Nov 15 15:29 CMakeFiles
-rw-r--r--   1 fuzhengyin  staff    27K Nov 15 15:29 Makefile
drwxr-xr-x   2 fuzhengyin  staff    64B Nov 15 15:29 build
-rw-r--r--   1 fuzhengyin  staff   1.7K Nov 15 15:28 cmake_install.cmake
drwxr-xr-x   5 fuzhengyin  staff   160B Nov 15 15:28 lib
drwxr-xr-x   3 fuzhengyin  staff    96B Nov 15 15:29 src

cant run

bash: ./main: No such file or directory

Unable to resole symbol __imp_glewInit on Win10

  • OS: Win10
  • Cmake: 3.13
  • Toolchain: MSCV
  • IDE: CLion

ISSUE: Unable to resolve glew functions:

Application.cpp.obj : error LNK2019: Unable to resole symbol __imp_glewInit

SOLUTION: From GLEW:

cmake_minimum_required(VERSION 3.1)
project(opengl-skeleton)

if (WIN32)
    add_definitions(-DGLEW_STATIC)
endif ()

...

Hope this could be add to repo!

Some suggestions

Hey @ArthurSonzogni,

Nice work on getting all these together. I appreciate it. I also have several personal templates like this, but my observation is that after some time, they become hard to maintain. Github just suggested your repository, and had a chance to browse the files. If it is not a problem for you, I'd like to make some suggestions:

  1. CMake minimum v3.1 seems very old. Just for a reference, Ubuntu 20.04 comes with CMake v3.16.3 and Ubuntu 18.04 with v3.10.2. I am aware that not everybody uses Ubuntu and for sure, it is possible to download and install any version of CMake from kitware.com. I just wanted to share these version numbers as a reference.
  2. Although it is perfectly fine to me, I see that some people around me find git extensions like submodules, lfs a bit confusing to use. Since you made a CMake skeleton, it feels like it might be a good idea to use more CMake-native methods: FetchContent or ExternalProject are perfectly suitable and good replacements for git-submodule.
  3. There is another CMake-integrated package manager that I sometimes use: vcpkg. It uses CMAKE_TOOLCHAIN_FILE variable, which could also be added to the top of CMakeLists.txt. It is a nice alternative, works on multiple platforms, too.
  4. You might also want to check FindOpenGL module and see if it could be useful in a skeleton.

Thanks again for your work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.