diff options
Diffstat (limited to 'CMakeScripts')
| -rw-r--r-- | CMakeScripts/ConfigCompileFlags.cmake | 15 | ||||
| -rw-r--r-- | CMakeScripts/DefineDependsandFlags.cmake | 46 | ||||
| -rw-r--r-- | CMakeScripts/Install.cmake | 84 | ||||
| -rwxr-xr-x | CMakeScripts/cmake_consistency_check.py | 212 |
4 files changed, 179 insertions, 178 deletions
diff --git a/CMakeScripts/ConfigCompileFlags.cmake b/CMakeScripts/ConfigCompileFlags.cmake index 453ceef21..fa2362cd2 100644 --- a/CMakeScripts/ConfigCompileFlags.cmake +++ b/CMakeScripts/ConfigCompileFlags.cmake @@ -1,26 +1,19 @@ -set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") -add_definitions(-Wall -Wformat-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch) -add_definitions(-O2) - # Define the flags for profiling if desired: if(WITH_PROFILING) set(COMPILE_PROFILING_FLAGS "-pg") set(LINK_PROFILING_FLAGS "-pg") endif() -add_definitions(-DVERSION=\\\"${INKSCAPE_VERSION}\\\") +# add_definitions(-DVERSION=\\\"${INKSCAPE_VERSION}\\\") add_definitions(${DEFINE_FLAGS} -DHAVE_CONFIG_H -D_INTL_REDIRECT_INLINE) if(WIN32) add_definitions(-DXP_WIN) endif(WIN32) -# For Inkboard: -add_definitions(-DHAVE_SSL "-DRELAYTOOL_SSL=\"static const int libssl_is_present=1; static int __attribute__((unused)) libssl_symbol_is_present(char *s){ return 1; }\"") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_PROFILING_FLAGS} ") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILE_PROFILING_FLAGS} ") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 ${COMPILE_PROFILING_FLAGS} ") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 ${COMPILE_PROFILING_FLAGS} ") set(CMAKE_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM} ") -# message(STATUS "${CMAKE_CXX_FLAGS}") +message(STATUS "${CMAKE_CXX_FLAGS}") diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index b708484af..e3bc9258e 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -12,6 +12,12 @@ list(APPEND INKSCAPE_INCS ${PROJECT_SOURCE_DIR} ) # ---------------------------------------------------------------------------- +# Add C++11 standard compliance +# TODO: Add a proper check for compiler compliance here +# ---------------------------------------------------------------------------- +list(APPEND INKSCAPE_CXX_FLAGS "-std=c++11") + +# ---------------------------------------------------------------------------- # Files we include # ---------------------------------------------------------------------------- if(WIN32) @@ -38,7 +44,14 @@ if(WIN32) endif() endif() -pkg_check_modules(INKSCAPE_DEP REQUIRED pangocairo pangoft2 fontconfig gthread-2.0 gsl gmodule-2.0) +pkg_check_modules(INKSCAPE_DEP REQUIRED + harfbuzz + pangocairo + pangoft2 + fontconfig + gthread-2.0 + gsl + gmodule-2.0) list(APPEND INKSCAPE_LIBS ${INKSCAPE_DEP_LDFLAGS}) list(APPEND INKSCAPE_INCS_SYS ${INKSCAPE_DEP_INCLUDE_DIRS}) @@ -237,7 +250,6 @@ endif() set(TRY_GTKSPELL 1) # Include dependencies: # use patched version until GTK2_CAIROMMCONFIG_INCLUDE_DIR is added -if("${WITH_GTK3_EXPERIMENTAL}") pkg_check_modules( GTK3 REQUIRED @@ -247,11 +259,7 @@ if("${WITH_GTK3_EXPERIMENTAL}") gdk-3.0>=3.8 gdl-3.0>=3.4 ) - message("Using EXPERIMENTAL Gtkmm 3 build") list(APPEND INKSCAPE_CXX_FLAGS ${GTK3_CFLAGS_OTHER}) - set(WITH_GTKMM_3_0 1) - message("Using external GDL") - set(WITH_EXT_GDL 1) # Check whether we can use new features in Gtkmm 3.10 # TODO: Drop this test and bump the version number in the GTK test above @@ -291,32 +299,6 @@ if("${WITH_GTK3_EXPERIMENTAL}") ${GTK3_LIBRARIES} ${GTKSPELL3_LIBRARIES} ) -else() - pkg_check_modules(GTK REQUIRED - gtkmm-2.4>=2.24 - gdkmm-2.4 - gtk+-2.0 - gdk-2.0 - ) - list(APPEND INKSCAPE_CXX_FLAGS ${GTK_CFLAGS_OTHER}) - pkg_check_modules(GTKSPELL2 gtkspell-2.0) - if("${GTKSPELL2_FOUND}") - message("Using GtkSpell 2") - add_definitions(${GTKSPELL2_CFLAGS_OTHER}) - set (WITH_GTKSPELL 1) - else() - unset(WITH_GTKSPELL) - endif() - list(APPEND INKSCAPE_INCS_SYS - ${GTK_INCLUDE_DIRS} - ${GTKSPELL2_INCLUDE_DIRS} - ) - - list(APPEND INKSCAPE_LIBS - ${GTK_LIBRARIES} - ${GTKSPELL2_LIBRARIES} - ) -endif() find_package(Freetype REQUIRED) list(APPEND INKSCAPE_INCS_SYS ${FREETYPE_INCLUDE_DIRS}) diff --git a/CMakeScripts/Install.cmake b/CMakeScripts/Install.cmake index ff6784fa7..f20979742 100644 --- a/CMakeScripts/Install.cmake +++ b/CMakeScripts/Install.cmake @@ -1,4 +1,4 @@ -if(UNIX)
+if(UNIX)
#The install directive for the binaries and libraries are found in src/CMakeList.txt
install(FILES
${CMAKE_BINARY_DIR}/inkscape.desktop
@@ -11,7 +11,7 @@ if(WIN32) ${EXECUTABLE_OUTPUT_PATH}/inkview.exe
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
-
+
install(PROGRAMS
${EXECUTABLE_OUTPUT_PATH}/inkscape_com.exe
DESTINATION ${CMAKE_INSTALL_PREFIX}
@@ -22,8 +22,7 @@ if(WIN32) ${LIBRARY_OUTPUT_PATH}/libinkscape_base.dll
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
-
- # devlibs and mingw dlls
+
install(FILES
AUTHORS
COPYING
@@ -34,7 +33,9 @@ if(WIN32) GPL3.txt
LGPL2.1.txt
DESTINATION ${CMAKE_INSTALL_PREFIX})
-
+
+ # devlibs and mingw dlls
+
# There are differences in the devlibs for 64-Bit and 32-Bit build environments.
if(HAVE_MINGW64)
install(FILES
@@ -49,9 +50,11 @@ if(WIN32) ${DEVLIBS_BIN}/libatk-1.0-0.dll
${DEVLIBS_BIN}/libatkmm-1.6-1.dll
${DEVLIBS_BIN}/libcairo-2.dll
+ ${DEVLIBS_BIN}/libcairo-gobject-2.dll
${DEVLIBS_BIN}/libcairomm-1.0-1.dll
${DEVLIBS_BIN}/libcdr-0.1.dll
${DEVLIBS_BIN}/libcurl-4.dll
+ ${DEVLIBS_BIN}/libepoxy-0.dll
${DEVLIBS_BIN}/libexif-12.dll
${DEVLIBS_BIN}/libexpat-1.dll
${DEVLIBS_BIN}/libexslt-0.dll
@@ -59,9 +62,10 @@ if(WIN32) ${DEVLIBS_BIN}/libfontconfig-1.dll
${DEVLIBS_BIN}/libfreetype-6.dll
${DEVLIBS_BIN}/libgc-1.dll
- ${DEVLIBS_BIN}/libgdk-win32-2.0-0.dll
+ ${DEVLIBS_BIN}/libgdk-3-0.dll
${DEVLIBS_BIN}/libgdk_pixbuf-2.0-0.dll
- ${DEVLIBS_BIN}/libgdkmm-2.4-1.dll
+ ${DEVLIBS_BIN}/libgdkmm-3.0-1.dll
+ ${DEVLIBS_BIN}/libgdl-3-5.dll
${DEVLIBS_BIN}/libgio-2.0-0.dll
${DEVLIBS_BIN}/libgiomm-2.4-1.dll
${DEVLIBS_BIN}/libglib-2.0-0.dll
@@ -71,8 +75,8 @@ if(WIN32) ${DEVLIBS_BIN}/libgsl-19.dll
${DEVLIBS_BIN}/libgslcblas-0.dll
${DEVLIBS_BIN}/libgthread-2.0-0.dll
- ${DEVLIBS_BIN}/libgtk-win32-2.0-0.dll
- ${DEVLIBS_BIN}/libgtkmm-2.4-1.dll
+ ${DEVLIBS_BIN}/libgtk-3-0.dll
+ ${DEVLIBS_BIN}/libgtkmm-3.0-1.dll
${DEVLIBS_BIN}/libharfbuzz-0.dll
${DEVLIBS_BIN}/libiconv-2.dll
${DEVLIBS_BIN}/libintl-8.dll
@@ -103,7 +107,7 @@ if(WIN32) ${MINGW_BIN}/libstdc++-6.dll
${MINGW_BIN}/libwinpthread-1.dll
${MINGW_BIN}/libgcc_s_seh-1.dll
- ${MINGW_BIN}/libgomp-1.dll
+ ${MINGW_BIN}/libgomp-1.dll
DESTINATION ${CMAKE_INSTALL_PREFIX})
else()
install(FILES
@@ -170,7 +174,7 @@ if(WIN32) ${DEVLIBS_BIN}/pthreadGC2.dll
${DEVLIBS_BIN}/zlib1.dll
${MINGW_BIN}/mingwm10.dll
- ${MINGW_BIN}/libgomp-1.dll
+ ${MINGW_BIN}/libgomp-1.dll
DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
@@ -188,43 +192,46 @@ if(WIN32) plugins
share
DESTINATION ${CMAKE_INSTALL_PREFIX}
- PATTERN Adwaita EXCLUDE # NOTE: The theme is not used on Windows.
PATTERN hicolor/index.theme EXCLUDE # NOTE: Empty index.theme in hicolor icon theme causes SIGSEGV.
PATTERN CMakeLists.txt EXCLUDE
PATTERN *.am EXCLUDE)
-
+
+ install(DIRECTORY ${DEVLIBS_PATH}/share/icons/Adwaita
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons)
+
install(DIRECTORY ${DEVLIBS_PATH}/share/themes
DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
-
+
install(DIRECTORY ${DEVLIBS_PATH}/share/locale
- DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
-
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share
+ PATTERN "*gtk20.mo" EXCLUDE)
+
install(DIRECTORY ${DEVLIBS_PATH}/share/poppler
DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
-
+
install(DIRECTORY ${DEVLIBS_PATH}/etc/fonts
DESTINATION ${CMAKE_INSTALL_PREFIX}/etc)
-
- install(DIRECTORY ${DEVLIBS_PATH}/etc/gtk-2.0
- DESTINATION ${CMAKE_INSTALL_PREFIX}/etc)
-
- # GTK 2.0
- install(DIRECTORY ${DEVLIBS_LIB}/gtk-2.0
+
+ # GTK 3.0
+ install(DIRECTORY ${DEVLIBS_LIB}/gtk-3.0
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.cache")
+ install(DIRECTORY ${DEVLIBS_PATH}/etc/gtk-3.0
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/etc)
+
install(DIRECTORY ${DEVLIBS_LIB}/gdk-pixbuf-2.0
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.cache")
-
+
# Aspell dictionaries
install(DIRECTORY ${DEVLIBS_LIB}/aspell-0.60
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
-
+
# Necessary to run extensions on windows if it is not in the path
if (HAVE_MINGW64)
install(FILES
@@ -237,31 +244,16 @@ if(WIN32) ${DEVLIBS_BIN}/gspawn-win32-helper-console.exe
DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
-
+
# Perl
install(FILES
${DEVLIBS_PATH}/perl/bin/perl58.dll
DESTINATION ${CMAKE_INSTALL_PREFIX})
# Python
- install(FILES
- ${DEVLIBS_PATH}/python/python.exe
- ${DEVLIBS_PATH}/python/pythonw.exe
- DESTINATION ${CMAKE_INSTALL_PREFIX}/python)
-
- if(HAVE_MINGW64)
- install(FILES
- ${DEVLIBS_PATH}/python/python27.dll
- DESTINATION ${CMAKE_INSTALL_PREFIX}/python)
- else()
- install(FILES
- ${DEVLIBS_PATH}/python/python26.dll
- DESTINATION ${CMAKE_INSTALL_PREFIX}/python)
- endif()
-
- install(DIRECTORY ${DEVLIBS_PATH}/python/lib
- DESTINATION ${CMAKE_INSTALL_PREFIX}/python)
-
- install(DIRECTORY ${DEVLIBS_PATH}/python/dlls
- DESTINATION ${CMAKE_INSTALL_PREFIX}/python)
+ install(DIRECTORY ${DEVLIBS_PATH}/python
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ PATTERN "python/include" EXCLUDE
+ PATTERN "python/libs" EXCLUDE
+ PATTERN "*.pyc" EXCLUDE)
endif()
\ No newline at end of file diff --git a/CMakeScripts/cmake_consistency_check.py b/CMakeScripts/cmake_consistency_check.py index 53026910e..64419936b 100755 --- a/CMakeScripts/cmake_consistency_check.py +++ b/CMakeScripts/cmake_consistency_check.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # $Id: cmake_consistency_check.py 38869 2011-07-31 03:15:37Z campbellbarton $ # ***** BEGIN GPL LICENSE BLOCK ***** @@ -23,13 +23,22 @@ # <pep8 compliant> -from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR +import sys +if not sys.version.startswith("3"): + print("\nPython3.x needed, found %s.\nAborting!\n" % + sys.version.partition(" ")[0]) + sys.exit(1) + +from cmake_consistency_check_config import ( + IGNORE, + UTF8_CHECK, + SOURCE_DIR, +) + import os from os.path import join, dirname, normpath, splitext -print("Scanning:", SOURCE_DIR) - global_h = set() global_c = set() global_refs = {} @@ -53,7 +62,7 @@ def replace_line(f, i, text, keep_indent=True): def source_list(path, filename_check=None): for dirpath, dirnames, filenames in os.walk(path): - # skip '.svn' + # skip '.bzr' if dirpath.startswith("."): continue @@ -70,12 +79,12 @@ def is_cmake(filename): def is_c_header(filename): ext = splitext(filename)[1] - return (ext in (".h", ".hpp", ".hxx")) + return (ext in {".h", ".hpp", ".hxx", ".hh"}) def is_c(filename): ext = splitext(filename)[1] - return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc")) + return (ext in {".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl"}) def is_c_any(filename): @@ -87,13 +96,16 @@ def cmake_get_src(f): sources_h = [] sources_c = [] - filen = open(f, "r") + filen = open(f, "r", encoding="utf8") it = iter(filen) found = False i = 0 # print(f) def is_definition(l, f, i, name): + if l.startswith("unset("): + return False + if ('set(%s' % name) in l or ('set(' in l and l.endswith(name)): if len(l.split()) > 1: raise Exception("strict formatting not kept 'set(%s*' %s:%d" % (name, f, i)) @@ -146,6 +158,7 @@ def cmake_get_src(f): # replace dirs l = l.replace("${CMAKE_CURRENT_SOURCE_DIR}", cmake_base) + l = l.strip('"') if not l: pass @@ -166,13 +179,21 @@ def cmake_get_src(f): elif is_c(new_file): sources_c.append(new_file) global_refs.setdefault(new_file, []).append((f, i)) - elif l in ("PARENT_SCOPE", ): + elif l in {"PARENT_SCOPE", }: # cmake var, ignore pass elif new_file.endswith(".list"): pass elif new_file.endswith(".def"): pass + elif new_file.endswith(".cl"): # opencl + pass + elif new_file.endswith(".cu"): # cuda + pass + elif new_file.endswith(".osl"): # open shading language + pass + elif new_file.endswith(".glsl"): + pass else: raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file)) @@ -183,11 +204,11 @@ def cmake_get_src(f): if new_path_rel != l: print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel)) - ## Save time. just replace the line + # # Save time. just replace the line # replace_line(f, i - 1, new_path_rel) else: - raise Exception("non existant include %s:%d -> %s" % (f, i, new_file)) + raise Exception("non existent include %s:%d -> %s" % (f, i, new_file)) # print(new_file) @@ -208,90 +229,103 @@ def cmake_get_src(f): ''' # reset - sources_h[:] = [] - sources_c[:] = [] + del sources_h[:] + del sources_c[:] filen.close() -for cmake in source_list(SOURCE_DIR, is_cmake): - cmake_get_src(cmake) - - -def is_ignore(f): - for ig in IGNORE: +def is_ignore(f, ignore_used): + for index, ig in enumerate(IGNORE): if ig in f: + ignore_used[index] = True return True return False -# First do stupid check, do these files exist? -print("\nChecking for missing references:") -is_err = False -errs = [] -for f in (global_h | global_c): - if f.endswith("dna.c"): - continue - - if not os.path.exists(f): - refs = global_refs[f] - if refs: - for cf, i in refs: - errs.append((cf, i)) - else: - raise Exception("CMake referenecs missing, internal error, aborting!") - is_err = True - -errs.sort() -errs.reverse() -for cf, i in errs: - print("%s:%d" % (cf, i)) - # Write a 'sed' script, useful if we get a lot of these - # print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf)) - - -if is_err: - raise Exception("CMake referenecs missing files, aborting!") -del is_err -del errs - -# now check on files not accounted for. -print("\nC/C++ Files CMake doesnt know about...") -for cf in sorted(source_list(SOURCE_DIR, is_c)): - if not is_ignore(cf): - if cf not in global_c: - print("missing_c: ", cf) - - # check if automake builds a corrasponding .o file. - ''' - if cf in global_c: - out1 = os.path.splitext(cf)[0] + ".o" - out2 = os.path.splitext(cf)[0] + ".Po" - out2_dir, out2_file = out2 = os.path.split(out2) - out2 = os.path.join(out2_dir, ".deps", out2_file) - if not os.path.exists(out1) and not os.path.exists(out2): - print("bad_c: ", cf) - ''' - -print("\nC/C++ Headers CMake doesnt know about...") -for hf in sorted(source_list(SOURCE_DIR, is_c_header)): - if not is_ignore(hf): - if hf not in global_h: - print("missing_h: ", hf) - -if UTF8_CHECK: - # test encoding - import traceback - for files in (global_c, global_h): - for f in sorted(files): - if os.path.exists(f): - # ignore outside of our source tree - if "extern" not in f: - i = 1 - try: - for l in open(f, "r", encoding="utf8"): - i += 1 - except: - print("Non utf8: %s:%d" % (f, i)) - if i > 1: - traceback.print_exc() +def main(): + + print("Scanning:", SOURCE_DIR) + + for cmake in source_list(SOURCE_DIR, is_cmake): + cmake_get_src(cmake) + + # First do stupid check, do these files exist? + print("\nChecking for missing references:") + is_err = False + errs = [] + for f in (global_h | global_c): + + if not os.path.exists(f): + refs = global_refs[f] + if refs: + for cf, i in refs: + errs.append((cf, i)) + else: + raise Exception("CMake referenecs missing, internal error, aborting!") + is_err = True + + errs.sort() + errs.reverse() + for cf, i in errs: + print("%s:%d" % (cf, i)) + # Write a 'sed' script, useful if we get a lot of these + # print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf)) + + if is_err: + raise Exception("CMake referenecs missing files, aborting!") + del is_err + del errs + + ignore_used = [False] * len(IGNORE) + + # now check on files not accounted for. + print("\nC/C++ Files CMake doesnt know about...") + for cf in sorted(source_list(SOURCE_DIR, is_c)): + if not is_ignore(cf, ignore_used): + if cf not in global_c: + print("missing_c: ", cf) + + # check if automake builds a corrasponding .o file. + ''' + if cf in global_c: + out1 = os.path.splitext(cf)[0] + ".o" + out2 = os.path.splitext(cf)[0] + ".Po" + out2_dir, out2_file = out2 = os.path.split(out2) + out2 = os.path.join(out2_dir, ".deps", out2_file) + if not os.path.exists(out1) and not os.path.exists(out2): + print("bad_c: ", cf) + ''' + + print("\nC/C++ Headers CMake doesnt know about...") + for hf in sorted(source_list(SOURCE_DIR, is_c_header)): + if not is_ignore(hf, ignore_used): + if hf not in global_h: + print("missing_h: ", hf) + + if UTF8_CHECK: + # test encoding + import traceback + for files in (global_c, global_h): + for f in sorted(files): + if os.path.exists(f): + # ignore outside of our source tree + if "extern" not in f: + i = 1 + try: + for l in open(f, "r", encoding="utf8"): + i += 1 + except UnicodeDecodeError: + print("Non utf8: %s:%d" % (f, i)) + if i > 1: + traceback.print_exc() + + # Check ignores aren't stale + print("\nCheck for unused 'IGNORE' paths...") + for index, ig in enumerate(IGNORE): + if not ignore_used[index]: + print("unused ignore: %r" % ig) + + +if __name__ == "__main__": + main() |
