2 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
4 INCLUDE (CheckIncludeFiles)
6 MACRO(VXOPTION varname description defaultvalue)
7 OPTION(${varname} ${description} ${defaultvalue})
10 MACRO(VXOPTION_A varname description defaultvalue)
11 VXOPTION(${varname} ${description} ${defaultvalue})
12 MARK_AS_ADVANCED(${varname})
15 MACRO(VXCMINCLUDE file)
16 CMAKE_POLICY(SET CMP0011 NEW)
17 INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/${file}")
18 CMAKE_POLICY(SET CMP0011 OLD)
22 SET(CMAKE_C_FLAGS -m32)
23 SET(CMAKE_CXX_FLAGS -m32)
24 SET(CMAKE_SHARED_LINKER_FLAGS "-m32")
25 ENDMACRO(SET_32BIT_ENV)
29 CHECK_INCLUDE_FILES("malloc.h" HAVE_MALLOC_H)
32 # don't actually uncomment this unless you
33 # _do_ want to screw over the build
34 #set(CMAKE_BUILD_TYPE "Release")
35 SET(CMAKE_BUILD_TYPE "Debug")
36 #SET(CMAKE_CXX_FLAGS "-g3 -ggdb")
39 ## add the path to $srcdir/modules/ and
40 ## $installdir/modules
42 "-DVOX_MODULEPATH_SRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}/modules/\""
43 "-DVOX_MODULEPATH_INSTALLDIR=\"${CMAKE_INSTALL_PREFIX}/modules/\""
46 ## various options (usable from cmake-gui, for example)
48 "OFF to skip building the vox standard library" ON)
49 VXOPTION(BUILD_SHAREDLIBS
50 "ON to build libraries as shared libraries" ON)
51 VXOPTION(WITHOUT_COMPILER
52 "ON to skip the compiler (bytecode-only)" OFF)
53 VXOPTION(TRACE_API_CALLS
54 "ON to trace Vox API calls to stderr (warning: might slow vox down!)" OFF)
56 "ON to strip libraries/binaries (currently only used for CPack)" OFF)
58 "ON to build vox as 32bit library and binary/binaries. Currently only supported for GCC!"
62 SET(vox_corelib "vox_target_corelib")
63 SET(vox_corelib_name "vox")
66 SET(vox_stdlib "vox_target_stdlib")
67 SET(vox_stdlib_name "vox_stdlib")
70 # the frontend interpreter
71 SET(vox_exe "vox_target_exe")
72 SET(vox_exe_name "vox")
77 ## paths to be inserted into the runtime paths
79 "${CMAKE_INSTALL_PREFIX}"
80 "${CMAKE_INSTALL_PREFIX}/lib"
81 "${CMAKE_CURRENT_BINARY_DIR}"
82 "${CMAKE_CURRENT_BINARY_DIR}/lib"
84 ## the path to the headers
85 SET(vox_incpath "${CMAKE_CURRENT_SOURCE_DIR}/include")
89 # make cmake put all binaries/libraries in the root of the builddir
90 # note that this is set likely only temporary, as vox isn't quite
91 # ready yet to be installed, even though installing is supported
92 SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}")
93 SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}")
96 ## list of all headers (may be extended, if necessary)
97 SET(vox_includes "${vox_incpath}")
101 #set(Boost_USE_STATIC_RUNTIME ON)
102 FIND_PACKAGE(Boost COMPONENTS system filesystem regex)
103 MESSAGE(STATUS "\${Boost_INCLUDE_DIRS}: ${Boost_INCLUDE_DIRS}")
104 #set(Boost_FOUND OFF)
107 ## core libraries, taking care of dependencies
108 ## to dlfcn, LoadLibrary, and such
115 IF(CMAKE_SYSTEM_NAME MATCHES "(.+)BSD")
116 ## apparently, *BSD provides dlfcn via libc,
117 ## so nothing to do here
119 SET(vox_coredeps ${vox_coredeps} "dl")
121 SET(vox_coredeps ${vox_coredeps} "m")
125 MESSAGE(STATUS "Will link against libboost*")
126 ADD_DEFINITIONS("-DVOX_HAVEBOOST")
127 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
129 SET(vox_coredeps ${vox_coredeps} ${Boost_LIBRARIES})
133 ## add include paths to compiler flags (-I$path)
134 INCLUDE_DIRECTORIES(${vox_includes})
136 ## build actual projects
138 MESSAGE(STATUS "Vox will be built as 32Bit binaries!")
142 ADD_DEFINITIONS("-DVOX_TRACE_API_CALLS=1")
143 ENDIF(TRACE_API_CALLS)
145 ADD_DEFINITIONS("-DVOX_NO_COMPILER=1")
146 ENDIF(WITHOUT_COMPILER)
147 ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/src/core")
149 ADD_DEFINITIONS("-DVOX_STDLIB_AVAILABLE=1")
150 ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/src/stdlib")
152 ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/src/frontend")
155 ## installation of headerfiles
157 DIRECTORY "${vox_incpath}/vox"
161 #SET(CPACK_GENERATOR "DEB;TGZ;RPM")
162 SET(CPACK_GENERATOR "DEB")
163 SET(CPACK_PACKAGE_NAME "vox1")
164 SET(CPACK_PACKAGE_VERSION "1.0.1")
165 SET(CPACK_PACKAGE_VERSION_MAJOR "1")
166 SET(CPACK_PACKAGE_VERSION_MINOR "0")
167 SET(CPACK_PACKAGE_VERSION_PATCH "1")
168 SET(CPACK_PACKAGE_FILE_NAME "vox1")
169 SET(CPACK_PACKAGE_VENDOR "Beelzebub Software")
170 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Embeddable, extensible programming language")
171 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vox${CPACK_PACKAGE_VERSION_MAJOR}")
172 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
173 "VoxPL-${CPACK_PACKAGE_VERSION_MAJOR}")
174 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
175 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
176 #SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/pkg/welcome.txt")
177 SET(CPACK_NSIS_DISPLAY_NAME "Vox${CPACK_PACKAGE_VERSION_MAJOR} SDK")
178 SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "maintainer@email.address")