Build under Windows
This commit is contained in:
parent
afe4be595f
commit
e8e4d885c5
4 changed files with 59 additions and 32 deletions
|
@ -23,6 +23,46 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||||
FORCE)
|
FORCE)
|
||||||
endif(NOT CMAKE_BUILD_TYPE)
|
endif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
|
||||||
|
if (CMAKE_CL_64)
|
||||||
|
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty.x64")
|
||||||
|
else (CMAKE_CL_64)
|
||||||
|
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty")
|
||||||
|
endif (CMAKE_CL_64)
|
||||||
|
if (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
set(MSVC_3RDPARTY_ROOT ${PARENT_DIR} CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
|
else (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
|
endif (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
else (MSVC)
|
||||||
|
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
|
endif (MSVC)
|
||||||
|
|
||||||
|
if (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
|
message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_ROOT}")
|
||||||
|
set( OSG_MSVC "msvc" )
|
||||||
|
if (${MSVC_VERSION} EQUAL 1600)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}100 )
|
||||||
|
else (${MSVC_VERSION} EQUAL 1600)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}90 )
|
||||||
|
endif (${MSVC_VERSION} EQUAL 1600)
|
||||||
|
if (CMAKE_CL_64)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}-64 )
|
||||||
|
set( MSVC_3RDPARTY_DIR 3rdParty.x64 )
|
||||||
|
else (CMAKE_CL_64)
|
||||||
|
set( MSVC_3RDPARTY_DIR 3rdParty )
|
||||||
|
endif (CMAKE_CL_64)
|
||||||
|
|
||||||
|
set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/SimGear/lib )
|
||||||
|
set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/SimGear/include)
|
||||||
|
set (BOOST_ROOT ${MSVC_3RDPARTY_ROOT}/boost_1_44_0)
|
||||||
|
set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include)
|
||||||
|
set (ALUT_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include)
|
||||||
|
set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib)
|
||||||
|
endif (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
|
|
||||||
option(ENABLE_GDAL "Set to ON to build TerraGear with GDAL support" ON)
|
option(ENABLE_GDAL "Set to ON to build TerraGear with GDAL support" ON)
|
||||||
|
|
||||||
# check required dependencies
|
# check required dependencies
|
||||||
|
|
|
@ -36,10 +36,6 @@
|
||||||
#include <Array/array.hxx>
|
#include <Array/array.hxx>
|
||||||
#include <Polygon/point2d.hxx>
|
#include <Polygon/point2d.hxx>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
# include <Win32/mkdir.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
|
|
@ -36,16 +36,15 @@
|
||||||
#include <simgear/bucket/newbucket.hxx>
|
#include <simgear/bucket/newbucket.hxx>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/io/lowlevel.hxx>
|
#include <simgear/io/lowlevel.hxx>
|
||||||
|
#include <simgear/misc/sg_path.hxx>
|
||||||
#ifdef _MSC_VER
|
|
||||||
# include <Win32/mkdir.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gdal.h>
|
#include <gdal.h>
|
||||||
#include <gdal_priv.h>
|
#include <gdal_priv.h>
|
||||||
#include <gdalwarper.h>
|
#include <gdalwarper.h>
|
||||||
#include <ogr_spatialref.h>
|
#include <ogr_spatialref.h>
|
||||||
|
|
||||||
|
#include <boost/scoped_array.hpp>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
@ -296,15 +295,11 @@ void write_bucket(const string& work_dir, SGBucket bucket,
|
||||||
int span_x, int span_y,
|
int span_x, int span_y,
|
||||||
int col_step, int row_step,
|
int col_step, int row_step,
|
||||||
bool compress=true) {
|
bool compress=true) {
|
||||||
string base = bucket.gen_base_path();
|
SGPath path(work_dir);
|
||||||
string path = work_dir + "/" + base;
|
path.append(bucket.gen_base_path());
|
||||||
#ifdef _MSC_VER
|
path.create_dir( 0755 );
|
||||||
fg_mkdir( path.c_str() );
|
|
||||||
#else
|
string array_file = path.str() + "/" + bucket.gen_index_str() + ".arr";
|
||||||
string command = "mkdir -p " + path;
|
|
||||||
system( command.c_str() );
|
|
||||||
#endif
|
|
||||||
string array_file = path + "/" + bucket.gen_index_str() + ".arr";
|
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
if ( (fp = fopen(array_file.c_str(), "w")) == NULL ) {
|
if ( (fp = fopen(array_file.c_str(), "w")) == NULL ) {
|
||||||
|
@ -359,15 +354,15 @@ void process_bucket(const string& work_dir, SGBucket bucket,
|
||||||
span_y=bucket.get_height()*3600/row_step;
|
span_y=bucket.get_height()*3600/row_step;
|
||||||
|
|
||||||
int cellcount=(span_x+1)*(span_y+1);
|
int cellcount=(span_x+1)*(span_y+1);
|
||||||
int buffer[cellcount];
|
boost::scoped_array<int> buffer(new int[cellcount]);
|
||||||
|
|
||||||
::memset(buffer,-1,(span_x+1)*(span_y+1)*sizeof(int));
|
::memset(buffer.get(),-1,(span_x+1)*(span_y+1)*sizeof(int));
|
||||||
|
|
||||||
for (int i=0;i<imagecount;i++) {
|
for (int i=0;i<imagecount;i++) {
|
||||||
double inorth,isouth,ieast,iwest;
|
double inorth,isouth,ieast,iwest;
|
||||||
images[i]->GetBounds(inorth,isouth,ieast,iwest);
|
images[i]->GetBounds(inorth,isouth,ieast,iwest);
|
||||||
|
|
||||||
images[i]->GetDataChunk(buffer,
|
images[i]->GetDataChunk(buffer.get(),
|
||||||
bwest, bsouth,
|
bwest, bsouth,
|
||||||
col_step/3600.0, row_step/3600.0,
|
col_step/3600.0, row_step/3600.0,
|
||||||
span_x+1, span_y+1);
|
span_x+1, span_y+1);
|
||||||
|
@ -397,7 +392,7 @@ void process_bucket(const string& work_dir, SGBucket bucket,
|
||||||
|
|
||||||
/* ...and write it out */
|
/* ...and write it out */
|
||||||
write_bucket(work_dir, bucket,
|
write_bucket(work_dir, bucket,
|
||||||
buffer,
|
buffer.get(),
|
||||||
min_x, min_y,
|
min_x, min_y,
|
||||||
span_x, span_y,
|
span_x, span_y,
|
||||||
col_step, row_step);
|
col_step, row_step);
|
||||||
|
@ -412,14 +407,9 @@ int main(int argc, const char **argv) {
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
string work_dir = argv[1];
|
SGPath work_dir( argv[1] );
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
work_dir.create_dir( 0755 );
|
||||||
fg_mkdir( work_dir.c_str() );
|
|
||||||
#else
|
|
||||||
string command = "mkdir -p " + work_dir;
|
|
||||||
system( command.c_str() );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GDALAllRegister();
|
GDALAllRegister();
|
||||||
|
|
||||||
|
@ -444,7 +434,7 @@ int main(int argc, const char **argv) {
|
||||||
const char** tilenames=argv+dashpos+1;
|
const char** tilenames=argv+dashpos+1;
|
||||||
const char** datasetnames=argv+2;
|
const char** datasetnames=argv+2;
|
||||||
|
|
||||||
ImageInfo *images[datasetcount];
|
boost::scoped_array<ImageInfo *> images( new ImageInfo *[datasetcount] );
|
||||||
|
|
||||||
double north=-1000,south=1000,east=-1000,west=1000;
|
double north=-1000,south=1000,east=-1000,west=1000;
|
||||||
|
|
||||||
|
@ -504,7 +494,7 @@ int main(int argc, const char **argv) {
|
||||||
for (int y=0;y<=dy;y++) {
|
for (int y=0;y<=dy;y++) {
|
||||||
SGBucket bucket=sgBucketOffset(west,south,x,y);
|
SGBucket bucket=sgBucketOffset(west,south,x,y);
|
||||||
|
|
||||||
process_bucket(work_dir,bucket,images,datasetcount);
|
process_bucket(work_dir.str(),bucket,images.get(),datasetcount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -515,7 +505,7 @@ int main(int argc, const char **argv) {
|
||||||
for (int i=0;i<tilecount;i++) {
|
for (int i=0;i<tilecount;i++) {
|
||||||
SGBucket bucket(atol(tilenames[i]));
|
SGBucket bucket(atol(tilenames[i]));
|
||||||
|
|
||||||
process_bucket(work_dir,bucket,images,datasetcount,true);
|
process_bucket(work_dir.str(),bucket,images.get(),datasetcount,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,10 @@ add_library(Terra STATIC
|
||||||
Quadedge.cc Quadedge.h
|
Quadedge.cc Quadedge.h
|
||||||
Subdivision.cc Subdivision.h
|
Subdivision.cc Subdivision.h
|
||||||
Vec2.h Vec3.h
|
Vec2.h Vec3.h
|
||||||
|
getopt.c getopt.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(terra_bin
|
add_executable(terra_bin
|
||||||
cmdline.cc getopt.c getopt.h greedy.cc output.cc terra.cc terra.h version.h)
|
cmdline.cc greedy.cc output.cc terra.cc terra.h version.h)
|
||||||
|
|
||||||
target_link_libraries(terra_bin Terra)
|
target_link_libraries(terra_bin Terra)
|
||||||
|
|
Loading…
Add table
Reference in a new issue