From e025d5e0ef78ecb969027f520140e389980bece5 Mon Sep 17 00:00:00 2001 From: Sebastian Faubel Date: Tue, 26 Jul 2016 23:31:41 +0200 Subject: CMake on Windows produces same output as btool. Added inkscape.com and icon to inkview.exe Added msysenv.sh to support compiling using MSYS. (bzr r15023.1.1) --- CMakeScripts/Install.cmake | 10 +++++++++- mingwenv.bat | 2 +- mingwenv.cmake | 28 ++++++++++++++++++++++++++++ msysenv.sh | 34 ++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 27 ++++++++++++++------------- 5 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 msysenv.sh diff --git a/CMakeScripts/Install.cmake b/CMakeScripts/Install.cmake index aee0444de..ff6784fa7 100644 --- a/CMakeScripts/Install.cmake +++ b/CMakeScripts/Install.cmake @@ -11,10 +11,15 @@ if(WIN32) ${EXECUTABLE_OUTPUT_PATH}/inkview.exe DESTINATION ${CMAKE_INSTALL_PREFIX} ) + + install(PROGRAMS + ${EXECUTABLE_OUTPUT_PATH}/inkscape_com.exe + DESTINATION ${CMAKE_INSTALL_PREFIX} + RENAME inkscape.com + ) install(FILES ${LIBRARY_OUTPUT_PATH}/libinkscape_base.dll - ${LIBRARY_OUTPUT_PATH}/libgrid2.dll DESTINATION ${CMAKE_INSTALL_PREFIX} ) @@ -25,6 +30,9 @@ if(WIN32) NEWS README TRANSLATORS + GPL2.txt + GPL3.txt + LGPL2.1.txt DESTINATION ${CMAKE_INSTALL_PREFIX}) # There are differences in the devlibs for 64-Bit and 32-Bit build environments. diff --git a/mingwenv.bat b/mingwenv.bat index 054e5dcc6..255920668 100755 --- a/mingwenv.bat +++ b/mingwenv.bat @@ -2,7 +2,7 @@ REM ----------------------------------------------------------------------------- REM The paths in this file are used if you want to build Inkscape from the -REM the Windows built-in command line (i.e. MSYS). +REM the Windows built-in command line. REM ----------------------------------------------------------------------------- REM Directory containing the precompiled Inkscape libraries. Usually c:\devlibs or c:\devlibs64 diff --git a/mingwenv.cmake b/mingwenv.cmake index ab96541d8..df6131a16 100644 --- a/mingwenv.cmake +++ b/mingwenv.cmake @@ -158,6 +158,34 @@ if(HAVE_MINGW64) include_directories(${MINGW64_INCLUDE}) endif() +# ----------------------------------------------------------------------------- +# MSYS CHECKS +# ----------------------------------------------------------------------------- + +# Somehow the MSYS variable does not work as documented.. +if("${CMAKE_GENERATOR}" STREQUAL "MSYS Makefiles") + set(HAVE_MSYS ON) +else() + set(HAVE_MSYS OFF) +endif() + +# Set the path to the 'ar' utility for the MSYS shell as it fails to detect it properly. +if(HAVE_MSYS) + message(STATUS "Configuring MSYS environment:") + + if(NOT EXISTS ${CMAKE_AR}) + set(MINGW_AR ${MINGW_BIN}/ar.exe) + + if(EXISTS ${MINGW_AR}) + set(CMAKE_AR ${MINGW_AR} CACHE FILEPATH "Archive Utility") + else() + message(FATAL_ERROR "ar.exe not found.") + endif() + + message(STATUS " Setting path to ar.exe: ${CMAKE_AR}") + endif() +endif() + # ----------------------------------------------------------------------------- # GHOSTSCRIPT CHECKS # ----------------------------------------------------------------------------- diff --git a/msysenv.sh b/msysenv.sh new file mode 100644 index 000000000..88252a919 --- /dev/null +++ b/msysenv.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# The paths in this file are used if you want to build Inkscape from the +# the MSYS command line for Windows. +# ----------------------------------------------------------------------------- + +# Directory containing the precompiled Inkscape libraries. Usually /c/devlibs or /c/devlibs64 +if [ -z $DEVLIBS_PATH ]; then + export DEVLIBS_PATH="/c/devlibs64"; +fi + +# Directory containing the MinGW instance used for compilation. Usually /c/mingw or /c/mingw64 +# Note: Make sure there are no whitespaces in the path. MinGW doesn't like that.. :) +if [ -z $MINGW_PATH ]; then + export MINGW_PATH="/c/mingw64"; +fi +# Directory containing the (optional) Ghostscript installation. + +if [ -z $GS_PATH ]; then + export GS_PATH="/c/latex/gs/gs8.61"; +fi + +# ----------------------------------------------------------------------------- +echo Setting environment variables for MSYS build of Inkscape: +echo +echo "DEVLIBS_PATH: "$DEVLIBS_PATH +echo "MINGW_PATH: "$MINGW_PATH +echo "GS_PATH: "$GS_PATH + +# Include the MinGW environment in the path to prevent error messages during CMake configure. +export PATH=$DEVLIBS_PATH/bin:$DEVLIBS_PATH/python:$MINGW_PATH/bin:$PATH:$GS_PATH/bin + +# Also set the pkgconfig path to prevent error messages during CMake configure. +export PKG_CONFIG_PATH=$DEVLIBS_PATH/lib/pkgconfig diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d4ba9b1f0..ef855d950 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -418,7 +418,7 @@ set(inkscape_SRC verbs.h version.h ) - + # ----------------------------------------------------------------------------- # Generate version file # ----------------------------------------------------------------------------- @@ -484,35 +484,33 @@ set(inkscape_SRC # ----------------------------------------------------------------------------- # Setup the executable # ----------------------------------------------------------------------------- -#add_inkscape_lib(sp_LIB "${sp_SRC}") -#add_inkscape_lib(inkscape_LIB "${inkscape_SRC}") +set(main_SRC main.cpp) +set(view_SRC inkview.cpp) -if(WIN32) +if(WIN32) # Sources for the inkscape executable on Windows. - set(main_SRC + list(APPEND main_SRC registrytool.h registrytool.cpp - main.cpp winmain.cpp - #winconsole.cpp ) # Add the platform specific resource files (enabling the app icon). if(${HAVE_MINGW64}) list(APPEND main_SRC inkscape-x64.rc) + list(APPEND view_SRC inkscape-x64.rc) else() list(APPEND main_SRC inkscape.rc) + list(APPEND view_SRC inkscape.rc) endif() -else() - set(main_SRC main.cpp) + + # Build the windows MS-DOS console executable. + add_executable(inkscape_com winconsole.cpp) endif() -# Build everything except main and inkview.c in a shared library. -add_library(inkscape_base SHARED ${inkscape_SRC} ${sp_SRC}) - # make executables for inkscape and inkview add_executable(inkscape ${main_SRC}) -add_executable(inkview inkview.cpp) +add_executable(inkview ${view_SRC}) add_dependencies(inkscape inkscape_version) @@ -545,6 +543,9 @@ if (NOT "${WITH_EXT_GDL}") list (INSERT INKSCAPE_TARGET_LIBS 0 "gdl_LIB") endif() +# Build everything except main and inkview.c in a shared library. +add_library(inkscape_base SHARED ${inkscape_SRC} ${sp_SRC}) + # Link the inkscape_base library against all external dependencies target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS}) -- cgit v1.2.3