Fix build scripts to look for Irrlicht
parent
a2b487dcfd
commit
6b42515b72
|
@ -1,21 +1,18 @@
|
|||
# Set up project
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(NodeBoxGenerator)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
# :mode=cmake:noTabs=true:
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
find_path(irrlicht_include
|
||||
NAMES irrlicht.h
|
||||
HINTS /usr/include/irrlicht
|
||||
)
|
||||
|
||||
find_library(irrlicht_lib
|
||||
NAMES Irrlicht
|
||||
)
|
||||
|
||||
include_directories(${irrlicht_include})
|
||||
|
||||
project(NodeBoxGenerator CXX)
|
||||
# Dependancies
|
||||
find_package(Irrlicht REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
# Source files
|
||||
set(NBGEN_SRC
|
||||
main.cpp
|
||||
cNodes.cpp
|
||||
|
@ -23,11 +20,39 @@ set(NBGEN_SRC
|
|||
cEditor.cpp
|
||||
)
|
||||
|
||||
add_executable(nbgen_exe ${NBGEN_SRC})
|
||||
# Include Directories
|
||||
include_directories(
|
||||
${PROJECT_BINARY_DIR}
|
||||
${IRRLICHT_INCLUDE_DIR}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${CMAKE_BUILD_TYPE}
|
||||
${X11_INCLUDE_DIR}
|
||||
${OPENGL_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
set_target_properties(nbgen_exe
|
||||
add_executable(${PROJECT_NAME} ${NBGEN_SRC})
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
${IRRLICHT_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${X11_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
${BZIP2_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME NodeBoxGenerator
|
||||
)
|
||||
|
||||
target_link_libraries(nbgen_exe ${irrlicht_lib})
|
||||
# Install DLLs
|
||||
if(WIN32)
|
||||
if(DEFINED IRRLICHT_DLL)
|
||||
message(Installing irrlicht dll)
|
||||
install(FILES ${IRRLICHT_DLL})
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
#FindIrrlicht.cmake
|
||||
|
||||
set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)")
|
||||
|
||||
if( UNIX )
|
||||
# Unix
|
||||
else( UNIX )
|
||||
# Windows
|
||||
endif( UNIX )
|
||||
|
||||
# Find include directory
|
||||
|
||||
if(NOT IRRLICHT_SOURCE_DIR STREQUAL "")
|
||||
set(IRRLICHT_SOURCE_DIR_INCLUDE
|
||||
"${IRRLICHT_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a Irrlicht Irrlicht.lib)
|
||||
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio")
|
||||
set(IRRLICHT_LIBRARY_NAMES Irrlicht.lib)
|
||||
else()
|
||||
set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc")
|
||||
set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a libIrrlicht.dll.a)
|
||||
endif()
|
||||
else()
|
||||
set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Linux")
|
||||
set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a)
|
||||
endif()
|
||||
|
||||
FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
|
||||
PATHS
|
||||
${IRRLICHT_SOURCE_DIR_INCLUDE}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES}
|
||||
PATHS
|
||||
${IRRLICHT_SOURCE_DIR_LIBS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
|
||||
PATHS
|
||||
/usr/local/include/irrlicht
|
||||
/usr/include/irrlicht
|
||||
)
|
||||
|
||||
FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
|
||||
PATHS
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
endif()
|
||||
|
||||
MESSAGE(STATUS "IRRLICHT_SOURCE_DIR = ${IRRLICHT_SOURCE_DIR}")
|
||||
MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")
|
||||
|
||||
# On windows, find the dll for installation
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
|
||||
PATHS
|
||||
"${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio"
|
||||
DOC "Path of the Irrlicht dll (for installation)"
|
||||
)
|
||||
else()
|
||||
FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
|
||||
PATHS
|
||||
"${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc"
|
||||
DOC "Path of the Irrlicht dll (for installation)"
|
||||
)
|
||||
endif()
|
||||
MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}")
|
||||
endif(WIN32)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(IRRLICHT DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
|
||||
|
||||
IF(IRRLICHT_FOUND)
|
||||
SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY})
|
||||
ELSE(IRRLICHT_FOUND)
|
||||
SET(IRRLICHT_LIBRARIES)
|
||||
ENDIF(IRRLICHT_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL)
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
#-------------------------------------------------------------------
|
||||
# This file is stolen from part of the CMake build system for OGRE (Object-oriented Graphics Rendering Engine) http://www.ogre3d.org/
|
||||
#
|
||||
# The contents of this file are placed in the public domain. Feel
|
||||
# free to make use of it in any way you like.
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# - Try to find OpenGLES and EGL
|
||||
# Once done this will define
|
||||
#
|
||||
# OPENGLES2_FOUND - system has OpenGLES
|
||||
# OPENGLES2_INCLUDE_DIR - the GL include directory
|
||||
# OPENGLES2_LIBRARIES - Link these to use OpenGLES
|
||||
#
|
||||
# EGL_FOUND - system has EGL
|
||||
# EGL_INCLUDE_DIR - the EGL include directory
|
||||
# EGL_LIBRARIES - Link these to use EGL
|
||||
|
||||
# win32, apple, android NOT TESED
|
||||
# linux tested and works
|
||||
|
||||
IF (WIN32)
|
||||
IF (CYGWIN)
|
||||
|
||||
FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h )
|
||||
|
||||
FIND_LIBRARY(OPENGLES2_gl_LIBRARY libGLESv2 )
|
||||
|
||||
ELSE (CYGWIN)
|
||||
|
||||
IF(BORLAND)
|
||||
SET (OPENGLES2_gl_LIBRARY import32 CACHE STRING "OpenGL ES 2.x library for win32")
|
||||
ELSE(BORLAND)
|
||||
# todo
|
||||
# SET (OPENGLES_gl_LIBRARY ${SOURCE_DIR}/Dependencies/lib/release/libGLESv2.lib CACHE STRING "OpenGL ES 2.x library for win32"
|
||||
ENDIF(BORLAND)
|
||||
|
||||
ENDIF (CYGWIN)
|
||||
|
||||
ELSE (WIN32)
|
||||
|
||||
IF (APPLE)
|
||||
|
||||
create_search_paths(/Developer/Platforms)
|
||||
findpkg_framework(OpenGLES2)
|
||||
set(OPENGLES2_gl_LIBRARY "-framework OpenGLES")
|
||||
|
||||
ELSE(APPLE)
|
||||
|
||||
FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
|
||||
/usr/openwin/share/include
|
||||
/opt/graphics/OpenGL/include /usr/X11R6/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(OPENGLES2_gl_LIBRARY
|
||||
NAMES GLESv2
|
||||
PATHS /opt/graphics/OpenGL/lib
|
||||
/usr/openwin/lib
|
||||
/usr/shlib /usr/X11R6/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
IF (NOT BUILD_ANDROID)
|
||||
FIND_PATH(EGL_INCLUDE_DIR EGL/egl.h
|
||||
/usr/openwin/share/include
|
||||
/opt/graphics/OpenGL/include /usr/X11R6/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(EGL_egl_LIBRARY
|
||||
NAMES EGL
|
||||
PATHS /opt/graphics/OpenGL/lib
|
||||
/usr/openwin/lib
|
||||
/usr/shlib /usr/X11R6/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
# On Unix OpenGL most certainly always requires X11.
|
||||
# Feel free to tighten up these conditions if you don't
|
||||
# think this is always true.
|
||||
# It's not true on OSX.
|
||||
|
||||
IF (OPENGLES2_gl_LIBRARY)
|
||||
IF(NOT X11_FOUND)
|
||||
INCLUDE(FindX11)
|
||||
ENDIF(NOT X11_FOUND)
|
||||
IF (X11_FOUND)
|
||||
IF (NOT APPLE)
|
||||
SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES})
|
||||
ENDIF (NOT APPLE)
|
||||
ENDIF (X11_FOUND)
|
||||
ENDIF (OPENGLES2_gl_LIBRARY)
|
||||
ENDIF ()
|
||||
|
||||
ENDIF(APPLE)
|
||||
ENDIF (WIN32)
|
||||
|
||||
#SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
|
||||
|
||||
IF (BUILD_ANDROID)
|
||||
IF(OPENGLES2_gl_LIBRARY)
|
||||
SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
|
||||
SET( EGL_LIBRARIES)
|
||||
SET( OPENGLES2_FOUND "YES" )
|
||||
ENDIF(OPENGLES2_gl_LIBRARY)
|
||||
ELSE ()
|
||||
|
||||
SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
|
||||
|
||||
IF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY)
|
||||
SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
|
||||
SET( EGL_LIBRARIES ${EGL_egl_LIBRARY} ${EGL_LIBRARIES})
|
||||
SET( OPENGLES2_FOUND "YES" )
|
||||
ENDIF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPENGLES2_INCLUDE_DIR
|
||||
OPENGLES2_gl_LIBRARY
|
||||
EGL_INCLUDE_DIR
|
||||
EGL_egl_LIBRARY
|
||||
)
|
||||
|
||||
IF(OPENGLES2_FOUND)
|
||||
MESSAGE(STATUS "Found system opengles2 library ${OPENGLES2_LIBRARIES}")
|
||||
ELSE ()
|
||||
SET(OPENGLES2_LIBRARIES "")
|
||||
ENDIF ()
|
Loading…
Reference in New Issue