Skip to content

Instantly share code, notes, and snippets.

@newobj
Created June 15, 2015 17:15
Show Gist options
  • Save newobj/60945dbabc268cce315a to your computer and use it in GitHub Desktop.
Save newobj/60945dbabc268cce315a to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.2)
project(nisqually)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DENTRY_CONFIG_USE_SDL=1)
add_definitions(-DBGFX_CONFIG_RENDERER_OPENGL=1)
IF(APPLE)
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -framework SDL2 -framework CoreFoundation -framework Cocoa -framework OpenGL -framework GLUT")
find_library(CF_LIBRARY CoreFoundation REQUIRED)
find_library(COCOA_LIBRARY Cocoa REQUIRED)
find_library(GLUT_LIBRARY GLUT REQUIRED)
find_library(GL_LIBRARY OpenGL REQUIRED)
find_library(SDL2_LIBRARY SDL2 REQUIRED)
if(NOT CF_LIBRARY)
message(FATAL_ERROR "CoreFoundation not found")
endif()
if(NOT COCOA_LIBRARY)
message(FATAL_ERROR "Cocoa not found")
endif()
if(NOT GLUT_LIBRARY)
message(FATAL_ERROR "GLUT not found")
endif()
if(NOT GL_LIBRARY)
message(FATAL_ERROR "GL not found")
endif()
if(NOT SDL2_LIBRARY)
message(FATAL_ERROR "SDL2 not found")
endif()
set(PLATFORM_LIBRARIES ${CF_LIBRARY} ${COCOA_LIBRARY} ${GLUT_LIBRARY} ${GL_LIBRARY} ${SDL2_LIBRARY})
endif(APPLE)
include_directories("${OPENGL_INCLUDE_DIR}/Headers")
include_directories("${PROJECT_SOURCE_DIR}/bx/include")
include_directories("${PROJECT_SOURCE_DIR}/bx/include/compat/osx")
include_directories("${PROJECT_SOURCE_DIR}/bgfx/3rdparty/khronos")
include_directories("${PROJECT_SOURCE_DIR}/bgfx/3rdparty")
include_directories("${PROJECT_SOURCE_DIR}/bgfx/examples/common")
include_directories("${PROJECT_SOURCE_DIR}/bgfx/include")
set(BGFX_SOURCE_FILES
bgfx/examples/common/entry/cmd.cpp
bgfx/examples/common/entry/dbg.cpp
bgfx/examples/common/entry/entry.cpp
bgfx/examples/common/entry/entry_sdl.cpp
bgfx/examples/common/entry/input.cpp
bgfx/src/amalgamated.cpp
)
set(SOURCE_FILES
main.cpp
)
add_library(bgfx ${BGFX_SOURCE_FILES})
add_executable(nisqually ${SOURCE_FILES})
target_link_libraries(nisqually bgfx ${PLATFORM_LIBRARIES})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment