Ignore:
Timestamp:
09/14/11 15:43:24 (8 years ago)
Author:
hinerm
Message:

Added support for building on Windows platforms

The CMakeLists.txt generated will now have the following changes necessary for building on Windows:

  • Copying dependencies relative to source rather than build (e.g. if your build dir is in a MSVC build type sub-directory)
  • Same as above for proxies and include files
  • Now appropriately set .exe suffix for executables
  • Copy and install the export libraries for .dlls
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/jar2lib/src/main/resources/CMakeLists.vm

    r7743 r7750  
    5454 
    5555if(NOT DEFINED Jar2Lib_PROXY_DIR) 
    56   set(Jar2Lib_PROXY_DIR ../proxies) 
     56  set(Jar2Lib_PROXY_DIR /proxies) 
    5757endif(NOT DEFINED Jar2Lib_PROXY_DIR) 
    5858 
    5959if(NOT DEFINED Jar2Lib_INCLDE_DIR) 
    60   set(Jar2Lib_INCLDE_DIR ../include) 
     60  set(Jar2Lib_INCLDE_DIR ${CMAKE_SOURCE_DIR}/include) 
    6161endif(NOT DEFINED Jar2Lib_INCLDE_DIR) 
    6262 
     
    7070 
    7171if(NOT DEFINED Jar2Lib_DEPS_SRC) 
    72   set(Jar2Lib_DEPS_SRC ../../dependency) 
     72  set(Jar2Lib_DEPS_SRC ../dependency) 
    7373endif(NOT DEFINED Jar2Lib_DEPS_SRC) 
    7474 
     
    8383# Set the appropriate file extension for libraries on each system 
    8484if(APPLE) 
    85  
    8685 if(NOT DEFINED J2L_SUFFIX) 
    8786   set(J2L_SUFFIX .dylib) 
     
    9998 
    10099if(UNIX) 
    101  
    102100 if(NOT DEFINED J2L_SUFFIX) 
    103101 
     
    229227) 
    230228 
     229# if Windows, need to copy the export libraries as well 
     230if(WIN32) 
     231# copy jace 
     232add_custom_command( 
     233  TARGET ${projectId} 
     234  DEPENDS "${CMAKE_BINARY_DIR}/${Jar2Lib_JACE_DIR}${J2L_BUILD_TYPE}/${J2L_LIB_PREFIX}jace.lib" 
     235  POST_BUILD 
     236  COMMAND ${CMAKE_COMMAND} -E copy 
     237  "${CMAKE_BINARY_DIR}/${Jar2Lib_JACE_DIR}${J2L_BUILD_TYPE}/${J2L_LIB_PREFIX}jace.lib" 
     238  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jace.lib" 
     239  VERBATIM 
     240) 
     241install(FILES 
     242  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jace.lib" 
     243  DESTINATION "." 
     244) 
     245 
     246# copy ${projectId} 
     247add_custom_command( 
     248  TARGET ${projectId} 
     249  DEPENDS "${CMAKE_BINARY_DIR}/${J2L_BUILD_TYPE}/${J2L_LIB_PREFIX}${projectId}.lib" 
     250  POST_BUILD 
     251  COMMAND ${CMAKE_COMMAND} -E copy 
     252  "${CMAKE_BINARY_DIR}/${J2L_BUILD_TYPE}/${J2L_LIB_PREFIX}${projectId}.lib" 
     253  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}${projectId}.lib" 
     254  VERBATIM 
     255) 
     256install(FILES 
     257  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}${projectId}.lib" 
     258  DESTINATION "." 
     259) 
     260 
     261# copy jtools 
     262add_custom_command( 
     263  TARGET jtools 
     264  DEPENDS "${CMAKE_BINARY_DIR}/${J2L_BUILD_TYPE}/${J2L_LIB_PREFIX}jtools.lib" 
     265  POST_BUILD 
     266  COMMAND ${CMAKE_COMMAND} -E copy 
     267  "${CMAKE_BINARY_DIR}/${J2L_BUILD_TYPE}/${J2L_LIB_PREFIX}jtools.lib" 
     268  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jtools.lib" 
     269  VERBATIM 
     270) 
     271install(FILES 
     272  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jtools.lib" 
     273  DESTINATION "." 
     274) 
     275 
     276endif(WIN32) 
     277 
    231278# copy jace_runtime.jar 
    232279add_custom_command( 
     
    269316add_custom_command( 
    270317  TARGET ${execName} 
    271   DEPENDS "${CMAKE_BINARY_DIR}/${execName}" 
    272   POST_BUILD 
    273   COMMAND ${CMAKE_COMMAND} -E copy 
    274   "${CMAKE_BINARY_DIR}/${execName}" 
    275   "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${execName}" 
     318  DEPENDS "${CMAKE_BINARY_DIR}/${execName}${J2L_EXE_SUFFIX}" 
     319  POST_BUILD 
     320  COMMAND ${CMAKE_COMMAND} -E copy 
     321  "${CMAKE_BINARY_DIR}/${execName}${J2L_EXE_SUFFIX}" 
     322  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${execName}${J2L_EXE_SUFFIX}" 
    276323  VERBATIM 
    277324) 
     
    281328add_custom_command( 
    282329  TARGET ${projectId} 
    283   DEPENDS "${CMAKE_BINARY_DIR}/${Jar2Lib_DEPS_SRC}" 
     330  DEPENDS "${CMAKE_SOURCE_DIR}/${Jar2Lib_DEPS_SRC}" 
    284331  POST_BUILD 
    285332  COMMAND ${CMAKE_COMMAND} -E copy_directory 
    286   "${CMAKE_BINARY_DIR}/${Jar2Lib_DEPS_SRC}" 
     333  "${CMAKE_SOURCE_DIR}/${Jar2Lib_DEPS_SRC}" 
    287334  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/" 
    288335  VERBATIM 
     
    301348  COMMAND ${CMAKE_COMMAND} -E copy_directory 
    302349  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/" 
    303   "${CMAKE_BINARY_DIR}/${Jar2Lib_DEPS_DIR}" 
     350  "${CMAKE_BINARY_DIR}${J2L_BUILD_TYPE}/${Jar2Lib_DEPS_DIR}" 
    304351  VERBATIM 
    305352) 
     
    318365add_custom_command( 
    319366  TARGET ${projectId} 
    320   DEPENDS "${CMAKE_BINARY_DIR}/${Jar2Lib_PROXY_DIR}" 
     367  DEPENDS "${CMAKE_SOURCE_DIR}/${Jar2Lib_PROXY_DIR}" 
    321368  POST_BUILD 
    322369  COMMAND ${CMAKE_COMMAND} -E copy_directory 
    323   "${CMAKE_BINARY_DIR}/${Jar2Lib_PROXY_DIR}/include" 
     370  "${CMAKE_SOURCE_DIR}/${Jar2Lib_PROXY_DIR}/include" 
    324371  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/include" 
    325372  VERBATIM 
Note: See TracChangeset for help on using the changeset viewer.