From c2366b3f5bbba7c6c2a120f88ede3cb249b100b2 Mon Sep 17 00:00:00 2001 From: Awile Omar Date: Fri, 21 Jun 2019 21:30:28 +0200 Subject: [PATCH 1/6] Support for CMake based build system - Added first cmake file drafts - Added missing RpathHelper cmake - Builds on mingw with cmake - Added packagaging and cmake target exports This allows interviews to be more easily integrated in other CMake builds (namely neuron's). - Make CXX_VISIBILITY option depend on static build - Added variables to easily find iv installation paths - Added into iv-config.cmake two find_path statements to easily publish lib and include paths through cmake find_package mechanism. - Added dylib extension to find the file on mac too - Remove visibility hidden for static library (#6) - Set fpic on for static library - Fix X11 link errors on OSX when shared libraries are built - Disable visibility hidden to avoid link error with hoc.so when dynamic python is enabled --- CMakeLists.txt | 142 ++++++++++ cmake/HelperFunctions.cmake | 83 ++++++ cmake/PlatformHelper.cmake | 6 + cmake/RpathHelper.cmake | 22 ++ config.h.in | 172 ++++++++++++ iv-config.cmake | 8 + src/bin/CMakeLists.txt | 59 +++++ src/include/InterViews/printer.h | 5 - src/include/ivstream.h | 14 + src/include/ivstream.h.in | 12 - src/include/ivstrm.h | 62 ----- src/lib/CMakeLists.txt | 438 +++++++++++++++++++++++++++++++ src/lib/Dispatch/dispatcher.cpp | 11 - src/lib/IV-X11/xdrag.cpp | 10 - src/lib/TIFF/mkg3states.c | 68 +++-- src/lib/Unidraw/catalog.cpp | 9 +- 16 files changed, 988 insertions(+), 133 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 cmake/HelperFunctions.cmake create mode 100644 cmake/PlatformHelper.cmake create mode 100644 cmake/RpathHelper.cmake create mode 100644 config.h.in create mode 100644 iv-config.cmake create mode 100644 src/bin/CMakeLists.txt create mode 100755 src/include/ivstream.h delete mode 100755 src/include/ivstream.h.in delete mode 100755 src/include/ivstrm.h create mode 100644 src/lib/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c120337 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,142 @@ +cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR) +project(iv C CXX) + +# ============================================================================= +# CMake common project settings +# ============================================================================= +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 1) + +set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) + +# ============================================================================= +# Project build options +# ============================================================================= +option(IV_BUILD_SHARED "Build libraries shared or static" OFF) + +# ============================================================================= +# CMake build settings +# ============================================================================= +set(CMAKE_BUILD_TYPE RelWithDebInfo) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + +if(NOT ${IV_BUILD_SHARED}) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(IV_LIB_TYPE "STATIC") +else() + set(IV_LIB_TYPE "SHARED") +endif() + +# CYGWIN macros is used in the code +if(${CMAKE_SYSTEM_NAME} MATCHES "CYGWIN") + set(CYGWIN 1) +endif() + +# ============================================================================= +# Find dependencies +# ============================================================================= +find_package(X11) + +if(NOT ${X11_FOUND}) + if(APPLE) + message(FATAL_ERROR "Install XQuartz from https://www.xquartz.org/ to build iv") + else() + message(FATAL_ERROR "Install X11 to build iv (e.g. 'apt install libx11-dev libxcomposite-dev' on Ubuntu") + endif() +endif() + +# ============================================================================= +# Include cmake modules +# ============================================================================= +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +include(HelperFunctions) +include(PlatformHelper) +include(RpathHelper) +include(CheckIncludeFiles) +include(CheckFunctionExists) + +# ============================================================================= +# Check existance of various headers, functions and directories +# ============================================================================= +check_include_files(fcntl.h HAVE_FCNTL_H) +check_include_files(malloc.h HAVE_MALLOC_H) +check_include_files(memory.h HAVE_MEMORY_H) +check_include_files(osfcn.h HAVE_OSFCN_H) +check_include_files(socket.h HAVE_SOCKET_H) +check_include_files(stdint.h HAVE_STDINT_H) +check_include_files(stdlib.h HAVE_STDLIB_H) +check_include_files(string.h HAVE_STRING_H) +check_include_files(strings.h HAVE_STRINGS_H) +check_include_files(stropts.h HAVE_STROPTS_H) +check_include_files(stream.h HAVE_STREAM_H) +check_include_files(sys/conf.h HAVE_SYS_CONF_H) +check_include_files(sys/file.h HAVE_SYS_FILE_H) +check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H) +check_include_files(sys/mman.h HAVE_SYS_MMAN_H) +check_include_files(sys/param.h HAVE_SYS_PARAM_H) +check_include_files(sys/stat.h HAVE_SYS_STAT_H) +check_include_files(sys/time.h HAVE_SYS_TIME_H) +check_include_files(unistd.h HAVE_UNISTD_H) + +check_function_exists(getcwd HAVE_GETCWD) +check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) +check_function_exists(mmap HAVE_MMAP) +check_function_exists(sigprocmask HAVE_POSIX_SIGNALS) +check_function_exists(socket HAVE_SOCKET) +check_function_exists(strcspn HAVE_STRCSPN) +check_function_exists(strerror HAVE_STRERROR) +check_function_exists(strtod HAVE_STRTOD) +check_function_exists(strtol HAVE_STRTOL) +check_function_exists(uname HAVE_UNAME) + +iv_check_dir_exists(dirent.h HAVE_DIRENT_H) +iv_check_dir_exists(ndir.h HAVE_NDIR_H) +iv_check_dir_exists(sys/dir.h HAVE_SYS_DIR_H) +iv_check_dir_exists(sys/ndir.h HAVE_SYS_NDIR_H) + +iv_check_type_exists(sys/types.h gid_t int gid_t) +iv_check_type_exists(sys/types.h off_t "long int" off_t) +iv_check_type_exists(sys/types.h pid_t int pid_t) +iv_check_type_exists(sys/types.h size_t "unsigned int" size_t) +iv_check_type_exists(sys/types.h uid_t int uid_t) + +# ============================================================================= +# Check if signals support +# ============================================================================= +# NOTE: check_function_exists(sigsetmask HAVE_BSD_SIGNALS) made obsolete by sigprocmask(2). +# sigsetmask exists but the usage generates a variety of errors. See the old autoconf acinclude.m4 +# AC_DEFUN([BASH_SIGNAL_CHECK] For now, use only if don't have posix signals. +if(NOT ${HAVE_POSIX_SIGNALS}) + set(HAVE_BSD_SIGNALS 1) +else() + set(HAVE_BSD_SIGNALS 0) +endif() + +# ============================================================================= +# Set return type of signal in RETSIGTYPE +# ============================================================================= +iv_check_signal_return_type(RETSIGTYPE) + +# ============================================================================= +# Generate config.h after all checks +# ============================================================================= +add_definitions(-DHAVE_CONFIG_H) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h) + +# ============================================================================= +# Include source directories +# ============================================================================= +include_directories(${PROJECT_SOURCE_DIR}/src/include) +add_subdirectory(src/bin) +add_subdirectory(src/lib) + +# ============================================================================= +# Install binaries and headers +# ============================================================================= +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/include/ DESTINATION include) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iv-config.cmake DESTINATION share/cmake/iv/) +install(EXPORT iv NAMESPACE iv_ DESTINATION share/cmake/iv) diff --git a/cmake/HelperFunctions.cmake b/cmake/HelperFunctions.cmake new file mode 100644 index 0000000..0a057ba --- /dev/null +++ b/cmake/HelperFunctions.cmake @@ -0,0 +1,83 @@ +# ============================================================================= +# Check if directory related to DIR exist by compiling code +# ============================================================================= +function(iv_check_dir_exists HEADER VARIABLE) + # code template to check existance of DIR + set(CONFTEST_DIR_TPL " + #include + #include <@dir_header@> + + int main () { + if ((DIR *) 0) + return 0\; + return 0\; + }") + # first get header file + check_include_files(${HEADER} HAVE_HEADER) + if(${HAVE_HEADER}) + # if header is found, create a code from template + string(REPLACE "@dir_header@" + ${HEADER} + CONFTEST_DIR + "${CONFTEST_DIR_TPL}") + file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/conftest.c ${CONFTEST_DIR}) + # try to compile + try_compile(RESULT_VAR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/conftest.c) + set(${VARIABLE} ${RESULT_VAR} PARENT_SCOPE) + message(STATUS "iv_check_dir_exists ${HEADER}: ${RESULT_VAR}") + file(REMOVE "conftest.c") + endif() +endfunction() + +# ============================================================================= +# Check if given type exist by compiling code +# ============================================================================= +function(iv_check_type_exists HEADER TYPE DEFAULT_TYPE VARIABLE) + # code template to check existance of specific type + set(CONFTEST_TYPE_TPL " + #include <@header@> + + int main () { + if (sizeof (@type@)) + return 0\; + return 0\; + }") + string(REPLACE "@header@" + ${HEADER} + CONFTEST_TYPE + "${CONFTEST_TYPE_TPL}") + string(REPLACE "@type@" + ${TYPE} + CONFTEST_TYPE + "${CONFTEST_TYPE}") + file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/conftest.c ${CONFTEST_TYPE}) + + try_compile(RESULT_VAR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/conftest.c) + if(NOT ${RESULT_VAR}) + set(${VARIABLE} ${DEFAULT_TYPE} PARENT_SCOPE) + endif() + message(STATUS "iv_check_type_exists ${VARIABLE}: ${RESULT_VAR}") + file(REMOVE "conftest.c") +endfunction() + +# ============================================================================= +# Check return type of signal +# ============================================================================= +function(iv_check_signal_return_type VARIABLE) + # code template to check signal support + set(CONFTEST_RETSIGTYPE " + #include + #include + + int main () { + return *(signal (0, 0)) (0) == 1; + }") + file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/conftest.c ${CONFTEST_RETSIGTYPE}) + try_compile(RESULT_VAR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/conftest.c) + if(${RESULT_VAR}) + set(${VARIABLE} int PARENT_SCOPE) + else() + set(${VARIABLE} void PARENT_SCOPE) + endif() + file(REMOVE "conftest.c") +endfunction() diff --git a/cmake/PlatformHelper.cmake b/cmake/PlatformHelper.cmake new file mode 100644 index 0000000..8315b65 --- /dev/null +++ b/cmake/PlatformHelper.cmake @@ -0,0 +1,6 @@ +# ============================================================================= +# Platform specific settings +# ============================================================================= +if(WIN32 OR MINGW) + set(IV_WINDOWS_BUILD TRUE) +endif() diff --git a/cmake/RpathHelper.cmake b/cmake/RpathHelper.cmake new file mode 100644 index 0000000..2412ba0 --- /dev/null +++ b/cmake/RpathHelper.cmake @@ -0,0 +1,22 @@ +# ============================================================================= +# Set full RPATHs in build-tree, also set RPATHs in install for non-system libs +# ============================================================================= + +# use, i.e. don't skip the full RPATH for the build tree +set(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already (but later on when installing) +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + +# add the automatically determined parts of the RPATH which point to directories outside the build +# tree to the install RPATH +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +# the RPATH to be used when installing, but only if it's not a system directory +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + +if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +endif("${isSystemDir}" STREQUAL "-1") diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..2da9e25 --- /dev/null +++ b/config.h.in @@ -0,0 +1,172 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + + +#ifndef H_config_included +#define H_config_included 1 + + +/* define if using cygwin */ +#cmakedefine CYGWIN 1 + +/* use sigsetmask */ +#cmakedefine HAVE_BSD_SIGNALS 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#cmakedefine HAVE_GETCWD 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MALLOC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#cmakedefine HAVE_MMAP 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#cmakedefine HAVE_NDIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OSFCN_H 1 + +/* use sigprocmask */ +#cmakedefine HAVE_POSIX_SIGNALS 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SOCKET_H 1 + +/* Define to 1 if you have the `socket' function. */ +#cmakedefine HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcspn' function. */ +#cmakedefine HAVE_STRCSPN 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STREAM_H 1 + +/* Define to 1 if you have the `strerror' function. */ +#cmakedefine HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STROPTS_H 1 + +/* Define to 1 if you have the `strtod' function. */ +#cmakedefine HAVE_STRTOD 1 + +/* Define to 1 if you have the `strtol' function. */ +#cmakedefine HAVE_STRTOL 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_CONF_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_DIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_NDIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `uname' function. */ +#cmakedefine HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* undef or ::fabs or std::fabs */ +#cmakedefine IVOS_FABS + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#cmakedefine LT_OBJDIR + +/* define if using mingw */ +#cmakedefine MINGW + +/* do we need the prototype for gettimeofday */ +#cmakedefine NEED_GETTIMEOFDAY_PROTOTYPE + +/* define if stream.h is insufficient by itself */ +#cmakedefine NO_OUTPUT_OPENMODE + +/* Define as the return type of signal handlers (`int' or `void'). */ +#cmakedefine RETSIGTYPE @RETSIGTYPE@ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to `int' if doesn't define. */ +#cmakedefine gid_t @gid_t@ + +/* Define to `long int' if does not define. */ +#cmakedefine off_t @off_t@ + +/* Define to `int' if does not define. */ +#cmakedefine pid_t @pid_t@ + +/* Define to `unsigned int' if does not define. */ +#cmakedefine size_t @size_t@ + +/* Define to `int' if doesn't define. */ +#cmakedefine uid_t @uid_t@ + + +#if defined(__cplusplus) +#include +#endif + +#if defined(CYGWIN) || defined(MINGW) +#define WIN32 1 +#endif + +#if defined(carbon) +#include +#endif + +#endif /* H_config_included */ + diff --git a/iv-config.cmake b/iv-config.cmake new file mode 100644 index 0000000..808c6f2 --- /dev/null +++ b/iv-config.cmake @@ -0,0 +1,8 @@ +# iv-config.cmake - package configuration file + +get_filename_component(CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) + +find_path(iv_INCLUDE "ivversion.h" HINTS "${CONFIG_PATH}/../../../include") +find_path(iv_LIB NAMES libinterviews.a libinterviews.so libinterviews.dylib HINTS "${CONFIG_PATH}/../../../lib") + +include(${CONFIG_PATH}/iv.cmake) diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt new file mode 100644 index 0000000..b01b742 --- /dev/null +++ b/src/bin/CMakeLists.txt @@ -0,0 +1,59 @@ +# ============================================================================= +# idemo +# ============================================================================= +set(IDEMO_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/idemo/main.cpp) +add_executable(idemo ${IDEMO_SOURCE_FILES}) +target_link_libraries(idemo interviews ${X11_LIBRARIES}) +install(TARGETS idemo DESTINATION bin) + +# ============================================================================= +# iclass +# ============================================================================= +set(ICLASS_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/classbuffer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/classeditor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/classinfo.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/dialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/direct.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/globals.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/iclass.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/iclass/main.cpp) + +if(NOT BUILD_UNDER_WINDOWS) + add_executable(iclass ${ICLASS_SOURCE_FILES}) + target_include_directories(iclass BEFORE PUBLIC ${PROJECT_SOURCE_DIR}/src/include/IV-2_6) + set_source_files_properties(${ICLASS_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Div2_6_compatible") + target_link_libraries(iclass unidraw interviews ${X11_LIBRARIES}) +endif() + +# ============================================================================= +# idraw +# ============================================================================= +set(IDRAW_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idarrow.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idarrowhead.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idarrows.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idcatalog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idcmds.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idcomp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idcreator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/iddialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/ided.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idkybd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idvars.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/idraw/main.cpp) + +if(NOT BUILD_UNDER_WINDOWS) + add_executable(idraw ${IDRAW_SOURCE_FILES}) + target_include_directories(idraw BEFORE PUBLIC ${PROJECT_SOURCE_DIR}/src/include/IV-2_6) + set_source_files_properties(${IDRAW_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Div2_6_compatible") + target_link_libraries(idraw unidraw interviews ${X11_LIBRARIES}) +endif() + +# ============================================================================= +# Install various targets +# ============================================================================= +if(NOT BUILD_UNDER_WINDOWS) + install(TARGETS iclass DESTINATION bin) + install(TARGETS idraw DESTINATION bin) +endif() diff --git a/src/include/InterViews/printer.h b/src/include/InterViews/printer.h index 0f2ff05..abc0139 100644 --- a/src/include/InterViews/printer.h +++ b/src/include/InterViews/printer.h @@ -30,12 +30,7 @@ #define iv_printer_h #include - -#if 1 || defined(CYGWIN) #include -#else -#include -#endif class PrinterRep; diff --git a/src/include/ivstream.h b/src/include/ivstream.h new file mode 100755 index 0000000..7f00a45 --- /dev/null +++ b/src/include/ivstream.h @@ -0,0 +1,14 @@ +#ifndef ivstream_h +#define ivstream_h + +#include +#include +#include + +#define IOS_OUT std::ios::out +#define IOS_IN std::ios::in +#define IOS_APP std::ios::app + +using namespace std; + +#endif // ivstream_h diff --git a/src/include/ivstream.h.in b/src/include/ivstream.h.in deleted file mode 100755 index d9baea2..0000000 --- a/src/include/ivstream.h.in +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ivstream_h -#define ivstream_h - -/* The standard is */ -#undef HAVE_SSTREAM - -/* Define if the openmodes output,append,input are not defined */ -#undef NO_OUTPUT_OPENMODE - -#include - -#endif diff --git a/src/include/ivstrm.h b/src/include/ivstrm.h deleted file mode 100755 index 3fcf779..0000000 --- a/src/include/ivstrm.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef ivstrm_h -#define ivstrm_h - -/* prevent subsequent inclusion of ivstream if this -didnt come from there since it defines things already possibly defined -in config.h */ -#ifndef ivstream_h -#define ivstream_h -#endif - -#if defined(HAVE_SSTREAM) -/* the current standard. Note that one of the arms below is obsolete */ -/* this was introduced to avoid the g++ 3.2 warning (and to get more up -to date) -/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning -This file includes at least one deprecated or antiquated header. Please -consider using one of the 32 headers found in section 17.4.1.2 of the -C++ standard. Examples include substituting the header for the - header for C++ includes, or instead of the deprecated -header . To disable this warning use -Wno-deprecated. -*/ - -#include -#include -#include -#define IOS_OUT std::ios::out -#define IOS_IN std::ios::in -#define IOS_APP std::ios::app -using namespace std; - -#else /* do not have sstream */ - -/* introduced for macos since stream.h does not exist. - also takes care of the declaration of output and input - with regard to streams -Note: the above standard certainly obsoletes the NO_OUTPUT_OPENMODE stuff. -So macos now handled by the HAVE_SSTREAM case. -*/ - -#if defined(HAVE_STREAM_H) -#include -#else -#define _STREAM_COMPAT -#include -#endif - -// for some compilers stream.h is insufficient -// following for gcc-3.0.1 -#if defined(NO_OUTPUT_OPENMODE) -#include // for filebuf -#include // for ends -#define IOS_OUT std::ios_base::out -#define IOS_IN std::ios_base::in -#define IOS_APP std::ios_base::app -#else -#define IOS_OUT output -#define IOS_IN input -#define IOS_APP append -#endif - -#endif /* do not have sstream */ -#endif diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 0000000..8af6c08 --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -0,0 +1,438 @@ +# ============================================================================= +# Library sources list +# ============================================================================= +set(DISPATCH_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/dispatcher.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/iohandler.cpp) + +set(IV26_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/adjuster2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/banner.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/border2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/box2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/button2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/compeditor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/control.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/deck2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/dialog2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/filebrowser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/filechooser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/frame.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/glue2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/interactor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/matcheditor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/menu2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/message.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/painter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/panner2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/perspective.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/rubband.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/rubcurve.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/rubgroup.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/rubline.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/rubrect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/rubverts.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/scene.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/scrollbar2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/scroller2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/sensor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/shape.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/strbrowser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/strchooser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/streditor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/subject.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/textbuffer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/textdisplay.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/texteditor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/tform2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/tray.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/viewport.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/world.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/xbitmap2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/xevent2_6.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/xinter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/xpainter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-2_6/xpattern.cpp) + +set(INTERVIEWS_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/dialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/action.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/adjust.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/aggr.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/align.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/alloctbl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/arrcomp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/background.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/bevel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/border.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/box.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/browser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/button.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/character.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/compositor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/comption.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/debug.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/deck.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/fbrowser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/fchooser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/field.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/geometry.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/glyph.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/group.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/handler.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/hit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/image.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/input.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/kit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/label.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/layout.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/lrmarker.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/menu.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/mf_dialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/mf_kit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/mono_kit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/monoglyph.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/observe.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/ol_dialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/page.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/patch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/place.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/polyglyph.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/printer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/psfont.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/regexp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/resource.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/rule.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/scrbox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/shadow.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/simpcomp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/slider.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/smf_kit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/stencil.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/stepper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/style.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/superpose.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/target.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/telltale.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/texcomp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/iv3text.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/iv3textbuffer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/tformsetter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/tile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/transformer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/winbmp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/xymarker.cpp) + +if(NOT IV_WINDOWS_BUILD) + list(APPEND INTERVIEWS_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/ol_kit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/tiff.cpp) +endif() + +set(IVX11_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/session.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xbitmap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xbrush.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xcanvas.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xcolor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xcursor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xdrag.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xevent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xfont.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xraster.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xreqerr.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xselection.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/xwindow.cpp) + +set(OS_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/OS/directory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/OS/file.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/OS/host.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/OS/listimpl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/OS/math.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/OS/memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/OS/string.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/OS/ustring.cpp) + +set(TIFF_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_aux.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_ccittrle.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_close.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_cmprs.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_compat.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_dir.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_dirinfo.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_dirread.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_dirwrite.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_dumpmode.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_error.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_fax3.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_fax4.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_flush.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_getimage.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_jpeg.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_lzw.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_machdep.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_next.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_open.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_packbits.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_print.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_read.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_strip.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_swab.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_thunder.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_tile.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_version.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_warning.c + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_write.c) + +set(IVWIN_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/bitmap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/brush.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/canvas.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/canvas16.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/color.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/cursor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/display.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/event.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/font.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/ivclean.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/mprinter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/mwapp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/mwlib.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/raster.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/session.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Win/window.cpp) + +set(IVMAC_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/bitmap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/brush.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/canvas.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/color.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/cursor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/display.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/event.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/carbevent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/font.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/mprinter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/raster.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/session.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IV-Mac/window.cpp) + +set(UNIDRAW_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/align.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/brushcmd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/catalog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/catcmds.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/cglue.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/clipboard.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/colorcmd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/command.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/component.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/compview.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/connect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/connector.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/creator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/csolver.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/ctrlinfo.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/damage.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/data.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/datas.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/dialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/edit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/editor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/editorinfo.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/ellipse.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/ellipses.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/externview.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/font.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/geomobjs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/globals.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/graphic.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/grblock.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/grcomp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/grcomptool.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/grid.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/grview.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/gvupdater.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/import.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/iterator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/keymap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/kybd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/line.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/lines.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/link.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/macro.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/magnify.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/manip.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/manips.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/move.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/nop.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/pad.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/patcmd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/path.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/picture.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/pin.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/polygon.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/polygons.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/pspaint.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/psview.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/rastercomp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/rasterrect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/rect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/reshape.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/rotate.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/scale.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/select.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/selection.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/slot.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/spline.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/splines.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/statevar.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/statevars.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/stateview.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/stateviews.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/stencilcomp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/stretch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/text.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/struct.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/tool.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/transfn.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/transfns.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/transforms.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/uarray.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/uctrl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/uctrls.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/uhash.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/ulabel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/ulist.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/umap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/unidraw.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/upage.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/ustencil.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/vertices.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/verts.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/viewcmds.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Unidraw/viewer.cpp) + +# ============================================================================= +# mkg3states utility +# ============================================================================= +# macros required to build +set( + TIFF_DEFINES + "-DCOLORIMETRY_SUPPORT -DJPEG_SUPPORT -DYCBCR_SUPPORT -DCMYK_SUPPORT -DHAVE_IEEEFP=1 -DUSE_VARARGS=0 -DUSE_PROTOTYPES=1 -DUSE_CONST=1" + ) + +# command to generate g3states.h +add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/g3states.h + COMMAND ${CMAKE_BINARY_DIR}/bin/mkg3states -o=g3states.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/TIFF + VERBATIM + DEPENDS ${CMAKE_BINARY_DIR}/bin/mkg3states) + +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/TIFF/g3states.h + PROPERTIES + GENERATED + TRUE) +# creates an explicit dependency between tif_fax3.c and g3states.h which cannot be +# handled automatically because g3states.h is autogenerated +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/TIFF/tif_fax3.c + PROPERTIES + OBJECT_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/g3states.h) +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/TIFF/mkg3states.c + PROPERTIES + COMPILE_FLAGS + ${TIFF_DEFINES}) + +add_executable(mkg3states ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/mkg3states.c) +target_include_directories(mkg3states PUBLIC ${PROJECT_SOURCE_DIR}/src/include/TIFF) + +# ============================================================================= +# IV library +# ============================================================================= + +if(NOT IV_WINDOWS_BUILD) + set(INTERVIEWS_SOURCES + ${DISPATCH_SOURCE_FILES} + ${IV26_SOURCE_FILES} + ${INTERVIEWS_SOURCE_FILES} + ${TIFF_SOURCE_FILES} + ${OS_SOURCE_FILES} + ${IVX11_SOURCE_FILES}) +else() + set(INTERVIEWS_SOURCES + ${INTERVIEWS_SOURCE_FILES} + ${OS_SOURCE_FILES} + ${IVWIN_SOURCE_FILES}) +endif() + +if(NOT IV_WINDOWS_BUILD) + set(KIT_DEFINES "-Dmotif_kit -Dsgi_motif_kit -Dopenlook_kit -Dbw_kit -Ddefault_kit=SMFKit") +else() + set(KIT_DEFINES "-Dmotif_kit -Dsgi_motif_kit") +endif() + +set(DIV_DEFINES "-DIV_LIBALL='\"${CMAKE_INSTALL_PREFIX}/share\"' -DX_LIBDIR='\"${X11_LIBRARY_DIR}\"'") + +set_source_files_properties(${TIFF_SOURCE_FILES} PROPERTIES COMPILE_FLAGS ${TIFF_DEFINES}) + +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/InterViews/dialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InterViews/kit.cpp + PROPERTIES + COMPILE_FLAGS + ${KIT_DEFINES}) +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/IV-X11/session.cpp + PROPERTIES + COMPILE_FLAGS + ${DIV_DEFINES}) + +add_library(interviews ${IV_LIB_TYPE} ${INTERVIEWS_SOURCES}) +target_link_libraries(interviews ${X11_LIBRARIES}) +target_include_directories(interviews + PRIVATE ${X11_INCLUDE_DIR} + $ + $) +set_property(TARGET interviews PROPERTY POSITION_INDEPENDENT_CODE ON) + +if(IV_WINDOWS_BUILD) + target_link_libraries(interviews gdi32 comdlg32) +endif() + +# ============================================================================= +# Unidraw library +# ============================================================================= +if(NOT IV_WINDOWS_BUILD) + if(${IV_BUILD_SHARED}) + add_library(unidraw SHARED ${UNIDRAW_SOURCE_FILES}) + else() + add_library(unidraw STATIC ${UNIDRAW_SOURCE_FILES}) + endif() + target_include_directories(unidraw PUBLIC ${X11_INCLUDE_DIR}) + target_link_libraries(unidraw interviews) +endif() + +# ============================================================================= +# Install targets +# ============================================================================= +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/app-defaults/ DESTINATION share/app-defaults) + +if(NOT IV_WINDOWS_BUILD) + install(TARGETS interviews + EXPORT iv + DESTINATION lib + INCLUDES + DESTINATION $) + install(TARGETS unidraw + EXPORT iv + DESTINATION lib + INCLUDES + DESTINATION $) +else() + install(TARGETS interviews + EXPORT iv + DESTINATION bin + INCLUDES + DESTINATION $) +endif() diff --git a/src/lib/Dispatch/dispatcher.cpp b/src/lib/Dispatch/dispatcher.cpp index 696a203..83ee7c4 100644 --- a/src/lib/Dispatch/dispatcher.cpp +++ b/src/lib/Dispatch/dispatcher.cpp @@ -56,17 +56,6 @@ #include #include -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - /* no standard place for this */ extern "C" { diff --git a/src/lib/IV-X11/xdrag.cpp b/src/lib/IV-X11/xdrag.cpp index edf82eb..4b2f991 100644 --- a/src/lib/IV-X11/xdrag.cpp +++ b/src/lib/IV-X11/xdrag.cpp @@ -43,9 +43,6 @@ #include #include #include -#if !defined(HAVE_SSTREAM) -#include -#endif #include #include @@ -135,17 +132,10 @@ static void setDragProperty( Atom property = None; if (length != 0) { char buffer[256]; -#if defined(HAVE_SSTREAM) ostringstream name(buffer); name << dragName << "_" << Host::name() << "_" << getpid() << "_" << dropUid++; property = XInternAtom(display, name.str().c_str(), False); -#else - ostrstream name(buffer, 256); - name << dragName << "_" << Host::name() << "_" << getpid() << "_" << - dropUid++ << ends; - property = XInternAtom(display, name.str(), False); -#endif XChangeProperty( display, destination, property, XA_STRING, 8, diff --git a/src/lib/TIFF/mkg3states.c b/src/lib/TIFF/mkg3states.c index 7817989..6ce2995 100755 --- a/src/lib/TIFF/mkg3states.c +++ b/src/lib/TIFF/mkg3states.c @@ -266,36 +266,54 @@ void write_tables(); int verbose = FALSE; char *storage_class = ""; +#define OUT_FILENAME_MAX_LEN 64 +int fileout = FALSE; +char out_filename[OUT_FILENAME_MAX_LEN] = {0}; + int DECLARE2(main, int, argc, char**, argv) { - while (argc > 1 && argv[1][0] == '-') { - if (strcmp(argv[1], "-v") == 0) { - verbose = TRUE; - argc--, argv++; - } else if (strcmp(argv[1], "-c") == 0) { - storage_class = "const "; - argc--, argv++; - } - } - build_null_mode_tables(); /* null mode decoding tables */ - if (verbose) { - fprintf(stderr, "%d null mode prefixes defined\n", - (int) null_mode_prefix_count); - fprintf(stderr, "building uncompressed mode scripts...\n"); + while (argc > 1 && argv[1][0] == '-') { + if (strcmp(argv[1], "-v") == 0) { + verbose = TRUE; + argc--, argv++; + } else if (strcmp(argv[1], "-c") == 0) { + storage_class = "const "; + argc--, argv++; + } else if (strncmp(argv[1], "-o=", 3) == 0) { + fileout = TRUE; + strncpy(out_filename, &(argv[1][3]), OUT_FILENAME_MAX_LEN-1); + argc--, argv++; + } else { + fprintf(stderr, "Error: I don't understand %s\n",argv[1]); + exit(1); } - build_uncomp_mode_tables(); /* uncompressed mode decoding tables */ - if (verbose) { - fprintf(stderr, "%d uncompressed mode prefixes defined\n", - (int) uncomp_mode_prefix_count); - fprintf(stderr, "building 1D scripts...\n"); - } - build_horiz_mode_tables(); /* 1D decoding tables */ - if (verbose) - fprintf(stderr, "%d incomplete prefixes defined\n", - (int) horiz_mode_prefix_count); + } + build_null_mode_tables(); /* null mode decoding tables */ + if (verbose) { + fprintf(stderr, "%d null mode prefixes defined\n", + (int) null_mode_prefix_count); + fprintf(stderr, "building uncompressed mode scripts...\n"); + } + build_uncomp_mode_tables(); /* uncompressed mode decoding tables */ + if (verbose) { + fprintf(stderr, "%d uncompressed mode prefixes defined\n", + (int) uncomp_mode_prefix_count); + fprintf(stderr, "building 1D scripts...\n"); + } + build_horiz_mode_tables(); /* 1D decoding tables */ + if (verbose) + fprintf(stderr, "%d incomplete prefixes defined\n", + (int) horiz_mode_prefix_count); + + if (fileout) { + FILE* f = fopen(out_filename, "w"); + write_tables(f); + fclose(f); + } else { write_tables(stdout); - return 0; + } + return 0; } void diff --git a/src/lib/Unidraw/catalog.cpp b/src/lib/Unidraw/catalog.cpp index 27c9124..a042e4e 100644 --- a/src/lib/Unidraw/catalog.cpp +++ b/src/lib/Unidraw/catalog.cpp @@ -69,9 +69,6 @@ #include #include #include -#if !defined(HAVE_SSTREAM) -#include -#endif #if HAVE_UNISTD_H #include #endif @@ -1620,12 +1617,8 @@ PSPattern* Catalog::ReadPattern (const char* n, int index) { } } else { -#if defined(HAVE_SSTREAM) istringstream in(definition); -#else - istrstream in(definition, strlen(definition) + 1); -#endif - int data[patternHeight]; + int data[patternHeight]; int i; for (i = 0; in >> buf && i < patternHeight; i++) { From c96d3e87d7740ed8e74f44938af028604d4dd536 Mon Sep 17 00:00:00 2001 From: Pramod Kumbhar Date: Wed, 7 Aug 2019 01:58:23 +0200 Subject: [PATCH 2/6] Fixes for windows build (#7) - Following build iv fine cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCMAKE_C_COMPILER=/mingw64/bin/gcc -DCMAKE_CXX_COMPILER=/mingw64/bin/g++ - Todo : Debug build is working fine. But with release mode I don't see graphics with idemo. - CMake fixes for CMake 3.15.0 (#8) - For Release build , MWAssert has side effects in 52 statements. SO cannot be completely turned off. --- CMakeLists.txt | 24 ++++++++++++------------ cmake/PlatformHelper.cmake | 5 +++++ src/bin/CMakeLists.txt | 6 +++--- src/include/IV-Win/MWlib.h | 4 +++- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c120337..68cf565 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ option(IV_BUILD_SHARED "Build libraries shared or static" OFF) # ============================================================================= # CMake build settings # ============================================================================= -set(CMAKE_BUILD_TYPE RelWithDebInfo) +set(CMAKE_BUILD_TYPE Debug) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) if(NOT ${IV_BUILD_SHARED}) @@ -36,12 +36,22 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "CYGWIN") set(CYGWIN 1) endif() +# ============================================================================= +# Include cmake modules +# ============================================================================= +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +include(HelperFunctions) +include(PlatformHelper) +include(RpathHelper) +include(CheckIncludeFiles) +include(CheckFunctionExists) + # ============================================================================= # Find dependencies # ============================================================================= find_package(X11) -if(NOT ${X11_FOUND}) +if(NOT X11_FOUND AND NOT IV_WINDOWS_BUILD) if(APPLE) message(FATAL_ERROR "Install XQuartz from https://www.xquartz.org/ to build iv") else() @@ -49,16 +59,6 @@ if(NOT ${X11_FOUND}) endif() endif() -# ============================================================================= -# Include cmake modules -# ============================================================================= -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -include(HelperFunctions) -include(PlatformHelper) -include(RpathHelper) -include(CheckIncludeFiles) -include(CheckFunctionExists) - # ============================================================================= # Check existance of various headers, functions and directories # ============================================================================= diff --git a/cmake/PlatformHelper.cmake b/cmake/PlatformHelper.cmake index 8315b65..a6c52c9 100644 --- a/cmake/PlatformHelper.cmake +++ b/cmake/PlatformHelper.cmake @@ -4,3 +4,8 @@ if(WIN32 OR MINGW) set(IV_WINDOWS_BUILD TRUE) endif() + +# used in config.h +if(${CMAKE_SYSTEM_NAME} MATCHES "CYGWIN") + set(CYGWIN 1) +endif() diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index b01b742..491b9f5 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -19,7 +19,7 @@ set(ICLASS_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/iclass/iclass.cpp ${CMAKE_CURRENT_SOURCE_DIR}/iclass/main.cpp) -if(NOT BUILD_UNDER_WINDOWS) +if(NOT IV_WINDOWS_BUILD) add_executable(iclass ${ICLASS_SOURCE_FILES}) target_include_directories(iclass BEFORE PUBLIC ${PROJECT_SOURCE_DIR}/src/include/IV-2_6) set_source_files_properties(${ICLASS_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Div2_6_compatible") @@ -43,7 +43,7 @@ set(IDRAW_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/idraw/idvars.cpp ${CMAKE_CURRENT_SOURCE_DIR}/idraw/main.cpp) -if(NOT BUILD_UNDER_WINDOWS) +if(NOT IV_WINDOWS_BUILD) add_executable(idraw ${IDRAW_SOURCE_FILES}) target_include_directories(idraw BEFORE PUBLIC ${PROJECT_SOURCE_DIR}/src/include/IV-2_6) set_source_files_properties(${IDRAW_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Div2_6_compatible") @@ -53,7 +53,7 @@ endif() # ============================================================================= # Install various targets # ============================================================================= -if(NOT BUILD_UNDER_WINDOWS) +if(NOT IV_WINDOWS_BUILD) install(TARGETS iclass DESTINATION bin) install(TARGETS idraw DESTINATION bin) endif() diff --git a/src/include/IV-Win/MWlib.h b/src/include/IV-Win/MWlib.h index a184131..5dc74a9 100755 --- a/src/include/IV-Win/MWlib.h +++ b/src/include/IV-Win/MWlib.h @@ -55,7 +55,9 @@ void MWcleanup(); // ---- error handling support ---- void mwAssertion(const char* msg, const char* file, unsigned int line); #ifdef NDEBUG -#define MWassert(test) ((void) 0) +// cannot be completely turned off becasue 52 cases with side effects +//#define MWassert(test) ((void) 0) +#define MWassert(test) ((void)(test)) #else #define MWassert(test) ((void)((test) || (mwAssertion(#test,__FILE__,__LINE__),1))) #endif From af15493b2612736535094ff15b2a8a58f0e26d00 Mon Sep 17 00:00:00 2001 From: Pramod Kumbhar Date: Mon, 30 Sep 2019 07:22:12 +0200 Subject: [PATCH 3/6] Add build status and fix warning on OSX (#9) * Added build status after cmake command * Fix macro re-definition warning on OSX ``` /Users/kumbhar/workarena/repos/bbp/iv/src/lib/InterViews/tiff.cpp:36:9: warning: 'howmany' macro redefined [-Wmacro-redefined] #define howmany(x, y) (((x)+((y)-1))/(y)) ^ /usr/include/sys/types.h:188:9: note: previous definition is here #define howmany(x, y) __DARWIN_howmany(x, y) /* # y's == x bits? */ ^ 1 warning generated. ``` --- CMakeLists.txt | 28 +++++++++++++++++++++++++++- src/lib/InterViews/tiff.cpp | 2 ++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68cf565..7c22f98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR) -project(iv C CXX) +project(INTERVIEWS C CXX) # ============================================================================= # CMake common project settings @@ -140,3 +140,29 @@ add_subdirectory(src/lib) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/include/ DESTINATION include) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iv-config.cmake DESTINATION share/cmake/iv/) install(EXPORT iv NAMESPACE iv_ DESTINATION share/cmake/iv) + +# ============================================================================= +# Print build status +# ============================================================================= +message(STATUS "") +message(STATUS "Configured INTERVIEWS ${PROJECT_VERSION}") +message(STATUS "") +string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) +if(cmake_generator_tolower MATCHES "makefile") + message(STATUS "Some things you can do now:") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "Command | Description") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "make install | Will install INTERVIEWS to: ${CMAKE_INSTALL_PREFIX}") + message(STATUS " | Change the install location of NEURON using:") + message(STATUS " | cmake -DCMAKE_INSTALL_PREFIX=") + message(STATUS "make uninstall| Removes files installed by make install") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "Build option | Status") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "SHARED | ${IV_BUILD_SHARED}") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS " See more : https://github.com/neuronsimulator/iv") + message(STATUS "--------------+--------------------------------------------------------------") +endif() +message(STATUS "") diff --git a/src/lib/InterViews/tiff.cpp b/src/lib/InterViews/tiff.cpp index d0f6bca..1e4e373 100644 --- a/src/lib/InterViews/tiff.cpp +++ b/src/lib/InterViews/tiff.cpp @@ -33,7 +33,9 @@ #include #include +#if !defined(howmany) #define howmany(x, y) (((x)+((y)-1))/(y)) +#endif typedef unsigned char u_char; typedef unsigned short u_short; From 5bce60ece8334bba6918f1735055c4909fb15751 Mon Sep 17 00:00:00 2001 From: Pramod Kumbhar Date: Fri, 4 Oct 2019 09:16:24 +0200 Subject: [PATCH 4/6] To be able to use project as submodule, avoid using PROJECT_SOURCE_DIR (#10) --- CMakeLists.txt | 17 ++++++++++++++--- src/bin/CMakeLists.txt | 4 ++-- src/lib/CMakeLists.txt | 8 ++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c22f98..c1977a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) + +# ============================================================================= +# To be able to use project as submodule, avoid using PROJECT_SOURCE_DIR +# ============================================================================= +set(IV_PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +# For future target customization +set(IV_AS_SUBPROJECT OFF) +if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(IV_AS_SUBPROJECT ON) +endif() + # ============================================================================= # Project build options # ============================================================================= @@ -39,7 +50,7 @@ endif() # ============================================================================= # Include cmake modules # ============================================================================= -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${IV_PROJECT_SOURCE_DIR}/cmake) include(HelperFunctions) include(PlatformHelper) include(RpathHelper) @@ -130,7 +141,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DI # ============================================================================= # Include source directories # ============================================================================= -include_directories(${PROJECT_SOURCE_DIR}/src/include) +include_directories(${IV_PROJECT_SOURCE_DIR}/src/include) add_subdirectory(src/bin) add_subdirectory(src/lib) @@ -139,7 +150,7 @@ add_subdirectory(src/lib) # ============================================================================= install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/include/ DESTINATION include) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iv-config.cmake DESTINATION share/cmake/iv/) -install(EXPORT iv NAMESPACE iv_ DESTINATION share/cmake/iv) +install(EXPORT iv DESTINATION share/cmake/iv) # ============================================================================= # Print build status diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index 491b9f5..6050833 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -21,7 +21,7 @@ set(ICLASS_SOURCE_FILES if(NOT IV_WINDOWS_BUILD) add_executable(iclass ${ICLASS_SOURCE_FILES}) - target_include_directories(iclass BEFORE PUBLIC ${PROJECT_SOURCE_DIR}/src/include/IV-2_6) + target_include_directories(iclass BEFORE PUBLIC ${IV_PROJECT_SOURCE_DIR}/src/include/IV-2_6) set_source_files_properties(${ICLASS_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Div2_6_compatible") target_link_libraries(iclass unidraw interviews ${X11_LIBRARIES}) endif() @@ -45,7 +45,7 @@ set(IDRAW_SOURCE_FILES if(NOT IV_WINDOWS_BUILD) add_executable(idraw ${IDRAW_SOURCE_FILES}) - target_include_directories(idraw BEFORE PUBLIC ${PROJECT_SOURCE_DIR}/src/include/IV-2_6) + target_include_directories(idraw BEFORE PUBLIC ${IV_PROJECT_SOURCE_DIR}/src/include/IV-2_6) set_source_files_properties(${IDRAW_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Div2_6_compatible") target_link_libraries(idraw unidraw interviews ${X11_LIBRARIES}) endif() diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 8af6c08..530bdec 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -326,10 +326,10 @@ set( # command to generate g3states.h add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/g3states.h - COMMAND ${CMAKE_BINARY_DIR}/bin/mkg3states -o=g3states.h + COMMAND mkg3states -o=g3states.h WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/TIFF VERBATIM - DEPENDS ${CMAKE_BINARY_DIR}/bin/mkg3states) + DEPENDS mkg3states) set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/TIFF/g3states.h PROPERTIES @@ -347,7 +347,7 @@ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/TIFF/mkg3states.c ${TIFF_DEFINES}) add_executable(mkg3states ${CMAKE_CURRENT_SOURCE_DIR}/TIFF/mkg3states.c) -target_include_directories(mkg3states PUBLIC ${PROJECT_SOURCE_DIR}/src/include/TIFF) +target_include_directories(mkg3states PUBLIC ${IV_PROJECT_SOURCE_DIR}/src/include/TIFF) # ============================================================================= # IV library @@ -392,7 +392,7 @@ add_library(interviews ${IV_LIB_TYPE} ${INTERVIEWS_SOURCES}) target_link_libraries(interviews ${X11_LIBRARIES}) target_include_directories(interviews PRIVATE ${X11_INCLUDE_DIR} - $ + $ $) set_property(TARGET interviews PROPERTY POSITION_INDEPENDENT_CODE ON) From 26ab5ca7764f1172445a08fca133e9466ca48581 Mon Sep 17 00:00:00 2001 From: Pramod Kumbhar Date: Sat, 5 Oct 2019 13:59:04 +0200 Subject: [PATCH 5/6] CMake configuration tuning (#11) - avoid installing iv-config if project is being installed as subproject. Otherwise CMake of neuron finds it as external project when building second time - change share/cmake/iv to share/cmake to avoid directory specification for every project - MINGW also installs libinterviews in lib - Remove unnecessary log/output messages (#12) --- CMakeLists.txt | 12 +++++++++--- cmake/HelperFunctions.cmake | 2 -- cmake/iv-config.cmake | 8 ++++++++ iv-config.cmake | 8 -------- src/lib/CMakeLists.txt | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 cmake/iv-config.cmake delete mode 100644 iv-config.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c1977a5..9ee26f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,8 @@ endif() # ============================================================================= # Check existance of various headers, functions and directories # ============================================================================= +set(CMAKE_REQUIRED_QUIET TRUE) +message(STATUS "Checking for include files") check_include_files(fcntl.h HAVE_FCNTL_H) check_include_files(malloc.h HAVE_MALLOC_H) check_include_files(memory.h HAVE_MEMORY_H) @@ -93,6 +95,7 @@ check_include_files(sys/stat.h HAVE_SYS_STAT_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(unistd.h HAVE_UNISTD_H) +message(STATUS "Checking for functions") check_function_exists(getcwd HAVE_GETCWD) check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) check_function_exists(mmap HAVE_MMAP) @@ -104,11 +107,13 @@ check_function_exists(strtod HAVE_STRTOD) check_function_exists(strtol HAVE_STRTOL) check_function_exists(uname HAVE_UNAME) +message(STATUS "Checking for include directories") iv_check_dir_exists(dirent.h HAVE_DIRENT_H) iv_check_dir_exists(ndir.h HAVE_NDIR_H) iv_check_dir_exists(sys/dir.h HAVE_SYS_DIR_H) iv_check_dir_exists(sys/ndir.h HAVE_SYS_NDIR_H) +message(STATUS "Checking for types") iv_check_type_exists(sys/types.h gid_t int gid_t) iv_check_type_exists(sys/types.h off_t "long int" off_t) iv_check_type_exists(sys/types.h pid_t int pid_t) @@ -149,8 +154,10 @@ add_subdirectory(src/lib) # Install binaries and headers # ============================================================================= install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/include/ DESTINATION include) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iv-config.cmake DESTINATION share/cmake/iv/) -install(EXPORT iv DESTINATION share/cmake/iv) +if(NOT IV_AS_SUBPROJECT) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/iv-config.cmake DESTINATION share/cmake) + install(EXPORT iv DESTINATION share/cmake) +endif() # ============================================================================= # Print build status @@ -167,7 +174,6 @@ if(cmake_generator_tolower MATCHES "makefile") message(STATUS "make install | Will install INTERVIEWS to: ${CMAKE_INSTALL_PREFIX}") message(STATUS " | Change the install location of NEURON using:") message(STATUS " | cmake -DCMAKE_INSTALL_PREFIX=") - message(STATUS "make uninstall| Removes files installed by make install") message(STATUS "--------------+--------------------------------------------------------------") message(STATUS "Build option | Status") message(STATUS "--------------+--------------------------------------------------------------") diff --git a/cmake/HelperFunctions.cmake b/cmake/HelperFunctions.cmake index 0a057ba..7b9c673 100644 --- a/cmake/HelperFunctions.cmake +++ b/cmake/HelperFunctions.cmake @@ -24,7 +24,6 @@ function(iv_check_dir_exists HEADER VARIABLE) # try to compile try_compile(RESULT_VAR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/conftest.c) set(${VARIABLE} ${RESULT_VAR} PARENT_SCOPE) - message(STATUS "iv_check_dir_exists ${HEADER}: ${RESULT_VAR}") file(REMOVE "conftest.c") endif() endfunction() @@ -56,7 +55,6 @@ function(iv_check_type_exists HEADER TYPE DEFAULT_TYPE VARIABLE) if(NOT ${RESULT_VAR}) set(${VARIABLE} ${DEFAULT_TYPE} PARENT_SCOPE) endif() - message(STATUS "iv_check_type_exists ${VARIABLE}: ${RESULT_VAR}") file(REMOVE "conftest.c") endfunction() diff --git a/cmake/iv-config.cmake b/cmake/iv-config.cmake new file mode 100644 index 0000000..68bb402 --- /dev/null +++ b/cmake/iv-config.cmake @@ -0,0 +1,8 @@ +# iv-config.cmake - package configuration file + +get_filename_component(CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) + +find_path(IV_INCLUDE_DIR "ivversion.h" HINTS "${CONFIG_PATH}/../../include") +find_path(IV_LIB_DIR NAMES libinterviews.a libinterviews.so libinterviews.dylib HINTS "${CONFIG_PATH}/../../lib") + +include(${CONFIG_PATH}/iv.cmake) diff --git a/iv-config.cmake b/iv-config.cmake deleted file mode 100644 index 808c6f2..0000000 --- a/iv-config.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# iv-config.cmake - package configuration file - -get_filename_component(CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) - -find_path(iv_INCLUDE "ivversion.h" HINTS "${CONFIG_PATH}/../../../include") -find_path(iv_LIB NAMES libinterviews.a libinterviews.so libinterviews.dylib HINTS "${CONFIG_PATH}/../../../lib") - -include(${CONFIG_PATH}/iv.cmake) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 530bdec..c3a751e 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -432,7 +432,7 @@ if(NOT IV_WINDOWS_BUILD) else() install(TARGETS interviews EXPORT iv - DESTINATION bin + DESTINATION lib INCLUDES DESTINATION $) endif() From 254fa24ed1046a15554c1a846532633becc23247 Mon Sep 17 00:00:00 2001 From: Pramod Kumbhar Date: Mon, 2 Dec 2019 16:06:14 +0100 Subject: [PATCH 6/6] Add travis build script and update IV_BUILD_SHARED option to IV_ENABLE_SHARED * add travis build config * change IV_BUILD_SHARED to IV_ENABLE_SHARED option * remove ivstrm.h related options and remove legacy config files --- .travis.yml | 52 +++++++++++++++++++++++++++++++ CMakeLists.txt | 6 ++-- chkstream.m4 | 70 ------------------------------------------ configure.in | 4 +-- makedist | 1 - src/lib/CMakeLists.txt | 2 +- 6 files changed, 57 insertions(+), 78 deletions(-) create mode 100644 .travis.yml delete mode 100755 chkstream.m4 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f0344c3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,52 @@ +#============================================================================= +# Travis IV settings +#============================================================================= + +#============================================================================= +# Environment +#============================================================================= +language: cpp +dist: bionic +osx_image: xcode10.2 + +#============================================================================= +# Common Packages +#============================================================================= +addons: + apt: + packages: + - libx11-dev + - libxcomposite-dev + homebrew: + packages: + - xz + +#============================================================================= +# Configure build matrix and corresponding environment +#============================================================================= +env: + global: + - INSTALL_DIR="$HOME/install" + jobs: + - BUILD_CMD="bash build.sh && ./configure --prefix=$INSTALL_DIR" + - BUILD_CMD="cmake . -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DIV_ENABLE_SHARED=OFF" + - BUILD_CMD="cmake . -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DIV_ENABLE_SHARED=ON" +os: + - linux + - osx + +#============================================================================= +# Setup environment and Install dependencies (nothing for now) +#============================================================================= +before_install: + - echo $LANG + - echo $LC_ALL + - $CXX -v + +#============================================================================= +# Build and install +#============================================================================= +script: + - eval ${BUILD_CMD} + - make -j 2 + - make install diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ee26f6..ce571f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ endif() # ============================================================================= # Project build options # ============================================================================= -option(IV_BUILD_SHARED "Build libraries shared or static" OFF) +option(IV_ENABLE_SHARED "Build libraries shared or static" OFF) # ============================================================================= # CMake build settings @@ -35,7 +35,7 @@ option(IV_BUILD_SHARED "Build libraries shared or static" OFF) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -if(NOT ${IV_BUILD_SHARED}) +if(NOT IV_ENABLE_SHARED) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(IV_LIB_TYPE "STATIC") else() @@ -177,7 +177,7 @@ if(cmake_generator_tolower MATCHES "makefile") message(STATUS "--------------+--------------------------------------------------------------") message(STATUS "Build option | Status") message(STATUS "--------------+--------------------------------------------------------------") - message(STATUS "SHARED | ${IV_BUILD_SHARED}") + message(STATUS "SHARED | ${IV_ENABLE_SHARED}") message(STATUS "--------------+--------------------------------------------------------------") message(STATUS " See more : https://github.com/neuronsimulator/iv") message(STATUS "--------------+--------------------------------------------------------------") diff --git a/chkstream.m4 b/chkstream.m4 deleted file mode 100755 index f417d21..0000000 --- a/chkstream.m4 +++ /dev/null @@ -1,70 +0,0 @@ -dnl make sure we can use the output and input for a stream - -AC_LANG_SAVE -AC_LANG_CPLUSPLUS - -AC_CXX_NAMESPACES -AC_CXX_HAVE_SSTREAM - -xCXXFLAGS="$CXXFLAGS" - -if test "$ac_cv_cxx_have_sstream" != yes; then - -AC_CHECK_HEADERS(stream.h,[xstmt="define HAVE_STREAM_H"],[xstmt="undef HAVE_STREAM_H"]) - -ystmt="undef NO_OUTPUT_OPENMODE" -AC_TRY_COMPILE([ -#include "src/include/ivstrm.h" -],[ - filebuf obuf; - obuf.open("name", IOS_OUT); -],[ -echo "ivstream.h works with #${xstmt}" -],[ -echo "in ivstream.h, the obuf.open("name", output) does not work with #${xstmt}" -echo " trying the NO_OUTPUT_OPENMODE definition" -ystmt="define NO_OUTPUT_OPENMODE" -CXXFLAGS="$CXXFLAGS -DNO_OUTPUT_OPENMODE" -AC_TRY_COMPILE([ -#${ystmt} -#include "src/include/ivstrm.h" -],[ - filebuf obuf; - obuf.open("name", IOS_OUT); -],[ -echo "ivstream.h works with #${xstmt} and #${ystmt}" -AC_DEFINE(NO_OUTPUT_OPENMODE,1,[define if stream.h is isufficient by itself]) -],[ -echo "in ivstream.h, obuf.open("name", std::ios_base::out) does not work with #${xstmt}" -echo " Fix iv-14/src/include/ivstream.h in such a way that configure" -echo " does not stop here." -exit 1 -]) -]) - -fi - -AC_TRY_LINK([ -#${ystmt} -#include "src/include/ivstrm.h" -#if defined(HAVE_NAMESPACES) -using namespace std; -#endif -],[ - filebuf obuf; - obuf.open("name", IOS_OUT); -],[ -echo "We are able to link a c++ program that uses streams" -],[ -echo "The attempt to link a program with the statment" -echo " obuf.open("name", IOS_OUT);" -echo "failed. (Although it compiled in an earlier test)." -echo 'Perhaps you need to add another library. eg setenv LIBS "-lstdc++".' -echo " Fix LIBS or src/include/ivstream.h.in in such a way that configure" -echo " does not stop here." -exit 1 -]) - -CXXFLAGS="$xCXXFLAGS" - -AC_LANG_RESTORE diff --git a/configure.in b/configure.in index 906465b..069fd32 100755 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/bin/iclass/classbuffer.cpp) dnl some random source file. -AC_CONFIG_HEADER(config.h src/include/ivstream.h) +AC_CONFIG_HEADER(config.h) AH_TOP([ #ifndef H_config_included @@ -101,8 +101,6 @@ dnl Checks for libraries. AC_CHECK_LIBM LIBS="$LIBS $LIBM" -sinclude(./chkstream.m4) - dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC diff --git a/makedist b/makedist index 4c629c8..c94d66c 100755 --- a/makedist +++ b/makedist @@ -47,7 +47,6 @@ INSTALL \ README \ acinclude.m4 \ build.sh \ -chkstream.m4 \ config.guess \ config.sub \ install-sh \ diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index c3a751e..f4a83f4 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -404,7 +404,7 @@ endif() # Unidraw library # ============================================================================= if(NOT IV_WINDOWS_BUILD) - if(${IV_BUILD_SHARED}) + if(IV_ENABLE_SHARED) add_library(unidraw SHARED ${UNIDRAW_SOURCE_FILES}) else() add_library(unidraw STATIC ${UNIDRAW_SOURCE_FILES})