libvgcode - CMakeLists.txt modified to work with emscripten

This commit is contained in:
enricoturri1966 2024-03-06 13:07:33 +01:00 committed by Lukas Matena
parent e7b22a8d3b
commit 673127aeed

View File

@ -1,6 +1,24 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.13)
project(libvgcode)
# glad library
if (EMSCRIPTEN)
set(GLAD_SOURCES
# glad/include/glad/egl.h
glad/include/glad/gles2.h
# glad/include/EGL/eglplatform.h
glad/include/KHR/khrplatform.h
glad/src/gles2.c
# glad/src/egl.c
)
else ()
set(GLAD_SOURCES
glad/include/glad/gl.h
glad/include/KHR/khrplatform.h
glad/src/gl.c
)
endif ()
set(LIBVGCODE_SOURCES
# API
include/ColorPrint.hpp
@ -44,25 +62,18 @@ set(LIBVGCODE_SOURCES
src/ViewerImpl.cpp
src/ViewRange.hpp
src/ViewRange.cpp
# glad OpenGL
glad/include/glad/gl.h
glad/include/KHR/khrplatform.h
glad/src/gl.c
# # glad OpenGL ES
# glad/include/glad/gles2.h
# glad/include/KHR/khrplatform.h
# glad/src/gles2.c
${GLAD_SOURCES}
)
add_library(libvgcode STATIC ${LIBVGCODE_SOURCES})
if (WIN32)
foreach(_source IN ITEMS ${LIBVGCODE_SOURCES})
get_filename_component(_source_path "${_source}" PATH)
string(REPLACE "/" "\\" _group_path "${_source_path}")
source_group("${_group_path}" FILES "${_source}")
endforeach()
endif()
foreach(_source IN ITEMS ${LIBVGCODE_SOURCES})
get_filename_component(_source_path "${_source}" PATH)
string(REPLACE "/" "\\" _group_path "${_source_path}")
source_group("${_group_path}" FILES "${_source}")
endforeach()
endif ()
# glad includes
include_directories(glad/include)