Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vigsterkr committed Mar 9, 2019
1 parent d601184 commit a5e0b47
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
29 changes: 10 additions & 19 deletions cmake/FindOctave.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
# available at http://www.gnu.org/software/octave/
#
# This module defines:
# This module defines:
# OCTAVE_EXECUTABLE - octave interpreter
# OCTAVE_INCLUDE_DIRS - include path for mex.h, mexproto.h
# OCTAVE_LIBRARIES - required libraries: octinterp, octave, cruft
Expand Down Expand Up @@ -37,15 +37,15 @@
#=============================================================================
# Copyright 2013, Julien Schueller
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand All @@ -58,7 +58,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.
#=============================================================================

Expand All @@ -68,10 +68,6 @@ find_program(OCTAVE_CONFIG_EXECUTABLE


if (OCTAVE_CONFIG_EXECUTABLE)
execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -p PREFIX
OUTPUT_VARIABLE OCTAVE_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} --m-site-dir
OUTPUT_VARIABLE OCTAVE_M_SITE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down Expand Up @@ -121,7 +117,7 @@ find_program(OCTAVE_MKOCTFILE
HINTS ${OCTAVE_BIN_PATHS}
NAMES mkoctfile
)

find_library(OCTAVE_OCTINTERP_LIBRARY
NAMES octinterp liboctinterp
HINTS ${OCTAVE_LIBRARIES_PATHS}
Expand All @@ -141,7 +137,7 @@ if (OCTAVE_CRUFT_LIBRARY)
list (APPEND OCTAVE_LIBRARIES ${OCTAVE_CRUFT_LIBRARY})
endif ()

find_path (OCTAVE_INCLUDE_DIR
find_path (OCTAVE_INCLUDE_DIR
NAMES octave/oct.h
PATHS "${OCTAVE_INCLUDE_PATHS}/.."
)
Expand Down Expand Up @@ -183,12 +179,7 @@ endmacro ()

# handle REQUIRED and QUIET options
include (FindPackageHandleStandardArgs)
if (CMAKE_VERSION LESS 2.8.3)
find_package_handle_standard_args (Octave DEFAULT_MSG OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_INCLUDE_DIRS OCTAVE_LIBRARIES OCTAVE_VERSION_STRING)
else ()
find_package_handle_standard_args (Octave REQUIRED_VARS OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_INCLUDE_DIRS OCTAVE_LIBRARIES VERSION_VAR OCTAVE_VERSION_STRING)
endif ()

find_package_handle_standard_args (Octave REQUIRED_VARS OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_INCLUDE_DIRS OCTAVE_LIBRARIES VERSION_VAR OCTAVE_VERSION_STRING)

mark_as_advanced (
OCTAVE_OCT_FILE_DIR
Expand Down
3 changes: 1 addition & 2 deletions src/interfaces/octave/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FIND_PACKAGE(Octave 3.6 REQUIRED)
SET(OCTAVE_APIVERSION ${OCTAVE_MAJOR_VERSION})
UNSET(TARGET_SWIGFLAGS)

include(ShogunInterfaces)
Expand All @@ -8,7 +7,7 @@ include_directories(${OCTAVE_INCLUDE_DIRS})
GENERATE_INTERFACE_TARGET(octave ${CMAKE_CURRENT_SOURCE_DIR} "${OCTAVE_LIBRARIES}")
set_target_properties(interface_octave PROPERTIES PREFIX "")
set_target_properties(interface_octave PROPERTIES SUFFIX ".oct")
target_compile_definitions(interface_octave PRIVATE "OCTAVE_APIVERSION=${OCTAVE_API_VERSION}")
target_compile_definitions(interface_octave PRIVATE "OCTAVE_MAJOR_VERSION=${OCTAVE_MAJOR_VERSION};OCTAVE_MINOR_VERSION=${OCTAVE_MINOR_VERSION}")

SET(INTERFACE_OCTAVE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
install (TARGETS interface_octave
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/octave/sg_print_functions.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#if ((OCTAVE_MAJOR_VERSION == 4) && (OCTAVE_MINOR_VERSION >= 4))
#include <octave/octave-config.h>
#else
#include <octave/config.h>
#endif

#include <octave/Cell.h>
#include <octave/defun-dld.h>
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/octave/swig_typemaps.i
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
*/

%{
#if ((OCTAVE_MAJOR_VERSION == 4) && (OCTAVE_MINOR_VERSION >= 4))
#include <octave/octave-config.h>
#else
#include <octave/config.h>
#endif

#include <octave/ov.h>
#include <octave/defun-dld.h>
Expand Down

0 comments on commit a5e0b47

Please sign in to comment.