Skip to content

Commit

Permalink
Merge pull request OpenFAST#269 from rafmudaf/feature/version_dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ebranlard authored Apr 9, 2019
2 parents cd8e4df + 17cb750 commit ab84035
Show file tree
Hide file tree
Showing 24 changed files with 104 additions and 75 deletions.
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ include(${CMAKE_SOURCE_DIR}/cmake/OpenfastFortranOptions.cmake)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# Get the git info into the executable
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include(GetGitRevisionDescription)
git_describe(GIT_DESCRIBE)
add_definitions(-DGIT_VERSION_INFO="${GIT_DESCRIBE}")

# CMake Configuration variables
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
Expand Down Expand Up @@ -98,6 +92,7 @@ set(OPENFAST_MODULES_LOCAL
supercontroller
turbsim
openfast-library
version
)

########################################################################
Expand Down
4 changes: 3 additions & 1 deletion modules-local/aerodyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ generate_f90_types(src/UnsteadyAero_Registry.txt UnsteadyAero_Types.f90)
generate_f90_types(src/AeroDyn_Driver_Registry.txt
AeroDyn_Driver_Types.f90 -noextrap)

# AeroDyn lib
set(AD_LIBS_SOURCES
src/AeroDyn.f90
src/AeroDyn_IO.f90
Expand All @@ -45,6 +46,7 @@ set(AD_LIBS_SOURCES
add_library(aerodynlib ${AD_LIBS_SOURCES})
target_link_libraries(aerodynlib nwtclibs)

# AeroDyn driver
set(AD_DRIVER_SOURCES
src/AeroDyn_Driver.f90
src/AeroDyn_Driver_Subs.f90
Expand All @@ -53,7 +55,7 @@ set(AD_DRIVER_SOURCES
AeroDyn_Driver_Types.f90)

add_executable(aerodyn_driver ${AD_DRIVER_SOURCES})
target_link_libraries(aerodyn_driver aerodynlib nwtclibs ${CMAKE_DL_LIBS})
target_link_libraries(aerodyn_driver aerodynlib nwtclibs versioninfolib ${CMAKE_DL_LIBS})

install(TARGETS aerodyn_driver aerodynlib
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
Expand Down
3 changes: 2 additions & 1 deletion modules-local/aerodyn/src/AeroDyn_Driver_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module AeroDyn_Driver_Subs

use AeroDyn_Driver_Types
use AeroDyn

use VersionInfo

implicit none

TYPE(ProgDesc), PARAMETER :: version = ProgDesc( 'AeroDyn_driver', '', '' ) ! The version number of this program.
Expand Down
3 changes: 2 additions & 1 deletion modules-local/aerodyn/src/UnsteadyAero_Driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ program UnsteadyAero_Driver
use UnsteadyAero_Types
use UnsteadyAero
use UA_Dvr_Subs

USE VersionInfo

implicit none


Expand Down
2 changes: 1 addition & 1 deletion modules-local/beamdyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set(BD_DRIVER_SOURCES
src/Driver_Beam_Subs.f90)

add_executable(beamdyn_driver ${BD_DRIVER_SOURCES})
target_link_libraries(beamdyn_driver beamdynlib nwtclibs ${CMAKE_DL_LIBS})
target_link_libraries(beamdyn_driver beamdynlib nwtclibs versioninfolib ${CMAKE_DL_LIBS})

install(TARGETS beamdyn_driver
RUNTIME DESTINATION bin
Expand Down
1 change: 1 addition & 0 deletions modules-local/beamdyn/src/Driver_Beam.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
PROGRAM BeamDyn_Driver_Program

USE BeamDyn_driver_subs ! all other modules inherited through this one
USE VersionInfo

IMPLICIT NONE

Expand Down
2 changes: 1 addition & 1 deletion modules-local/hydrodyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ add_library(hydrodynlib ${HYDRODYN_SOURCES})
target_link_libraries(hydrodynlib nwtclibs)

add_executable(hydrodyn_driver src/HydroDyn_DriverCode.f90)
target_link_libraries(hydrodyn_driver hydrodynlib nwtclibs)
target_link_libraries(hydrodyn_driver hydrodynlib nwtclibs versioninfolib)

#add_executable(ss_radiation
# src/SS_Radiation_DriverCode.f90)
Expand Down
1 change: 1 addition & 0 deletions modules-local/hydrodyn/src/HydroDyn_DriverCode.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ PROGRAM HydroDynDriver
USE HydroDyn_Types
USE HydroDyn_Output
USE ModMesh_Types
USE VersionInfo

IMPLICIT NONE

Expand Down
49 changes: 0 additions & 49 deletions modules-local/nwtc-library/src/NWTC_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4457,56 +4457,7 @@ SUBROUTINE ProgWarn ( Message )

RETURN
END SUBROUTINE ProgWarn

!=======================================================================
!> This routine outputs the git hash associate with the current codebase.
FUNCTION QueryGitVersion()

! Passed variables.

!INTEGER(IntKi), INTENT(OUT) :: ErrStat ! Error status
!CHARACTER(*), INTENT(OUT) :: ErrMsg ! Error message

! Function declaration.

CHARACTER(200) :: QueryGitVersion ! This function.

! Local variables.

INTEGER(IntKi) :: UnIn ! Unit number for reading file
INTEGER(IntKi) :: ErrStat2 ! Temporary Error status
CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary Error message

!ErrStat = ErrID_None
!ErrMsg = ''

QueryGitVersion = 'unversioned'

! VS build method for obtaining the git version info.
! This requires setting:
! 1) GIT_INCLUDE_FILE = '$(ProjectDir)\..\gitVersionInfo.h' preprocessor option on this file or the project containing this file.
! 2) Creating a prebuild event on the project file producing the resulting binary (i.e., FAST.exe) with the following command: ..\CreateGitVersion.bat
! 3) The bat file, CreateGitVersion.bat, located in the vs-build folder of the openfast repository, which contains the git command used to obtain the git info
! @ECHO off
! SET IncludeFile=..\gitVersionInfo.h
!
! <NUL SET /p IncludeTxt=#define GIT_VERSION_INFO '> %IncludeFile%
! FOR /f %%a IN ('git describe --abbrev^=7 --always --tags --dirty') DO <NUL SET /p IncludeTxt=%%a>> %IncludeFile%
! ECHO '>> %IncludeFile%
! EXIT /B 0
! This creates the gitVersionInfo.h file in the vs-build folder

#ifdef GIT_INCLUDE_FILE
#include GIT_INCLUDE_FILE
#endif

#ifdef GIT_VERSION_INFO
QueryGitVersion = GIT_VERSION_INFO
#endif

RETURN
END FUNCTION QueryGitVersion

!=======================================================================
!> \copydoc nwtc_io::int2lstr
FUNCTION R2LStr4 ( Num )
Expand Down
8 changes: 3 additions & 5 deletions modules-local/openfast-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ add_library(openfast_postlib
src/FAST_Subs.f90
src/FAST_Solver.f90
)
target_link_libraries(openfast_postlib openfast_prelib scfastlib foamfastlib)
target_link_libraries(openfast_postlib openfast_prelib scfastlib foamfastlib versioninfolib)

add_library(openfastlib
src/FAST_Library.f90)
target_link_libraries(openfastlib
openfast_postlib openfast_prelib scfastlib foamfastlib)
add_library(openfastlib src/FAST_Library.f90)
target_link_libraries(openfastlib openfast_postlib openfast_prelib scfastlib foamfastlib)

install(TARGETS openfastlib openfast_prelib openfast_postlib
EXPORT ${CMAKE_PROJECT_NAME}Libraries
Expand Down
1 change: 1 addition & 0 deletions modules-local/openfast-library/src/FAST_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ MODULE FAST_Subs

USE FAST_Solver
USE FAST_Linear
USE VersionInfo

IMPLICIT NONE

Expand Down
2 changes: 1 addition & 1 deletion modules-local/subdyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(SUBDYN_DRIVER_SOURCES
src/SubDyn_Driver.f90)

add_executable(subdyn_driver ${SUBDYN_DRIVER_SOURCES})
target_link_libraries(subdyn_driver subdynlib nwtclibs)
target_link_libraries(subdyn_driver subdynlib nwtclibs versioninfolib)

install(TARGETS subdynlib subdyn_driver
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
Expand Down
1 change: 1 addition & 0 deletions modules-local/subdyn/src/SubDyn_Driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PROGRAM TestSubDyn
USE SubDyn
USE SubDyn_Types
USE SubDyn_Output
USE VersionInfo

IMPLICIT NONE

Expand Down
2 changes: 1 addition & 1 deletion modules-local/turbsim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ set(MODULE_SOURCES
)

add_executable(turbsim ${MODULE_SOURCES})
target_link_libraries(turbsim nwtclibs)
target_link_libraries(turbsim nwtclibs versioninfolib)

install(TARGETS turbsim RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion modules-local/turbsim/src/TurbSim.f90
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ PROGRAM TurbSim
USE TS_FileIO
USE TS_Profiles
use TS_CohStructures

use VersionInfo

IMPLICIT NONE

Expand Down
27 changes: 27 additions & 0 deletions modules-local/version/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Copyright 2016 National Renewable Energy Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include(GetGitRevisionDescription)
git_describe(GIT_DESCRIBE)
add_definitions(-DGIT_VERSION_INFO="${GIT_DESCRIBE}")

add_library(versioninfolib src/VersionInfo.f90)

install(TARGETS versioninfolib
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
43 changes: 43 additions & 0 deletions modules-local/version/src/VersionInfo.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
!**********************************************************************************************************************************
! LICENSING
! Copyright (C) 2015-2016 National Renewable Energy Laboratory
! Copyright (C) 2016-2017 Envision Energy USA, LTD
!
! This file is part of the NWTC Subroutine Library.
!
! Licensed under the Apache License, Version 2.0 (the "License");
! you may not use this file except in compliance with the License.
! You may obtain a copy of the License at
!
! http://www.apache.org/licenses/LICENSE-2.0
!
! Unless required by applicable law or agreed to in writing, software
! distributed under the License is distributed on an "AS IS" BASIS,
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the License for the specific language governing permissions and
! limitations under the License.
!
!**********************************************************************************************************************************
MODULE VersionInfo

implicit none

contains

FUNCTION QueryGitVersion()

CHARACTER(200) :: QueryGitVersion
QueryGitVersion = 'unversioned'

#ifdef GIT_INCLUDE_FILE
#include GIT_INCLUDE_FILE
#endif

#ifdef GIT_VERSION_INFO
QueryGitVersion = GIT_VERSION_INFO
#endif

RETURN
END FUNCTION QueryGitVersion

END MODULE
3 changes: 2 additions & 1 deletion vs-build/AeroDyn/AeroDyn_Driver.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -306,5 +306,6 @@
<FileConfiguration Name="Release_Double|x64">
<Tool Name="VFCustomBuildTool" CommandLine="CALL ..\RunRegistry.bat UA" Description="Running Registry for UnsteadyAero" Outputs="..\..\build\types-files\UnsteadyAero_Types.f90"/></FileConfiguration></File>
<File RelativePath="..\..\build\types-files\UnsteadyAero_Types.f90"/></Filter>
<File RelativePath="..\..\modules-local\AeroDyn\src\UnsteadyAero.f90"/></Filter></Filter></Files>
<File RelativePath="..\..\modules-local\AeroDyn\src\UnsteadyAero.f90"/></Filter>
<File RelativePath="..\..\modules-local\version\src\VersionInfo.f90"/></Filter></Files>
<Globals/></VisualStudioProject>
3 changes: 2 additions & 1 deletion vs-build/BeamDyn/BeamDyn.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,6 @@
<FileConfiguration Name="Release_Double|x64">
<Tool Name="VFFortranCompilerTool" WarnUnusedVariables="false"/></FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VFFortranCompilerTool" WarnUnusedVariables="false"/></FileConfiguration></File></Filter></Filter></Files>
<Tool Name="VFFortranCompilerTool" WarnUnusedVariables="false"/></FileConfiguration></File></Filter>
<File RelativePath="..\..\modules-local\version\src\VersionInfo.f90"/></Filter></Files>
<Globals/></VisualStudioProject>
3 changes: 2 additions & 1 deletion vs-build/FASTlib/FASTlib.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -1423,5 +1423,6 @@
<FileConfiguration Name="Release_Matlab|Win32">
<Tool Name="VFCustomBuildTool" CommandLine="CALL ..\RunRegistry.bat SuperController" Description="Running Registry for SuperController" Outputs="..\..\build\types-files\SuperController_Types.f90"/></FileConfiguration></File>
<File RelativePath="..\..\build\types-files\SuperController_Types.f90"/></Filter>
<File RelativePath="..\..\modules-local\supercontroller\src\SuperController.f90"/></Filter></Filter></Files>
<File RelativePath="..\..\modules-local\supercontroller\src\SuperController.f90"/></Filter>
<File RelativePath="..\..\modules-local\version\src\VersionInfo.f90"/></Filter></Files>
<Globals/></VisualStudioProject>
3 changes: 2 additions & 1 deletion vs-build/HydroDyn/HydroDynDriver.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,6 @@
<FileConfiguration Name="Debug|x64">
<Tool Name="VFFortranCompilerTool" WarnUnusedVariables="false"/></FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VFFortranCompilerTool" WarnUnusedVariables="false"/></FileConfiguration></File></Filter></Filter></Files>
<Tool Name="VFFortranCompilerTool" WarnUnusedVariables="false"/></FileConfiguration></File></Filter>
<File RelativePath="..\..\modules-local\version\src\VersionInfo.f90"/></Filter></Files>
<Globals/></VisualStudioProject>
3 changes: 2 additions & 1 deletion vs-build/SubDyn/SubDyn.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,6 @@
<File RelativePath="..\..\modules-local\subdyn\src\SD_FEM.f90"/>
<File RelativePath="..\..\modules-local\subdyn\src\SubDyn.f90"/>
<File RelativePath="..\..\modules-local\subdyn\src\SubDyn_Driver.f90"/>
<File RelativePath="..\..\modules-local\subdyn\src\SubDyn_Output.f90"/></Filter></Filter></Files>
<File RelativePath="..\..\modules-local\subdyn\src\SubDyn_Output.f90"/></Filter>
<File RelativePath="..\..\modules-local\version\src\VersionInfo.f90"/></Filter></Files>
<Globals/></VisualStudioProject>
3 changes: 2 additions & 1 deletion vs-build/TurbSim/TurbSim.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
<File RelativePath="..\..\modules-local\turbsim\src\TSsubs.f90"/>
<File RelativePath="..\..\modules-local\turbsim\src\TurbSim.f90"/>
<File RelativePath="..\..\modules-local\turbsim\src\TurbSim_Types.f90"/>
<File RelativePath="..\..\modules-local\turbsim\src\VelocitySpectra.f90"/></Filter></Filter></Files>
<File RelativePath="..\..\modules-local\turbsim\src\VelocitySpectra.f90"/></Filter>
<File RelativePath="..\..\modules-local\version\src\VersionInfo.f90"/></Filter></Files>
<Globals/></VisualStudioProject>
3 changes: 2 additions & 1 deletion vs-build/UnsteadyAero/UnsteadyAero.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -321,5 +321,6 @@
<Tool Name="VFFortranCompilerTool" DisableSpecificDiagnostics="5268" WarnUnusedVariables="false"/></FileConfiguration></File></Filter>
<File RelativePath="..\..\modules-local\aerodyn\src\UA_Dvr_subs.f90"/>
<File RelativePath="..\..\modules-local\aerodyn\src\UnsteadyAero.f90"/>
<File RelativePath="..\..\modules-local\aerodyn\src\UnsteadyAero_Driver.f90"/></Filter></Filter></Files>
<File RelativePath="..\..\modules-local\aerodyn\src\UnsteadyAero_Driver.f90"/></Filter>
<File RelativePath="..\..\modules-local\version\src\VersionInfo.f90"/></Filter></Files>
<Globals/></VisualStudioProject>

0 comments on commit ab84035

Please sign in to comment.