Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ if (WIN32)
set(WIN32_PTHREADS_INCLUDE_PATH "${WIN32_PTHREADS_PATH}/include")
endif()

# Always look. It won't be found on Windows. Later build scripts will understand how to
# WAR it being missing.
find_package(TinyXML)

message("")
message("cmake options:")
message(" -DCMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}': Build debug or release. (Debug|Release)")
Expand Down
22 changes: 10 additions & 12 deletions src/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -382,24 +382,22 @@ function(require_libjpegturbo)
PATHS /opt/libjpeg-turbo/lib
)

# On platforms that find this, the include files will have also been installed to the system
# so we don't need extra include dirs.
if (LibJpegTurbo_LIBRARY)
set(LibJpegTurbo_INCLUDE "" PARENT_SCOPE)
IF(LibJpegTurbo_LIBRARY)
find_path(LibJpegTurbo_INCLUDE_DIR
NAME turbojpeg.h
PATHS /opt/libjpeg-turbo/inc /opt/libjpeg-turbo/include
)
IF(NOT LibJpegTurbo_INCLUDE_DIR)
message(FATAL_ERROR "Unable to find turbojpeg.h")
ENDIF()
set(LibJpegTurbo_INCLUDE "${LibJpegTurbo_INCLUDE_DIR}" PARENT_SCOPE)

# On Darwin we assume a Homebrew install
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LibJpegTurbo_INCLUDE "/usr/local/opt/jpeg-turbo/include" PARENT_SCOPE)
set(LibJpegTurbo_LIBRARY "/usr/local/opt/jpeg-turbo/lib/libturbojpeg.a" PARENT_SCOPE)

else()
if (BUILD_X64)
set(BITS_STRING "x64")
else()
set(BITS_STRING "x86")
endif()
set(LibJpegTurbo_INCLUDE "${CMAKE_PREFIX_PATH}/libjpeg-turbo-2.1.3/include" PARENT_SCOPE)
set(LibJpegTurbo_LIBRARY "${CMAKE_PREFIX_PATH}/libjpeg-turbo-2.1.3/lib_${BITS_STRING}/turbojpeg.lib" PARENT_SCOPE)
message(FATAL_ERROR "Unable to find libturbojpeg.so")
endif()
endfunction()

Expand Down
75 changes: 0 additions & 75 deletions src/cmake/Modules/FindTinyXML.cmake

This file was deleted.

75 changes: 75 additions & 0 deletions src/cmake/Modules/FindTinyXML2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
##################################################################################################
#
# CMake script for finding TinyXML2.
#
# Input variables:
#
# - TinyXML2_ROOT_DIR (optional): When specified, header files and libraries will be searched for in
# ${TinyXML2_ROOT_DIR}/include
# ${TinyXML2_ROOT_DIR}/libs
# respectively, and the default CMake search order will be ignored. When unspecified, the default
# CMake search order is used.
# This variable can be specified either as a CMake or environment variable. If both are set,
# preference is given to the CMake variable.
# Use this variable for finding packages installed in a nonstandard location, or for enforcing
# that one of multiple package installations is picked up.
#
#
# Cache variables (not intended to be used in CMakeLists.txt files)
#
# - TinyXML2_INCLUDE_DIR: Absolute path to package headers.
# - TinyXML2_LIBRARY: Absolute path to library.
#
#
# Output variables:
#
# - TinyXML2_FOUND: Boolean that indicates if the package was found
# - TinyXML2_INCLUDE_DIRS: Paths to the necessary header files
# - TinyXML2_LIBRARIES: Package libraries
#
#
# Example usage:
#
# find_package(TinyXML2)
# if(NOT TinyXML2_FOUND)
# # Error handling
# endif()
# ...
# include_directories(${TinyXML2_INCLUDE_DIRS} ...)
# ...
# target_link_libraries(my_target ${TinyXML2_LIBRARIES})
#
##################################################################################################
#from: https://github.com/ros/cmake_modules/blob/0.3-devel/cmake/Modules/FindTinyXML.cmake

# Get package location hint from environment variable (if any)
if(NOT TinyXML2_ROOT_DIR AND DEFINED ENV{TinyXML2_ROOT_DIR})
set(TinyXML2_ROOT_DIR "$ENV{TinyXML2_ROOT_DIR}" CACHE PATH
"TinyXML2 base directory location (optional, used for nonstandard installation paths)")
endif()

# Search path for nonstandard package locations
if(TinyXML2_ROOT_DIR)
set(TinyXML2_INCLUDE_PATH PATHS "${TinyXML2_ROOT_DIR}/include" NO_DEFAULT_PATH)
set(TinyXML2_LIBRARY_PATH PATHS "${TinyXML2_ROOT_DIR}/lib" NO_DEFAULT_PATH)
endif()

# Find headers and libraries
find_path(TinyXML2_INCLUDE_DIR NAMES tinyxml2.h PATH_SUFFIXES "tinyxml" ${TinyXML2_INCLUDE_PATH})
find_library(TinyXML2_LIBRARY NAMES tinyxml2 PATH_SUFFIXES "tinyxml" ${TinyXML2_LIBRARY_PATH})

mark_as_advanced(TinyXML2_INCLUDE_DIR
TinyXML2_LIBRARY)

# Output variables generation
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TinyXML2_LIBRARY
TinyXML2_INCLUDE_DIR)

set(TinyXML2_FOUND ${TINYXML2_FOUND}) # Enforce case-correctness: Set appropriately cased variable...
unset(TINYXML2_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args

if(TinyXML2_FOUND)
set(TinyXML2_INCLUDE_DIRS ${TinyXML2_INCLUDE_DIR})
set(TinyXML2_LIBRARIES ${TinyXML2_LIBRARY})
endif()
24 changes: 15 additions & 9 deletions src/voglgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,36 @@ include("${SRC_DIR}/build_options.cmake")

require_pthreads()

file( GLOB_RECURSE HDRS *.[h|inl] )

set(SPEC_DIR "${SRC_DIR}/../glspec")

# Always look. It won't be found on Windows. Later build scripts will
# understand how to WAR it being missing.
find_package(TinyXML2)

if (NOT TinyXML2_FOUND)
message(WARNING "TinyXML2 Not Found; will build it.")
add_library( tinyxml2 STATIC tinyxml2/tinyxml2.cpp tinyxml2/tinyxml2.h )

set( TinyXML2_LIBRARIES tinyxml2 )
set( TinyXML2_INCLUDE_DIR tinyxml2 )
endif()

file( GLOB SPECS "${SPEC_DIR}/*.spec" "${SPEC_DIR}/*.tm" "${SPEC_DIR}/*.xml" )
set(SRC_LIST ${HDRS} ${SPECS}
voglgen.cpp
tinyxml2/tinyxml2.cpp)
set(SRC_LIST ${SPECS} voglgen.cpp)

# Add a source group to easily look at the spec files.
if (MSVC)
SOURCE_GROUP( "Specs Files" FILES ${SPECS} )
endif()

add_definitions(-DTIXML_USE_STL)

include_directories(
${SRC_DIR}/voglcore
${SRC_DIR}/voglcore ${TinyXML2_INCLUDES}
)

add_executable(${PROJECT_NAME} ${SRC_LIST})

target_link_libraries(${PROJECT_NAME}
voglcore
${TinyXML2_LIBRARIES} voglcore
)

set(FORCE_REGENERATE ${SPEC_DIR}/force_regenerate)
Expand Down