Skip to content

Commit f5a79b2

Browse files
committed
Update CMakeLists and some code for building on Linux
1 parent e061f14 commit f5a79b2

35 files changed

+677
-87
lines changed

CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 2.8.0)
2+
project(OpenXRay)
3+
4+
include(${PROJECT_SOURCE_DIR}/cmake/utils.cmake)
5+
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
6+
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive --std=c++17")
8+
9+
add_definitions(-D_MT -D_CPPUNWIND -DPURE_DYNAMIC_CAST -DDECLARE_SPECIALIZATION -DM_NOSTDCONTAINERS_EXT -DUSE_OGL)
10+
11+
set(LUA_INCLUDE_DIR Externals/luajit/src)
12+
set(LUA_LIBRARIES luajit)
13+
set(LUA_FOUND 1)
14+
if (NOT WIN32)
15+
find_package(OpenSSL REQUIRED)
16+
find_package(Theora REQUIRED)
17+
find_package(OGG REQUIRED)
18+
find_package(SDL2 REQUIRED)
19+
find_package(LZO REQUIRED)
20+
find_package(JPEG REQUIRED)
21+
endif()
22+
23+
include_directories(${LUA_INCLUDE_DIR})
24+
include_directories(${CMAKE_SOURCE_DIR} {CMAKE_SOURCE_DIR}/Common ${CMAKE_SOURCE_DIR}/Externals ${CMAKE_SOURCE_DIR}/Externals/gli/external/glm ${CMAKE_SOURCE_DIR}/../sdk/include/loki)
25+
26+
add_subdirectory(Externals)
27+
add_subdirectory(src)

Externals/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
add_subdirectory(luajit)
2+
add_subdirectory(luabind)
3+
add_subdirectory(lzo)
4+
add_subdirectory(cximage)
5+
add_subdirectory(NVTT)
6+
#add_subdirectory(gli)
7+
#add_subdirectory(glew)

Externals/NVTT/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 2.8.0)
2+
project(nvtt)
3+
add_definitions(-DHAVE_SIGNAL_H -DHAVE_EXECINFO_H)
4+
add_subdirectory(src/nvcore)
5+
add_subdirectory(src/nvimage)
6+
add_subdirectory(src/nvmath)
7+
add_subdirectory(src/nvtt)

Externals/NVTT/src/nvcore/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SET(CORE_SRCS
2323
Library.h
2424
Library.cpp)
2525

26-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
26+
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
2727

2828
# targets
2929
ADD_DEFINITIONS(-DNVCORE_EXPORTS)

Externals/NVTT/src/nvcore/Debug.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#endif
2929

3030
#if NV_OS_LINUX && defined(HAVE_EXECINFO_H)
31+
# include <sys/types.h>
32+
# include <unistd.h> // getpid
3133
# include <execinfo.h> // backtrace
3234
# if NV_CC_GNUC // defined(HAVE_CXXABI_H)
3335
# include <cxxabi.h>

Externals/NVTT/src/nvcore/Debug.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@
3030

3131
#else // NV_NO_ASSERT
3232

33+
# if NV_CC_MSVC
34+
// @@ Does this work in msvc-6 and earlier?
35+
# define nvDebugBreak() __debugbreak()
36+
//# define nvDebugBreak() __asm { int 3 }
37+
# elif NV_OS_ORBIS
38+
# define nvDebugBreak() __debugbreak()
39+
# elif NV_CC_GNUC
40+
# define nvDebugBreak() __builtin_trap()
41+
# else
42+
# error "No nvDebugBreak()!"
43+
# endif
44+
45+
/*
3346
# if NV_CC_MSVC
3447
// @@ Does this work in msvc-6 and earlier?
3548
// @@ Do I have to include <intrin.h> ?
@@ -39,13 +52,14 @@
3952
# define nvDebugBreak() __asm__ volatile ("trap");
4053
# elif NV_CC_GNUC && NV_CPU_X86 && NV_OS_DARWIN
4154
# define nvDebugBreak() __asm__ volatile ("int3");
42-
# elif NV_CC_GNUC && NV_CPU_X86
55+
# elif NV_CC_GNUC && NV_CPU_X86
4356
# define nvDebugBreak() __asm__ ( "int %0" : :"I"(3) )
4457
# else
4558
# include <signal.h>
4659
# define nvDebugBreak() raise(SIGTRAP);
4760
// define nvDebugBreak() *((int *)(0)) = 0
4861
# endif
62+
*/
4963

5064
# define nvAssertMacro(exp) \
5165
do { \

Externals/NVTT/src/nvimage/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PROJECT(nvimage)
22

3-
SET(IMAGE_SRCS
3+
SET(IMAGE_SRCS
44
nvimage.h
55
FloatImage.h
66
FloatImage.cpp
@@ -27,7 +27,7 @@ SET(IMAGE_SRCS
2727
PsdFile.h
2828
TgaFile.h)
2929

30-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
30+
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
3131

3232
IF(PNG_FOUND)
3333
SET(LIBS ${LIBS} ${PNG_LIBRARIES})

Externals/NVTT/src/nvimage/ImageIO.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ FloatImage * nv::ImageIO::loadFloat(const char * fileName)
135135
StdInputStream stream(fileName);
136136

137137
if (stream.isError()) {
138-
return false;
138+
return NULL;
139139
}
140140

141141
return loadFloat(fileName, stream);
@@ -233,7 +233,7 @@ Image * nv::ImageIO::loadTGA(Stream & s)
233233
case TGA_TYPE_INDEXED:
234234
if( tga.colormap_type!=1 || tga.colormap_size!=24 || tga.colormap_length>256 ) {
235235
nvDebug( "*** ImageIO::loadTGA: Error, only 24bit paletted images are supported.\n" );
236-
return false;
236+
return NULL;
237237
}
238238
pal = true;
239239
break;
@@ -254,7 +254,7 @@ Image * nv::ImageIO::loadTGA(Stream & s)
254254

255255
default:
256256
nvDebug( "*** ImageIO::loadTGA: Error, unsupported image type.\n" );
257-
return false;
257+
return NULL;
258258
}
259259

260260
const uint pixel_size = (tga.pixel_size/8);

Externals/NVTT/src/nvmath/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SET(MATH_SRCS
1313
Basis.h Basis.cpp
1414
Triangle.h Triangle.cpp TriBox.cpp)
1515

16-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
16+
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
1717

1818
# targets
1919
ADD_DEFINITIONS(-DNVMATH_EXPORTS)

Externals/NVTT/src/nvmath/TriBox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/********************************************************/
22
/* AABB-triangle overlap test code */
3-
/* by Tomas Akenine-Möller */
3+
/* by Tomas Akenine-Möller */
44
/* Function: int triBoxOverlap(float boxcenter[3], */
55
/* float boxhalfsize[3],float triverts[3][3]); */
66
/* History: */

0 commit comments

Comments
 (0)