removed slot operator (no longer needed) & class proto bug fix to use NewSlot by...
[vox.git] / CMakeLists.txt
blobc6d73662b509d516425668e200096358759923dd
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 PROJECT(VoxLang CXX C)
4 INCLUDE (CheckIncludeFiles)
6 MACRO(VXOPTION varname description defaultvalue)
7     OPTION(${varname} ${description} ${defaultvalue})
8 ENDMACRO(VXOPTION)
10 MACRO(VXOPTION_A varname description defaultvalue)
11     VXOPTION(${varname} ${description} ${defaultvalue})
12     MARK_AS_ADVANCED(${varname})
13 ENDMACRO(VXOPTION_A)
15 MACRO(VXCMINCLUDE file)
16     CMAKE_POLICY(SET CMP0011 NEW)
17     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/${file}")
18     CMAKE_POLICY(SET CMP0011 OLD)
19 ENDMACRO(VXCMINCLUDE)
21 MACRO(SET_32BIT_ENV)
22     SET(CMAKE_C_FLAGS -m32)
23     SET(CMAKE_CXX_FLAGS -m32)
24     SET(CMAKE_SHARED_LINKER_FLAGS "-m32")
25 ENDMACRO(SET_32BIT_ENV)
28 ##############
29 CHECK_INCLUDE_FILES("malloc.h" HAVE_MALLOC_H)
30 ####
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
41 ADD_DEFINITIONS(
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)
47 VXOPTION(BUILD_STDLIB
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)
55 VXOPTION(STRIP_FILES
56     "ON to strip libraries/binaries (currently only used for CPack)" OFF)
57 VXOPTION(BUILD_32BIT
58     "ON to build vox as 32bit library and binary/binaries. Currently only supported for GCC!"
59     OFF)
61 # the core library
62 SET(vox_corelib      "vox_target_corelib")
63 SET(vox_corelib_name "vox")
65 # the stdlib
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
78 SET(vox_rpath_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}")
99 ## find boost
100 set(Boost_DEBUG OFF)
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
109 SET(vox_coredeps)
110 IF(WIN32)
111     SET(vox_coredeps
112         "kernel32"
113         "user32")
114 ELSEIF(UNIX)
115     IF(CMAKE_SYSTEM_NAME MATCHES "(.+)BSD")
116         ## apparently, *BSD provides dlfcn via libc,
117         ## so nothing to do here
118     ELSE()
119         SET(vox_coredeps ${vox_coredeps} "dl")
120     ENDIF()
121     SET(vox_coredeps ${vox_coredeps} "m")
122 ENDIF(WIN32)
124 IF(Boost_FOUND)
125     MESSAGE(STATUS "Will link against libboost*")
126     ADD_DEFINITIONS("-DVOX_HAVEBOOST")
127     INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
128     SET(VOX_HAVEBOOST 1)
129     SET(vox_coredeps ${vox_coredeps} ${Boost_LIBRARIES})
130 ENDIF(Boost_FOUND)
133 ## add include paths to compiler flags (-I$path)
134 INCLUDE_DIRECTORIES(${vox_includes})
136 ## build actual projects
137 IF(BUILD_32BIT)
138     MESSAGE(STATUS "Vox will be built as 32Bit binaries!")
139     SET_32BIT_ENV()
140 ENDIF(BUILD_32BIT)
141 IF(TRACE_API_CALLS)
142     ADD_DEFINITIONS("-DVOX_TRACE_API_CALLS=1")
143 ENDIF(TRACE_API_CALLS)
144 IF(WITHOUT_COMPILER)
145     ADD_DEFINITIONS("-DVOX_NO_COMPILER=1")
146 ENDIF(WITHOUT_COMPILER)
147 ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/src/core")
148 IF(BUILD_STDLIB)
149     ADD_DEFINITIONS("-DVOX_STDLIB_AVAILABLE=1")
150     ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/src/stdlib")
151 ENDIF(BUILD_STDLIB)
152 ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/src/frontend")
155 ## installation of headerfiles
156 INSTALL(
157     DIRECTORY "${vox_incpath}/vox"
158     DESTINATION include
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")
179 INCLUDE(CPack)