[Vm-dev] Interesting feature of the old standardVM CMakeLists.txt for plugins I will be importing to CMakeVMMaker(Squeak)

gettimothy gettimothy at zoho.com
Mon Jul 7 17:56:25 UTC 2014


Hi Igor/all



The old standardVM CMake code does something interesting that should roll nicely into the VMMakerCMakeLists.txt.


In  two sentences, 


1 a Plugin's maintains its configuration info that is injected into CMakeLists.txt by one of two templates.   (that is currently what we have)
2. A plugin is included in a build based on its determining its own configuration needs and enabling/disabling itself in the config.h  (this is what I am adding) 




Here is 1. above for the MIDIPlugin (this is the equivalent of what the current CMakeVMMaker encapsulates)

*** MIDIPlugin/CMakeLists.txt 
 EXPECT_UNDEFINED_SYMBOLS ()
 ADD_DEFINITIONS (${MIDIPlugin_definitions})
 LINK_DIRECTORIES (${MIDIPlugin_link_directories})
 INCLUDE_DIRECTORIES (${MIDIPlugin_include_directories}
 ${bld}
 ${src}/vm
 ${cross}/vm
 ${src}/plugins/MIDIPlugin
 ${unix}/vm
 ${unix}/plugins/MIDIPlugin
 ${unix}/MIDIPlugin
 ${cross}/plugins/MIDIPlugin
 )

ADD_LIBRARY (MIDIPlugin MODULE /.../smalltalk/CMake.oscog/standardVM/src/plugins/MIDIPlugin/MIDIPlugin.c /.../smalltalk/CMake.oscog/standardVM/platforms/unix/plugins/MIDIPlugin/sqUnixMIDI.c )
TARGET_LINK_LIBRARIES (MIDIPlugin ${MIDIPlugin_link_libraries})
INSTALL (TARGETS MIDIPlugin LIBRARY DESTINATION lib/squeak/4.13.5-1)

 2.  Here is the magic (!) 


 *** MIDIPlugin/config.cmake <--this is important. the config.cmake conatins its own library checks.
       PLUGIN_REQUIRE_INCLUDE (ALSA_SOUNDLIB alsa/asoundlib.h)
       PLUGIN_REQUIRE_LIBRARY (ASOUND asound)
       IF (HAVE_ALSA_SOUNDLIB_H AND HAVE_LIBASOUND)
             SET (USE_MIDI_ALSA 1)
             CONFIG_DEFINE (USE_MIDI_ALSA)
       ENDIF ()


Those PLUGIN_REQUIRE_INCLUDE and PLUGIN_REQUIRE_LIBRARY are some macro wrappers that invoke CMake commands to resolve the library/include stuff. When you run the cmake script, it outputs what it found like this-->


-- MIDIPlugin: /usr/include/alsa/asoundlib.h
-- MIDIPlugin: /usr/lib64/libasound.so


 So what this means is that the CMakeVMMaker(Squeak) can ditch the hard-coded library references in plugins in favor of these utilities.


Hopefully I will have this coded by tonight.


cheers.


tty





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140707/7262744f/attachment-0001.htm


More information about the Vm-dev mailing list