1
0
Fork 0

Build under Windows

This commit is contained in:
Frederic Bouvier 2011-10-26 22:19:01 +02:00
parent afe4be595f
commit e8e4d885c5
4 changed files with 59 additions and 32 deletions

View file

@ -23,6 +23,46 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
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)
# check required dependencies

View file

@ -36,10 +36,6 @@
#include <Array/array.hxx>
#include <Polygon/point2d.hxx>
#ifdef _MSC_VER
# include <Win32/mkdir.hpp>
#endif
#include <stdlib.h>
using std::cout;

View file

@ -36,16 +36,15 @@
#include <simgear/bucket/newbucket.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/io/lowlevel.hxx>
#ifdef _MSC_VER
# include <Win32/mkdir.hpp>
#endif
#include <simgear/misc/sg_path.hxx>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <ogr_spatialref.h>
#include <boost/scoped_array.hpp>
using std::cout;
using std::string;
@ -296,15 +295,11 @@ void write_bucket(const string& work_dir, SGBucket bucket,
int span_x, int span_y,
int col_step, int row_step,
bool compress=true) {
string base = bucket.gen_base_path();
string path = work_dir + "/" + base;
#ifdef _MSC_VER
fg_mkdir( path.c_str() );
#else
string command = "mkdir -p " + path;
system( command.c_str() );
#endif
string array_file = path + "/" + bucket.gen_index_str() + ".arr";
SGPath path(work_dir);
path.append(bucket.gen_base_path());
path.create_dir( 0755 );
string array_file = path.str() + "/" + bucket.gen_index_str() + ".arr";
FILE *fp;
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;
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++) {
double inorth,isouth,ieast,iwest;
images[i]->GetBounds(inorth,isouth,ieast,iwest);
images[i]->GetDataChunk(buffer,
images[i]->GetDataChunk(buffer.get(),
bwest, bsouth,
col_step/3600.0, row_step/3600.0,
span_x+1, span_y+1);
@ -397,7 +392,7 @@ void process_bucket(const string& work_dir, SGBucket bucket,
/* ...and write it out */
write_bucket(work_dir, bucket,
buffer,
buffer.get(),
min_x, min_y,
span_x, span_y,
col_step, row_step);
@ -412,14 +407,9 @@ int main(int argc, const char **argv) {
exit(-1);
}
string work_dir = argv[1];
SGPath work_dir( argv[1] );
#ifdef _MSC_VER
fg_mkdir( work_dir.c_str() );
#else
string command = "mkdir -p " + work_dir;
system( command.c_str() );
#endif
work_dir.create_dir( 0755 );
GDALAllRegister();
@ -444,7 +434,7 @@ int main(int argc, const char **argv) {
const char** tilenames=argv+dashpos+1;
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;
@ -504,7 +494,7 @@ int main(int argc, const char **argv) {
for (int y=0;y<=dy;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 {
@ -515,7 +505,7 @@ int main(int argc, const char **argv) {
for (int i=0;i<tilecount;i++) {
SGBucket bucket(atol(tilenames[i]));
process_bucket(work_dir,bucket,images,datasetcount,true);
process_bucket(work_dir.str(),bucket,images.get(),datasetcount,true);
}
}

View file

@ -7,9 +7,10 @@ add_library(Terra STATIC
Quadedge.cc Quadedge.h
Subdivision.cc Subdivision.h
Vec2.h Vec3.h
getopt.c getopt.h
)
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)