-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
91 lines (71 loc) · 3.21 KB
/
CMakeLists.txt
File metadata and controls
91 lines (71 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#
# CMakeLists.txt for AP203 Minimum
#
# This file is released to the public domain. Any part of this file may be
# freely copied in part or in full for any purpose. No acknowledgment is required
# for the use of this file.
#
PROJECT( AP203Minimum )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Set STEPCODE_ROOT_DIR to point to the root of the STEPcode source tree.
if( NOT DEFINED STEPCODE_ROOT_DIR )
message( FATAL_ERROR "STEPCODE_ROOT_DIR is not defined! Set via cmake-gui or on command line:\n cmake .. -DSTEPCODE_ROOT_DIR=/path/to/sc" )
endif( NOT DEFINED STEPCODE_ROOT_DIR )
# STEPCODE_ROOT_DIR is relative or absolute path?
if( EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
set( STEPCODE_ROOT_DIR "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}" )
message( "** STEPCODE_ROOT_DIR is a relative path; converted to absolute path: ${STEPCODE_ROOT_DIR}." )
else()
if( NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
message( FATAL_ERROR "**** Cannot locate STEPCODE_ROOT_DIR - try an absolute path." )
endif( NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
endif( EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt" )
# Use STEPcode as library, but build from this build process.
set( SC_IS_SUBBUILD TRUE )
# Build type, DEBUG or RELEASE
if( NOT DEFINED CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Debug )
endif( NOT DEFINED CMAKE_BUILD_TYPE )
set( SC_BUILD_TYPE ${CMAKE_BUILD_TYPE} )
# Path to STEPcode
set( STEPCODE_BUILD_DIR ${CMAKE_BINARY_DIR}/sc CACHE PATH "STEPcode build subdir" )
# STEP schema to build and link against.
set( SCHEMA ap203 )
set( SC_BUILD_SCHEMAS ${SCHEMA} CACHE INTERNAL "Schema, internal, immutable" FORCE )
# Parse out schema name and library.
set( SCHEMA_PATH "${STEPCODE_ROOT_DIR}/data/${SCHEMA}/*.exp" )
file( GLOB SCHEMA_FILE "${SCHEMA_PATH}" )
if( NOT EXISTS ${SCHEMA_FILE} )
message( FATAL_ERROR "Cannot find the schema; cannot continue. Looked for ${SCHEMA_PATH} from ${CMAKE_CURRENT_LIST_DIR}" )
endif( NOT EXISTS ${SCHEMA_FILE} )
get_filename_component( SCHEMA_SN ${SCHEMA_FILE} NAME )
string( REGEX REPLACE "\(.*\).[Ee][Xx][Pp]" "\\1" SCHEMA_LINK_NAME ${SCHEMA_SN} )
set( STEPCODE_LIBRARIES base stepcore stepeditor stepdai steputils sdai_${SCHEMA_LINK_NAME} )
# Add STEPCode project to CMake build.
add_subdirectory( ${STEPCODE_ROOT_DIR} "${CMAKE_CURRENT_BINARY_DIR}/sc" EXCLUDE_FROM_ALL )
# Set up STEPcode include directories.
set( STEPCODE_INCLUDE_DIR
${STEPCODE_ROOT_DIR}/src/base
${STEPCODE_ROOT_DIR}/src/clstepcore
${STEPCODE_ROOT_DIR}/src/cldai
${STEPCODE_ROOT_DIR}/src/clutils
${STEPCODE_ROOT_DIR}/src/cleditor
${STEPCODE_BUILD_DIR}/include
${STEPCODE_ROOT_DIR}/include
${CMAKE_BINARY_DIR}
)
# Reset sane values for build destination. Otherwise, everything ends up in ${CMAKE_BINARY_DIR}/sc
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
include_directories(
${STEPCODE_INCLUDE_DIR}
)
# Application sources and headers
set( SRCS
ap203min.cpp
)
set( HDRS
)
add_executable( ${PROJECT_NAME} ${SRCS} ${HDRS} )
target_link_libraries( ${PROJECT_NAME} ${STEPCODE_LIBRARIES} )
set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-I${STEPCODE_BUILD_DIR}/data/${SCHEMA_LINK_NAME}" )