Skip to content

Commit

Permalink
use NMake to compile on windows (now worklng)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebertolazzi committed Oct 26, 2021
1 parent 21d80b5 commit 91a1ba9
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 72 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "submodules/quarticRootsFlocke"]
path = submodules/quarticRootsFlocke
url = https://github.com/ebertolazzi/quarticRootsFlocke.git
[submodule "submodules/GenericContainer"]
path = submodules/GenericContainer
url = https://github.com/ebertolazzi/GenericContainer.git
75 changes: 39 additions & 36 deletions CMakeInstall.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,48 @@ install(DIRECTORY "${Clothoids_DIR}/Clothoids" DESTINATION "${PROJECT_PUBLIC_HEA

#----------------------------------------

install(
EXPORT ClothoidsTargets
FILE ClothoidsTargets.cmake
DESTINATION lib/cmake/Clothoids
)

# CPACK INSTALL TARGETS (Leaving almost as it is...)

set(INCLUDE_INSTALL_DIR include/ CACHE STRING "Include install directory")
set(LIBRARIES_INSTALL_DIR lib/ CACHE STRING "Libraries install directory")
get_target_property(CLOTHOIDS_LIB_OUTPUT_NAME ${STATIC_PROJECT} OUTPUT_NAME)
if(UNIX)
set(CLOTHOIDS_LIB_PREFIX lib)
set(CLOTHOIDS_LIB_SUFFIX .a)
else()
set(CLOTHOIDS_LIB_PREFIX "")
set(CLOTHOIDS_LIB_SUFFIX .lib)
endif()
set(CLOTHOIDS_LIB_NAME "${CLOTHOIDS_LIB_PREFIX}${CLOTHOIDS_LIB_OUTPUT_NAME}${CLOTHOIDS_LIB_SUFFIX}")
set(LIBRARIES lib/${CLOTHOIDS_LIB_NAME} CACHE STRING "Libraries directory")
IF ( APPLE OR LINUX OR UNIX )

include(CMakePackageConfigHelpers)
configure_package_config_file(
ClothoidsConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/ClothoidsConfig.cmake"
INSTALL_DESTINATION "lib/Clothoids/cmake"
PATH_VARS INCLUDE_INSTALL_DIR LIBRARIES_INSTALL_DIR LIBRARIES
)
write_basic_package_version_file(
"ClothoidsConfigVersion.cmake"
VERSION 2.0.9
COMPATIBILITY SameMajorVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/ClothoidsConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/ClothoidsConfigVersion.cmake
DESTINATION lib/cmake/Clothoids
)
install(
EXPORT ClothoidsTargets
FILE ClothoidsTargets.cmake
DESTINATION lib/cmake/Clothoids
)

set(INCLUDE_INSTALL_DIR include/ CACHE STRING "Include install directory")
set(LIBRARIES_INSTALL_DIR lib/ CACHE STRING "Libraries install directory")
get_target_property(CLOTHOIDS_LIB_OUTPUT_NAME ${STATIC_PROJECT} OUTPUT_NAME)
if(UNIX)
set(CLOTHOIDS_LIB_PREFIX lib)
set(CLOTHOIDS_LIB_SUFFIX .a)
else()
set(CLOTHOIDS_LIB_PREFIX "")
set(CLOTHOIDS_LIB_SUFFIX .lib)
endif()
set(CLOTHOIDS_LIB_NAME "${CLOTHOIDS_LIB_PREFIX}${CLOTHOIDS_LIB_OUTPUT_NAME}${CLOTHOIDS_LIB_SUFFIX}")
set(LIBRARIES lib/${CLOTHOIDS_LIB_NAME} CACHE STRING "Libraries directory")

include(CMakePackageConfigHelpers)
configure_package_config_file(
ClothoidsConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/ClothoidsConfig.cmake"
INSTALL_DESTINATION "lib/Clothoids/cmake"
PATH_VARS INCLUDE_INSTALL_DIR LIBRARIES_INSTALL_DIR LIBRARIES
)
write_basic_package_version_file(
"ClothoidsConfigVersion.cmake"
VERSION 2.0.9
COMPATIBILITY SameMajorVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/ClothoidsConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/ClothoidsConfigVersion.cmake
DESTINATION lib/cmake/Clothoids
)
endif()

if(INSTALL_HERE)
add_custom_command(
Expand Down
5 changes: 2 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,15 @@ task :build_win, [:year, :bits] do |t, args|
FileUtils.mkdir_p dir
FileUtils.cd dir

#cmd_cmake = win_vs(args.bits,args.year) + cmd_cmake_build
cmd_cmake = 'cmake -G "NMake Makefiles" ' + cmd_cmake_build
cmd_cmake = win_vs(args.bits,args.year) + cmd_cmake_build

puts "run CMAKE for CLOTHOIDS".yellow
sh cmd_cmake + ' ..'
puts "compile with CMAKE for CLOTHOIDS".yellow
if COMPILE_DEBUG then
sh 'cmake --build . --config Debug --target install '+PARALLEL+QUIET
else
sh 'cmake --build . --config Release --target install '+PARALLEL+QUIET
sh 'cmake --build . --config Release --target install '+PARALLEL+QUIET
end

FileUtils.cd '..'
Expand Down
53 changes: 29 additions & 24 deletions Rakefile_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,32 +137,37 @@ def extract_zip( filename, destination_path='.' )

def win_vs( bits, year )

tmp = " -DBITS=#{bits} -DYEAR=#{year} "

win32_64 = ''
win32_64_ = '-A Win32'
case bits
when /x64/
win32_64 = ' Win64'
win32_64_ = ' -A x64'
end
tmp = " -DBITS:VAR=#{bits} -DYEAR:VAR=#{year} "

case year
when "2010"
tmp = 'cmake -G "Visual Studio 10 2010' + win32_64 +'" ' + tmp
when "2012"
tmp = 'cmake -G "Visual Studio 11 2012' + win32_64 +'" ' + tmp
when "2013"
tmp = 'cmake -G "Visual Studio 12 2013' + win32_64 +'" ' + tmp
when "2015"
tmp = 'cmake -G "Visual Studio 14 2015' + win32_64 +'" ' + tmp
when "2017"
tmp = 'cmake -G "Visual Studio 15 2017' + win32_64 +'" ' + tmp
when "2019"
tmp = 'cmake -G "Visual Studio 16 2019"' + win32_64_ + tmp
if USE_NMAKE then
tmp = 'cmake -G "NMake Makefiles" ' + tmp
else
puts "Visual Studio year #{year} not supported!\n";
return ""

win32_64 = ''
win32_64_ = '-A Win32'
case bits
when /x64/
win32_64 = ' Win64'
win32_64_ = ' -A x64'
end

case year
when "2010"
tmp = 'cmake -G "Visual Studio 10 2010' + win32_64 +'" ' + tmp
when "2012"
tmp = 'cmake -G "Visual Studio 11 2012' + win32_64 +'" ' + tmp
when "2013"
tmp = 'cmake -G "Visual Studio 12 2013' + win32_64 +'" ' + tmp
when "2015"
tmp = 'cmake -G "Visual Studio 14 2015' + win32_64 +'" ' + tmp
when "2017"
tmp = 'cmake -G "Visual Studio 15 2017' + win32_64 +'" ' + tmp
when "2019"
tmp = 'cmake -G "Visual Studio 16 2019"' + win32_64_ + tmp
else
puts "Visual Studio year #{year} not supported!\n";
return ""
end
end
return tmp
end
4 changes: 3 additions & 1 deletion Rakefile_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
else
COMPILE_DEBUG = false
COMPILE_DYNAMIC = false
COMPILE_EXECUTABLE = true
COMPILE_EXECUTABLE = false
USE_NMAKE = true

case RUBY_PLATFORM
when /mingw|mswin/
Expand All @@ -23,3 +24,4 @@
end
end
end

1 change: 0 additions & 1 deletion submodules/GenericContainer
Submodule GenericContainer deleted from 4db2a9
5 changes: 3 additions & 2 deletions submodules/Rakefile_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
COMPILE_DEBUG = false
COMPILE_DYNAMIC = false
COMPILE_EXECUTABLE = false
USE_NMAKE = true

case RUBY_PLATFORM
when /mingw|mswin/
PARALLEL = ''
QUIET = ''
else
require 'etc'
cmakeversion = %x( cmake --version ).scan(/\d+\.\d+\.\d+/).last
mm = cmakeversion.split('.');
if mm[0].to_i > 3 || (mm[0].to_i == 3 && mm[1].to_i >= 12) then
PARALLEL = '--parallel 8 '
PARALLEL = "--parallel #{Etc.nprocessors} "
QUIET = '-- --quiet '
else
PARALLEL = ''
QUIET = ''
end
end

end
2 changes: 1 addition & 1 deletion submodules/Utils
Submodule Utils updated 3 files
+1 −2 Rakefile
+32 −25 Rakefile_common.rb
+2 −2 Rakefile_conf.rb
2 changes: 1 addition & 1 deletion submodules/quarticRootsFlocke

0 comments on commit 91a1ba9

Please sign in to comment.