1 cmake_minimum_required(VERSION 2.8)
2 find_package(SWIG REQUIRED)
3 include(${SWIG_USE_FILE})
4 find_package(JNI REQUIRED)
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})
10 message(STATUS "Found OCE version ${OCE_VERSION}")
13 message(WARNING "Ignoring OCE installation due to missing toolkit(s): ${OCE_MISSING_TOOLKITS}")
14 endif(NOT OCE_ALL_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.
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)
32 set(OCC_LIB_EXTRA_PATH "win32")
34 set(OCC_LIB_EXTRA_PATH "lin")
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)
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})
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)
51 add_definitions(-DWNT)
53 set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--add-stdcall-alias ${CMAKE_MODULE_LINKER_FLAGS}")
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)
60 SWIG_ADD_MODULE(OccJava java src/OccJava.i src/jnistream.cxx)
61 SWIG_LINK_LIBRARIES(OccJava ${OCE_TOOLKITS})