diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ac9c17..74a491b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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") @@ -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/") @@ -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)