Skip to content

Commit

Permalink
update cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Mar 10, 2022
1 parent eece009 commit b8fb7a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
34 changes: 18 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,24 @@ if(WIN32)
set(ICON_FILE ${CC_RESOURCE_FOLDER}/cyan.ico)
endif()

find_package(Qt5Widgets REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Test REQUIRED)
find_package(Qt5 5.9 REQUIRED Core Gui Widgets Concurrent Test)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../lib/cmake/modules/")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")

option(DEPLOY "Deploy" OFF)
option(USE_PKG_CONFIG "Use pkg-config" ON)
option(USE_Q32 "Q32 workaround if not using pkg-config" OFF)

if(MINGW OR APPLE)
find_package(OpenMP)
endif()

if(MINGW)
find_package(Threads)
if(DEPLOY)
if(MINGW OR APPLE)
find_package(OpenMP)
endif()
if(MINGW)
find_package(Threads)
endif()
endif()

if(USE_PKG_CONFIG)
Expand Down Expand Up @@ -124,19 +124,21 @@ endif()
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${RESOURCES_FILES})
add_executable(tests ${TEST_SOURCES} ${TEST_HEADERS} ${TEST_RESOURCES_FILES})

target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} Qt5::Concurrent)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent)
target_link_libraries(tests Qt5::Test)

if(MINGW)
if(MINGW AND DEPLOY)
target_link_libraries(${PROJECT_NAME} Threads::Threads)
endif()

if(USE_PKG_CONFIG)
target_link_libraries(${PROJECT_NAME} ${MAGICK_STATIC_LIBRARIES} ${LCMS2_LIBRARIES} ${MAGICK_LDFLAGS} ${LCMS2_LDFLAGS})
target_link_libraries(tests ${MAGICK_STATIC_LIBRARIES} ${LCMS2_LIBRARIES} ${MAGICK_LDFLAGS} ${LCMS2_LDFLAGS})
#target_link_libraries(${PROJECT_NAME} ${MAGICK_STATIC_LIBRARIES} ${LCMS2_STATIC_LIBRARIES} ${MAGICK_STATIC_LDFLAGS} ${LCMS2_STATIC_LDFLAGS})
#target_link_libraries(tests ${MAGICK_STATIC_LIBRARIES} ${LCMS2_STATIC_LIBRARIES} ${MAGICK_STATIC_LDFLAGS} ${LCMS2_STATIC_LDFLAGS})
if (DEPLOY)
target_link_libraries(${PROJECT_NAME} ${MAGICK_STATIC_LIBRARIES} ${LCMS2_LIBRARIES} ${MAGICK_LDFLAGS} ${LCMS2_LDFLAGS})
target_link_libraries(tests ${MAGICK_STATIC_LIBRARIES} ${LCMS2_LIBRARIES} ${MAGICK_LDFLAGS} ${LCMS2_LDFLAGS})
else()
target_link_libraries(${PROJECT_NAME} ${MAGICK_LIBRARIES} ${LCMS2_LIBRARIES} ${MAGICK_LDFLAGS} ${LCMS2_LDFLAGS})
target_link_libraries(tests ${MAGICK_LIBRARIES} ${LCMS2_LIBRARIES} ${MAGICK_LDFLAGS} ${LCMS2_LDFLAGS})
endif()
else()
target_link_libraries(${PROJECT_NAME} ${LCMS2_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${ImageMagick_LIBRARIES})
Expand Down
18 changes: 9 additions & 9 deletions res/magick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e -x
CWD=`pwd`
OS=`uname -s`
SDK=${SDK:-/opt/$OS}
MAGICK=${MAGICK:-"7.0.8-68"}
MAGICK=${MAGICK:-"6.9.12-23"}
OSX_MIN=10.7
CLANG_VER=mp-6.0
CLANG_PATH=/opt/local/bin
Expand All @@ -17,7 +17,7 @@ else
DEFAULT_FLAGS="-fPIC -march=core2 -mtune=corei7-avx $DEFAULT_FLAGS"
fi

DEFAULT_CONFIGURE="--prefix=${SDK} --disable-shared --enable-static --disable-docs --disable-deprecated --with-magick-plus-plus=yes --with-quantum-depth=16 --without-dps --without-djvu --without-fftw --without-fpx --without-gslib --without-gvc --without-jbig --with-jpeg --with-lcms2 --without-openjp2 --without-lqr --with-lzma --without-openexr --without-pango --with-png --without-rsvg --with-tiff --without-webp --without-xml --with-zlib --with-bzlib --enable-hdri --without-freetype --without-fontconfig --without-x --without-modules"
DEFAULT_CONFIGURE="--prefix=${SDK} --disable-shared --enable-static --disable-docs --disable-deprecated --with-magick-plus-plus=yes --with-quantum-depth=16 --without-dps --without-djvu --without-fftw --without-fpx --without-heic --without-gslib --without-gvc --without-jbig --with-jpeg --with-lcms2 --without-openjp2 --without-lqr --with-lzma --without-openexr --without-pango --with-png --without-rsvg --with-tiff --without-webp --without-xml --with-zlib --with-bzlib --enable-hdri --without-freetype --without-fontconfig --without-x --without-modules"

if [ "$OS" = "Darwin" ]; then
export CC="${CLANG_PATH}/clang-${CLANG_VER} -stdlib=libc++ -mmacosx-version-min=$OSX_MIN"
Expand All @@ -27,19 +27,19 @@ fi
export PKG_CONFIG_PATH="$SDK/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH=$SDK/bin:/usr/bin:/usr/sbin:/bin:/sbin

git clone https://github.com/ImageMagick/ImageMagick
cd ImageMagick
git clone https://github.com/ImageMagick/ImageMagick6
cd ImageMagick6
git checkout $MAGICK
cd $CWD
mkdir build-magick && cd build-magick
EXTRA_LDFLAGS=""
if [ "$OS" = "Darwin" ]; then
EXTRA_LDFLAGS="-mmacosx-version-min=$OSX_MIN"
fi
LDFLAGS="$EXTRA_LDFLAGS" LIBS="-lz -llzma" CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ../ImageMagick/configure $DEFAULT_CONFIGURE
sed -i'.original' -e 's/-ltiff/-ltiff -llzma/g' ../ImageMagick/configure
LIBS="-lz -llzma" CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ../ImageMagick/configure $DEFAULT_CONFIGURE
make -j$JOBS || exit 1
make install || exit 1
LDFLAGS="$EXTRA_LDFLAGS" LIBS="-lz -llzma" CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ../ImageMagick6/configure $DEFAULT_CONFIGURE
sed -i'.original' -e 's/-ltiff/-ltiff -llzma/g' ../ImageMagick6/configure
LIBS="-lz -llzma" CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ../ImageMagick6/configure $DEFAULT_CONFIGURE
make -j$JOBS
make install

echo "Done!"

0 comments on commit b8fb7a9

Please sign in to comment.