Skip to content

Commit

Permalink
Merge branch 'versioning-test' into gui
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritchie333 committed Oct 11, 2024
2 parents cde0d4e + d05b956 commit d55fc49
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
cmake .. \
-DLIBXML2_INCLUDE_DIR=$MINGW_PREFIX/include/libxml2 \
-DImageMagick_COMPILE_OPTIONS=`MagickWand-config --cppflags | sed 's/ /;/g'` \
-DImageMagick_LIBRARIES=`MagickWand-config --libs | sed 's/ /;/g'`
-DImageMagick_LIBRARIES=`MagickWand-config --libs | sed 's/ /;/g'` \
-DWARP_SABRE_VERSION=v2.0.0.${GITHUB_RUN_NUMBER}
# EOF
echo "::endgroup::"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ project(warp-sabre LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_BUILD_TYPE Debug)

find_package(ImageMagick REQUIRED COMPONENTS MagickWand)
include_directories(${ImageMagick_INCLUDE_DIRS})
add_compile_options(${ImageMagick_COMPILE_OPTIONS})
find_package(wxWidgets REQUIRED COMPONENTS core base)
add_compile_options(-DUSE_MT_GENTILES)
add_compile_options(-Wall)
add_compile_options(-DWARP_SABRE_VERSION=${WARP_SABRE_VERSION})

find_package(Boost REQUIRED COMPONENTS system thread)
find_package(LibXml2 REQUIRED)
Expand Down
9 changes: 4 additions & 5 deletions src/ClearTiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ int main(int argc, char **argv)
string outFolder = "out";
int minZoom = 1;
int maxZoom = 17;
if (po.HasArg("help"))
{
cout << desc.str() << endl;
exit(0);
}

DEFINE_VERSION( po )
DEFINE_HELP( po, desc )

if (po.HasArg("output"))
outFolder = po.GetArg("output");
if (po.HasArg("out"))
Expand Down
22 changes: 3 additions & 19 deletions src/GenTiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@ int main(int argc, char **argv)
{
ImgMagick::Init();

// Image imageInOut("step.jpg");
// imageInOut.crop( Geometry(255,255,0,0) );
// imageInOut.write("test2.png");

/*class Tile test;
vector<string> test2;
string test3;
int retOpen = ReadKmlFile("/home/tim/dev/os7files/rect/73.kml", test, test3, test2);
exit(0);*/

// cout << long2tile(-3.68, zoom) << "," << lat2tile(54.8333,zoom) << endl;
// cout << long2tile(-3.04, zoom) << "," << lat2tile(55.2446,zoom) << endl;

class DelimitedFile boundsFile;

string outFolder = "out";
Expand Down Expand Up @@ -79,11 +65,9 @@ int main(int argc, char **argv)

ProgramOptions po(argc, argv);

if (po.HasArg("help"))
{
cout << desc.str() << endl;
exit(0);
}
DEFINE_VERSION( po )
DEFINE_HELP( po, desc )

if (po.HasArg("minzoom"))
minZoom = po.GetIntArg("minzoom");
if (po.HasArg("maxzoom"))
Expand Down
12 changes: 12 additions & 0 deletions src/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,4 +384,16 @@ int fileExists(const char *path)
{
return false;
}
}

const string version( const char* pname )
{
string result = RemoveFilePath( pname );
#ifdef WARP_SABRE_VERSION
result += " ";
result += XSTR(WARP_SABRE_VERSION);
#else
result += " internal";
#endif
return result;
}
11 changes: 11 additions & 0 deletions src/StringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,15 @@ string ToString(T input)
return out.str();
}

const string version( const char* pname );

#define XSTR(x) STR(x)
#define STR(x) #x

#define DEFINE_VERSION(po) \
if( po.HasArg( "version" )) { cout << version( argv[ 0 ] ) << endl; exit(0); }

#define DEFINE_HELP(po, desc) \
if (po.HasArg("help")) { cout << desc.str() << endl; exit(0); }

#endif // STRING_UTILS_H
8 changes: 3 additions & 5 deletions src/WarpOs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ int main(int argc, char *argv[])
po.AddAlias('h', "height");
po.AddAlias('n', "name");

if (po.HasArg("help"))
{
cout << desc.str() << endl;
exit(0);
}
DEFINE_VERSION( po )
DEFINE_HELP( po, desc )

if (po.HasArg("in"))
{
warp.inputImageFilename = po.GetArg("in");
Expand Down

0 comments on commit d55fc49

Please sign in to comment.