Arjen Markus <[EMAIL PROTECTED]> writes:
> Jim Dishaw wrote:
>
>>Second, I have a better way of generating the plflt.inc file that avoids
>>building an executable and uses the C preprocessor instead. My CMake
>>edit is a crude and could be refined. Anyone care to help out?
>>
>>
> Certainly, let me see it :).
>
I added a new file in bindings/f95 called plflt.txt (I picked .txt to
make sure it would not conflict with a traditional source file, however,
a better name might be better). Then I applied the attached patch to
bindings/f95/CMakeLists.txt. I was conservative and restricted it to
WIN32, however, there is no reason it should not apply to all
platforms. There probably is a better way to get it to work, so
applying this patch might not be the best way forward.
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 8414)
+++ CMakeLists.txt (working copy)
@@ -29,6 +29,16 @@
${CMAKE_CURRENT_BINARY_DIR}
)
+if(WIN32)
+# Call the C preprocessor to generate the .inc file. There probably
+# is a better way to do this, but this works
+FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/plflt.txt" SRC_FILE)
+FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/plflt.inc" INC_FILE)
+FILE(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/include" INC_PATH)
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plflt.inc
+ COMMAND ${CMAKE_C_COMPILER} /I${INC_PATH} /EP ${SRC_FILE} > ${INC_FILE}
+)
+else(WIN32)
# Build plflt to determine KIND for PLFLT
set(plflt_SRC
plflt.c
@@ -46,6 +56,7 @@
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/plflt
DEPENDS ${plflt_LOCATION}
)
+endif(WIN32)
set_source_files_properties(plflt.inc PROPERTIES GENERATED ON)
#include "plConfig.h"
!Dummy file used to generate the plflt.inc include file
!
! Type of floating-point numbers in PLplot
!
#ifdef PL_DOUBLE
integer, parameter :: plf = kind(1.0d0)
#else
integer, parameter :: plf = kind(1.0)
#endif
integer, parameter :: plflt = plf
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel