Skip to content

Commit 3fe6681

Browse files
authored
[build in CMake for viewer] adding it. compiles and works on Windows MSYS/MINGW and Debian MX. (#368)
1 parent f14ed14 commit 3fe6681

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

examples/viewer/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

examples/viewer/CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# cmake -S . -B build && cmake --build build && build/app
2+
3+
# cmake -S . -B build -G "Ninja" && cmake --build build && build/app
4+
# cmake -S . -B build -G "CodeBlocks - Ninja" && cmake --build build && build/app
5+
# cmake -S . -B build -G "Visual Studio 17 2022" && cmake --build build && build/app
6+
7+
cmake_minimum_required(VERSION 3.18)
8+
project( app VERSION 0.1 )
9+
10+
file(GLOB SOURCE_FILES "*.c*" )
11+
add_executable(app ${SOURCE_FILES})
12+
13+
find_package( OpenGL REQUIRED )
14+
find_package( glfw3 REQUIRED )
15+
16+
set(ADDITIONAL_LIBRARIES "")
17+
if(WIN32)
18+
set(ADDITIONAL_LIBRARIES winmm)
19+
endif()
20+
21+
set(GLEW_LIBRARY "")
22+
if(UNIX)
23+
set(GLEW_LIBRARY GLEW)
24+
else()
25+
find_package( glew REQUIRED )
26+
set(GLEW_LIBRARY GLEW::glew)
27+
endif()
28+
29+
target_link_libraries(${PROJECT_NAME} OpenGL::GL OpenGL::GLU glfw ${ADDITIONAL_LIBRARIES} ${GLEW_LIBRARY} )

0 commit comments

Comments
 (0)