Skip to content

Commit

Permalink
update linux build instructions, add 2 required Find*.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
q4a committed Jun 22, 2018
1 parent 80b3c99 commit b6cbf2b
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 7 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if(CCACHE_FOUND)
endif(CCACHE_FOUND)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive --std=c++17")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") Это на будущее
#set(CMAKE_CXX_STANDARD 14) #Иначе ублюдочный симак добавляет -std=gnu++11 и ломает сборку
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") This is for the future versions
#set(CMAKE_CXX_STANDARD 14) #Otherwise adds -std=gnu++11 and breaks successful building
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_EXTENSIONS OFF)

Expand All @@ -23,7 +23,8 @@ set(LUA_INCLUDE_DIR Externals/LuaJIT/src)
set(LUA_LIBRARIES luajit)
set(LUA_FOUND 1)
if (NOT WIN32)
find_package(OpenSSL REQUIRED)
find_package(Crypto++ REQUIRED)
find_package(PugiXML REQUIRED)
find_package(Theora REQUIRED)
find_package(OGG REQUIRED)
find_package(SDL2 REQUIRED)
Expand Down
36 changes: 36 additions & 0 deletions cmake/FindCrypto++.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#https://raw.githubusercontent.com/harningt/cryptoface/7332799df7d9c78012eaa153f6598dcfa7debbc4/Modules/FindCrypto%2B%2B.cmake
# - Find Crypto++

if(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
set(CRYPTO++_FOUND TRUE)

else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
find_path(CRYPTO++_INCLUDE_DIR cryptlib.h
/usr/include/crypto++
/usr/include/cryptopp
/usr/local/include/crypto++
/usr/local/include/cryptopp
/opt/local/include/crypto++
/opt/local/include/cryptopp
$ENV{SystemDrive}/Crypto++/include
)

find_library(CRYPTO++_LIBRARIES NAMES cryptopp
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
$ENV{SystemDrive}/Crypto++/lib
)

if(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
set(CRYPTO++_FOUND TRUE)
message(STATUS "Found Crypto++: ${CRYPTO++_INCLUDE_DIR}, ${CRYPTO++_LIBRARIES}")
else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
set(CRYPTO++_FOUND FALSE)
message(FATAL_ERROR "Crypto++ not found.")
endif(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)

mark_as_advanced(CRYPTO++_INCLUDE_DIR CRYPTO++_LIBRARIES)

endif(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
47 changes: 47 additions & 0 deletions cmake/FindPugiXML.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#https://raw.githubusercontent.com/imageworks/OpenShadingLanguage/1bd2d67d88418544c4990d93513813696c9a8c06/src/cmake/modules/FindPugiXML.cmake
# Find the pugixml XML parsing library.
#
# Sets the usual variables expected for find_package scripts:
#
# PUGIXML_INCLUDE_DIR - header location
# PUGIXML_LIBRARIES - library to link against
# PUGIXML_FOUND - true if pugixml was found.

unset (PUGIXML_LIBRARY CACHE)
unset (PUGIXML_INCLUDE_DIR CACHE)
find_path (PUGIXML_INCLUDE_DIR
NAMES pugixml.hpp
PATHS ${PUGIXML_HOME}/include
/usr/local/include
/usr/local/include/pugixml-1.8)
find_library (PUGIXML_LIBRARY
NAMES pugixml
PATHS ${PUGIXML_HOME}/lib
/usr/local/lib
/usr/local/lib/pugixml-1.8)

# Second chance -- if not found, look in the OIIO distro
if (NOT PUGIXML_INCLUDE_DIR AND OPENIMAGEIO_INCLUDE_DIR)
find_path (PUGIXML_INCLUDE_DIR
NAMES pugixml.hpp
PATHS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO)
set (PUGIXML_LIBRARY ${OPENIMAGEIO_LIBRARIES})
endif ()


# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (PugiXML DEFAULT_MSG PUGIXML_LIBRARY
PUGIXML_INCLUDE_DIR)

if (PUGIXML_FOUND)
set (PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
if (NOT PugiXML_FIND_QUIETLY)
message (STATUS "PugiXML include = ${PUGIXML_INCLUDE_DIR}")
message (STATUS "PugiXML library = ${PUGIXML_LIBRARY}")
endif ()
else ()
message (FATAL_ERROR "No PugiXML found")
endif()

mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
9 changes: 5 additions & 4 deletions doc/howto/build-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ TITLE: X-Ray 1.6 build and setup on Linux

Required packages:
------
OpenSSL
Crypto++
pugixml
Theora
OGG
SDL2
LZO
JPEG


Ubuntu 18.04 build dependencies:
sudo apt install git cmake libssl-dev libogg-dev libtheora-dev libvorbis-dev libsdl2-dev liblzo2-dev libjpeg-dev libncurses5-dev
sudo apt install git cmake libcrypto++-dev libpugixml-dev libogg-dev libtheora-dev libvorbis-dev libsdl2-dev liblzo2-dev libjpeg-dev libncurses5-dev

Build commands:
------
Expand All @@ -21,10 +23,9 @@ cmake ..
(or export CC=clang && export CXX=clang++ && cmake ..)
make

Libraries:
Libraries (OLD LIST !!! ):
------
To build X-Ray Engine you'll need following libraries:
* Windows SDK
* BugTrap: https://github.com/Xottab-DUTY/BugTrap
* CryptoPP: https://github.com/weidai11/cryptopp
* FreeImage: http://freeimage.sourceforge.net
Expand Down

0 comments on commit b6cbf2b

Please sign in to comment.