Commit e117d555 authored by Artur Grunau's avatar Artur Grunau
Browse files

Fix how the SWIG run-time header is generated

The header with SWIG run-time functions was generated in the PRE_BUILD
phase which is only fully supported by Visual Studio builds. Add an
explicit dependency on swigluarun.h to the campvis-scripting target to
make sure that the former exists before the latter is built.

References #1
parent 44611576
......@@ -36,18 +36,19 @@ SET_SOURCE_FILES_PROPERTIES(vis.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_MODULE(vis lua vis.i)
SWIG_LINK_LIBRARIES(vis campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs})
ADD_EXECUTABLE(campvis-scripting ${CampvisScriptingSources} ${CampvisScriptingHeaders})
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisScriptingDefinitions})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CMAKE_CURRENT_BINARY_DIR})
TARGET_LINK_LIBRARIES(campvis-scripting campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs})
# Generate header with SWIG run-time functions
ADD_CUSTOM_COMMAND(
TARGET campvis-scripting
PRE_BUILD
OUTPUT "swigluarun.h"
COMMAND ${SWIG_EXECUTABLE} -c++ -lua -external-runtime "swigluarun.h"
)
LIST(APPEND CampvisScriptingHeaders "swigluarun.h")
ADD_EXECUTABLE(campvis-scripting ${CampvisScriptingSources} ${CampvisScriptingHeaders})
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisScriptingDefinitions})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CMAKE_CURRENT_BINARY_DIR})
TARGET_LINK_LIBRARIES(campvis-scripting campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs})
# If a multi-config generator is used (e.g. Visual Studio or XCode), CAMPVis Lua modules will be
# placed in a sub-directory that won't be picked up by Lua automatically. Let the code know via
# a #define what that sub-directory is so that it can instruct Lua to search it.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment