Skip to content

Commit

Permalink
fix(CMAKE) gl3w compilation fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
olesgedz committed May 5, 2022
1 parent a7bf086 commit 905ac89
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
project(gbemu CXX C) #LANGUAGES CXX
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
message("S" ${CMAKE_CXX_COMPILER})
##if(NOT CMAKE_CXX_EXTENSIONS)
## set(CMAKE_CXX_EXTENSIONS ON)
##endif()
##set(CMAKE_CXX_EXTENSIONS ON)
##set(CXX_STANDARD 20)
set(CMP0072 NEW)
if (UNIX)
add_compile_options(
# -Wc++11-extensions
Expand Down Expand Up @@ -33,6 +34,9 @@ endif()
#
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2")
set(CMAKE_BUILD_TYPE Debug)
# set(OpenGL_GL_PREFERENCE GLVND)



if (WIN32)
# set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3 /MTd")
Expand All @@ -47,7 +51,7 @@ set(SDL2_LIBRARIES "${CMAKE_BINARY_DIR}/extern/SDL/libSDL2maind.lib")
#else ()
# set(SDL2_LIBRARIES "${PROJECT_SOURCE_DIR}/extern/sdl2_win/lib/x86/SDL2.lib;${PROJECT_SOURCE_DIR}/extern/sdl2_win/lib/x86/SDL2main.lib")
#endif ()

set(OpenGL_GL_PREFERENCE GLVND)
elseif(UNIX AND NOT APPLE)
# find_package(SDL2 REQUIRED)
set(SDL2_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/extern/SDL/include/")
Expand All @@ -63,7 +67,19 @@ include_directories("${PROJECT_SOURCE_DIR}/extern/SDL/include")
set(SDL2_LIBRARIES "${CMAKE_BINARY_DIR}/extern/SDL/libSDL2maind.a;${CMAKE_BINARY_DIR}/extern/SDL/libSDL2d.a")
add_subdirectory(extern/SDL)
endif()
execute_process(COMMAND python gl3w_gen.py --root ${PROJECT_BINARY_DIR}/extern/gl3w WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/extern/gl3w)
#execute_process(COMMAND python gl3w_gen.py --root ${PROJECT_BINARY_DIR}/extern/gl3w WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/extern/gl3w)
# set(GL3W_DIR "${PROJECT_SOURCE_DIR}/extern/gl3w/cmake/")
# find_package(GL3W REQUIRED)
set(GL3W_ROOT "${CMAKE_SOURCE_DIR}/extern/gl3w")
set(GL3W_INC "${GL3W_ROOT}/include")
set(GL3W_SRC "${GL3W_ROOT}/src/gl3w.c")

if (NOT EXISTS ${GL3W_SRC})
message(STATUS "Generating gl3w source files")
execute_process(COMMAND python gl3w_gen.py --root ${PROJECT_BINARY_DIR}/extern/gl3w
WORKING_DIRECTORY ${GL3W_ROOT})
endif()

include_directories(${SDL2_INCLUDE_DIRS})
add_subdirectory(extern/gl3w)
add_subdirectory(lib)
Expand Down

0 comments on commit 905ac89

Please sign in to comment.