Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake #1

Merged
merged 4 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
.github
.vscode
*.o
*.Po
depcomp
ltmain.sh
traces.*
clearbounds
cleartiles
gentiles
.dirstamp
Makefile
libtool
install-sh
config.*
configure
compile
aclocal.m4
missing
output.*
requests
*.m4
Makefile.in
warp-sabre
build
102 changes: 102 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
cmake_minimum_required(VERSION 3.15)
project(warp-sabre LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

find_package(ImageMagick REQUIRED COMPONENTS Magick++)
include_directories(${ImageMagick_INCLUDE_DIRS})
execute_process(COMMAND Magickwand-config --libs OUTPUT_VARIABLE ImageMagick_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
add_compile_options(${ImageMagick_COMPILE_OPTIONS})
add_compile_options(-DUSE_MT_GENTILES)

find_package(Boost REQUIRED COMPONENTS program_options system thread)
find_package(LibXml2 REQUIRED)

include_directories(${LIBXML2_INCLUDE_DIR})

add_executable(warp-sabre
src/ImageWarpByFunc.cpp
src/ImgMagick.cpp
src/ReadDelimitedFile.cpp
src/StringUtils.cpp
src/Tile.cpp
src/TransformPoly.cpp
src/WarpOs.cpp
src/WriteKml.cpp
src/ganzc/LatLong-OSGBconversion.cpp
src/gbos1936/Gbos1936.cpp
)

add_executable(gentiles
src/CopyPixels.cpp
src/GenTiles.cpp
src/GetBounds.cpp
src/ImageWarpByFunc.cpp
src/ImgMagick.cpp
src/ReadDelimitedFile.cpp
src/ReadKmlFile.cpp
src/StringUtils.cpp
src/Tile.cpp
src/gbos1936/Gbos1936.cpp
)

add_executable(cleartiles
src/ClearTiles.cpp
src/GetBounds.cpp
src/ImageWarpByFunc.cpp
src/ImgMagick.cpp
src/ReadDelimitedFile.cpp
src/ReadKmlFile.cpp
src/StringUtils.cpp
src/Tile.cpp
src/gbos1936/Gbos1936.cpp
)

add_executable(clearbounds
src/ClearBounds.cpp
src/CopyPixels.cpp
src/GetBounds.cpp
src/ImageWarpByFunc.cpp
src/ImgMagick.cpp
src/ReadDelimitedFile.cpp
src/ReadKmlFile.cpp
src/StringUtils.cpp
src/Tile.cpp
src/gbos1936/Gbos1936.cpp
)

target_link_libraries(warp-sabre
PRIVATE ${ImageMagick_LIBRARIES}
PRIVATE -lboost_program_options-mt
PRIVATE -lboost_system-mt
PRIVATE -lmorph
PRIVATE -lnewmat
)

target_link_libraries(gentiles
PRIVATE ${ImageMagick_LIBRARIES}
PRIVATE xml2
PRIVATE -lboost_program_options-mt
PRIVATE -lboost_thread-mt
PRIVATE -lboost_system-mt
PRIVATE -lmorph
)

target_link_libraries(cleartiles
PRIVATE ${ImageMagick_LIBRARIES}
PRIVATE xml2
PRIVATE -lboost_program_options-mt
PRIVATE -lboost_thread-mt
PRIVATE -lboost_system-mt
PRIVATE -lmorph
)

target_link_libraries(clearbounds
PRIVATE ${ImageMagick_LIBRARIES}
PRIVATE xml2
PRIVATE -lboost_program_options-mt
PRIVATE -lboost_thread-mt
PRIVATE -lboost_system-mt
PRIVATE -lmorph
)
45 changes: 31 additions & 14 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,41 @@ For Debian Linux, you should be able to run :
sudo apt-get install libboost-dev libmorph-dev libmagickwand-dev g++ libxml-dev libnewmat10-dev

To build, type:
./bootstrap
./configure
mkdir build
cd build
cmake ..
make
sudo make install

==macOS==
For macOS using homebrew, a little more work is required
brew install llvm imagemagick boost xquartz
llvm is required because the stock macOS clang does not support
-fopenmp which is required by the ImageMagick C++ API
For macOS using homebrew:
brew install magick++ boost xquartz
Newmat and Xmorph must be installed manually into the homebrew directories
eg: /usr/local/lib for X86_64, /opt/homebrew/lib for arm64

Before calling configure, set the following environemnt variables to point
to homebrew. For arm64 macOS, these are:
CXX=/opt/homebrew/opt/llvm/bin/clang++
CXXFLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib -L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/libomp/lib
BOOST_ROOT=/opt/homebrew/include
MAGICKWAND_CFLAGS=`Magick++-config --cppflags`
MAGICKWAND_LIBS=`Magick++-config --libs`
To build, type:
mkdir build
cd build

(for x64) cmake -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/usr/local/include -DCMAKE_CXX_STANDARD_LIBRARIES=-L/usr/local/lib ..
(for arm64) cmake -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/opt/homebrew/include -DCMAKE_CXX_STANDARD_LIBRARIES=-L/opt/homebrew/lib ..

make
sudo make install

==Windows==
For Windows using mingw64
pacman -S imagemagick boost
Newmat and Xormph must be compiled and installed manually

Mingw64 doesn't play well with unix style file paths :-(

To build, type:
mkdir build
cd build

cmake \
-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/mingw64/include \
-DCMAKE_CXX_STANDARD_LIBRARIES=-L/mingw64/lib \
-DImageMagick_INCLUDE_DIRS=/mingw64/include/ImageMagick-7 \
-DLIBXML2_INCLUDE_DIR=/mingw64/include/libxml2 ..
2 changes: 0 additions & 2 deletions Makefile.am

This file was deleted.

6 changes: 0 additions & 6 deletions bootstrap

This file was deleted.

19 changes: 0 additions & 19 deletions configure.ac

This file was deleted.

Loading
Loading