@@ -4,32 +4,107 @@ project(OpenXRay)
44include (${PROJECT_SOURCE_DIR} /cmake/utils.cmake)
55
66set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} /cmake)
7+ set (CMAKE_SKIP_BUILD_RPATH TRUE )
8+ if (NOT WIN32 )
9+ set (CMAKE_INSTALL_PREFIX "" ) # Skip all *nix-style installing for a while. Use DESTDIR
10+ endif ()
11+
12+ include (cotire)
13+
14+ function (xr_install tgt)
15+ if (NOT MSVC )
16+ install (TARGETS ${tgt} DESTINATION "."
17+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
18+ GROUP_READ GROUP_EXECUTE
19+ WORLD_READ WORLD_EXECUTE) # chmod 755
20+ else ()
21+ install (TARGETS ${tgt}
22+ CONFIGURATIONS Debug
23+ RUNTIME DESTINATION Debug/
24+ LIBRARY DESTINATION Debug/)
25+ install (FILES $<TARGET_PDB_FILE:${tgt} >
26+ CONFIGURATIONS Debug
27+ DESTINATION Debug/ )
28+ install (TARGETS ${tgt}
29+ CONFIGURATIONS Release
30+ RUNTIME DESTINATION Release/
31+ LIBRARY DESTINATION Release/)
32+ endif ()
33+ endfunction ()
34+
35+ # Use only if install defined outside target directory(like luabind, for example)
36+ function (xr_install_file tgt)
37+ if (NOT MSVC )
38+ install (FILES $<TARGET_FILE:${tgt} > DESTINATION "."
39+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
40+ GROUP_READ GROUP_EXECUTE
41+ WORLD_READ WORLD_EXECUTE) # chmod 755
42+ else ()
43+ install ($<TARGET_FILE:${tgt} >
44+ CONFIGURATIONS Debug
45+ RUNTIME DESTINATION Debug/)
46+ install (FILES $<TARGET_PDB_FILE:${tgt} >
47+ CONFIGURATIONS Debug
48+ DESTINATION Debug/ )
49+ install ($<TARGET_FILE:${tgt} >
50+ CONFIGURATIONS Release
51+ RUNTIME DESTINATION Release/)
52+ endif ()
53+ endfunction ()
754
855find_program (CCACHE_FOUND ccache)
956if (CCACHE_FOUND)
1057 set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
1158 set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
59+ set (ENV{CCACHE_SLOPPINESS} pch_defines,time_macros)
1260endif (CCACHE_FOUND)
1361
14- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive --std=c++17" )
62+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
63+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
64+ message (FATAL_ERROR "Building with a gcc version less than 7.0 is not supported." )
65+ endif ()
66+ endif ()
67+
68+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive --std=c++17 -Wno-attributes -pipe" )
1569#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") This is for the future versions
1670#set(CMAKE_CXX_STANDARD 14) #Otherwise adds -std=gnu++11 and breaks successful building
1771#set(CMAKE_CXX_STANDARD_REQUIRED ON)
1872#set(CMAKE_CXX_EXTENSIONS OFF)
1973
74+ set (LUA_LIBRARIES luajit)
75+
76+ if (NOT CMAKE_BUILD_TYPE )
77+ set (CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
78+ elseif (${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
79+ add_definitions (-DDEBUG)
80+ set (LUA_LIBRARIES luajit-debug)
81+ endif ()
82+
83+ set (LUA_FOUND true )
84+
85+ message ("CMake build ${CMAKE_BUILD_TYPE} , CFLAGS=${CMAKE_C_FLAGS} , CXXFLAGS=${CMAKE_CXX_FLAGS} " )
86+
2087add_definitions (-D_MT -D_CPPUNWIND -DPURE_DYNAMIC_CAST -DDECLARE_SPECIALIZATION -DM_NOSTDCONTAINERS_EXT -DUSE_OGL)
2188
2289set (LUA_INCLUDE_DIR Externals/LuaJIT/src)
23- set (LUA_LIBRARIES luajit)
24- set (LUA_FOUND 1)
90+
2591if (NOT WIN32 )
92+ if (EXISTS ${CMAKE_SOURCE_DIR} /Externals/cryptopp/dsa.h)
93+ file (REMOVE_RECURSE ${CMAKE_SOURCE_DIR} /Externals/cryptopp)
94+ file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR} /Externals/cryptopp)
95+ endif ()
96+ find_package (GLEW REQUIRED)
97+ find_package (FreeImage REQUIRED)
98+ find_package (LockFile REQUIRED)
99+ find_package (OpenAL REQUIRED)
26100find_package (Crypto++ REQUIRED)
27101find_package (PugiXML REQUIRED)
28102find_package (Theora REQUIRED)
29103find_package (OGG REQUIRED)
30104find_package (SDL2 REQUIRED)
31105find_package (LZO REQUIRED)
32106find_package (JPEG REQUIRED)
107+ find_package (TBB REQUIRED)
33108endif ()
34109
35110include_directories (${LUA_INCLUDE_DIR} )
0 commit comments