]> gerrit.simantics Code Review - simantics/3d.git/blob - org.jcae.opencascade/CMakeLists.txt
Fix error in inserting dual inline components
[simantics/3d.git] / org.jcae.opencascade / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2 find_package(SWIG REQUIRED)
3 include(${SWIG_USE_FILE})
4 find_package(JNI REQUIRED)
5
6 #From oce/examples/find_package_components/CMakeLists.txt
7 set(OCE_TOOLKITS TKBRep TKBool TKG2d TKG3d TKGeomBase TKIGES TKMath TKOffset TKXSBase TKernel TKSTEP TKPrim TKTopAlgo TKFillet TKMesh TKBO TKGeomAlgo TKShHealing TKSTEPBase)
8 find_package(OCE COMPONENTS ${OCE_TOOLKITS})
9 if(OCE_FOUND)
10     message(STATUS "Found OCE version ${OCE_VERSION}")
11     if(NOT OCE_ALL_FOUND)
12       set(OCE_FOUND false)
13       message(WARNING "Ignoring OCE installation due to missing toolkit(s): ${OCE_MISSING_TOOLKITS}")
14     endif(NOT OCE_ALL_FOUND)
15 endif(OCE_FOUND)
16
17 if(OCE_FOUND)
18     # Include files reside in ${OCE_INCLUDE_DIRS};
19     include_directories(${OCE_INCLUDE_DIRS})
20     # We do not need library path, they will be automatically imported.
21 else(OCE_FOUND)
22     # OCE not found; either it is not found and user
23     # has to set OCE_DIR to the directory containing
24     # OCEConfig.cmake, or OCE is not installed and we
25     # try to find OpenCascade files.
26     find_path(OCC_INCLUDE_PATH "TopoDS_Shape.hxx" PATHS ENV CASROOT PATH_SUFFIXES inc include opencascade)
27     if(NOT OCC_INCLUDE_PATH)
28         message(FATAL_ERROR "Header file TopoDS_Shape.hxx not found.  To specify paths of OpenCascade files, you may either define the CASROOT environment variable, or set both OCC_INCLUDE_PATH and OCC_LIB_PATH variables.")
29     endif(NOT OCC_INCLUDE_PATH)
30
31     if(WIN32)
32         set(OCC_LIB_EXTRA_PATH "win32")
33     else(WIN32)
34         set(OCC_LIB_EXTRA_PATH "lin")
35     endif(WIN32)
36     find_library(OCC_LIB_PATH TKernel PATHS ENV CASROOT PATH_SUFFIXES lib64 lib
37                  ${OCC_LIB_EXTRA_PATH}/lib ${OCC_LIB_EXTRA_PATH}/vc8/lib)
38     if(NOT OCC_LIB_PATH)
39         message(FATAL_ERROR "OpenCascade TKernel library not found.  To specify paths of OpenCascade files, you may either define the CASROOT environment variable, or set both OCC_INCLUDE_PATH and OCC_LIB_PATH variables.")
40     endif(NOT OCC_LIB_PATH)
41     message(STATUS "OCC search path for include files: OCC_INCLUDE_PATH=${OCC_INCLUDE_PATH}")
42     include_directories(${OCC_INCLUDE_PATH})
43     message(STATUS "OCC search path for libraries: OCC_LIB_PATH=${OCC_LIB_PATH}")
44     link_directories(${OCC_LIB_PATH})
45 endif(OCE_FOUND)
46
47 set_source_files_properties(src/OccJava.i PROPERTIES CPLUSPLUS ON)
48 include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${OCE_INCLUDE_DIR} src)
49 set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_SOURCE_DIR}/src-java/org/jcae/opencascade/jni)
50 if(WIN32)
51   add_definitions(-DWNT)
52   if(MINGW)
53       set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--add-stdcall-alias ${CMAKE_MODULE_LINKER_FLAGS}")
54   endif(MINGW)
55 endif(WIN32)
56 set(CMAKE_SWIG_FLAGS -package org.jcae.opencascade.jni)
57 #CMake won't create this directory it self. A bug ?
58 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src)
59
60 SWIG_ADD_MODULE(OccJava java src/OccJava.i src/jnistream.cxx)
61 SWIG_LINK_LIBRARIES(OccJava ${OCE_TOOLKITS})
62