-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hbprotoss/cmake
cross platform port
- Loading branch information
Showing
41 changed files
with
3,243 additions
and
2,832 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,139 @@ | ||
*svn* | ||
cmake-build-debug/ | ||
### C++ template | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
### CMake template | ||
CMakeLists.txt.user | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeScripts | ||
Testing | ||
Makefile | ||
cmake_install.cmake | ||
install_manifest.txt | ||
compile_commands.json | ||
CTestTestfile.cmake | ||
_deps | ||
|
||
### macOS template | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### C template | ||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
### Example user template template | ||
### Example user template | ||
|
||
# IntelliJ project files | ||
.idea | ||
*.iml | ||
out | ||
gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
################################################################################ | ||
# Command for variable_watch. This command issues error message, if a variable | ||
# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens | ||
# variable_watch(<variable> property_reader_guard) | ||
################################################################################ | ||
function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK) | ||
if ("${PROPERTY_READER_GUARD_DISABLED}") | ||
return() | ||
endif () | ||
|
||
if ("${ACCESS}" STREQUAL "MODIFIED_ACCESS") | ||
message(FATAL_ERROR | ||
" Variable ${VARIABLE} is not supposed to be changed.\n" | ||
" It is used only for reading target property ${VARIABLE}.\n" | ||
" Use\n" | ||
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}\" \"<value>\")\n" | ||
" or\n" | ||
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}_<CONFIG>\" \"<value>\")\n" | ||
" instead.\n") | ||
endif () | ||
endfunction() | ||
|
||
################################################################################ | ||
# Create variable <name> with generator expression that expands to value of | ||
# target property <name>_<CONFIG>. If property is empty or not set then property | ||
# <name> is used instead. Variable <name> has watcher property_reader_guard that | ||
# doesn't allow to edit it. | ||
# create_property_reader(<name>) | ||
# Input: | ||
# name - Name of watched property and output variable | ||
################################################################################ | ||
function(create_property_reader NAME) | ||
set(PROPERTY_READER_GUARD_DISABLED TRUE) | ||
set(CONFIG_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}_$<UPPER_CASE:$<CONFIG>>>>") | ||
set(IS_CONFIG_VALUE_EMPTY "$<STREQUAL:${CONFIG_VALUE},>") | ||
set(GENERAL_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}>>") | ||
set("${NAME}" "$<IF:${IS_CONFIG_VALUE_EMPTY},${GENERAL_VALUE},${CONFIG_VALUE}>" PARENT_SCOPE) | ||
variable_watch("${NAME}" property_reader_guard) | ||
endfunction() | ||
|
||
################################################################################ | ||
# Set property $<name>_${PROPS_CONFIG_U} of ${PROPS_TARGET} to <value> | ||
# set_config_specific_property(<name> <value>) | ||
# Input: | ||
# name - Prefix of property name | ||
# value - New value | ||
################################################################################ | ||
function(set_config_specific_property NAME VALUE) | ||
set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}") | ||
endfunction() | ||
|
||
################################################################################ | ||
|
||
create_property_reader("TARGET_NAME") | ||
create_property_reader("OUTPUT_DIRECTORY") | ||
|
||
set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}") | ||
set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}") | ||
set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}") | ||
set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}") | ||
set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}") | ||
|
||
set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") | ||
set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") | ||
set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake") | ||
|
||
set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_BINARY_DIR}") | ||
|
||
if (MSVC) | ||
create_property_reader("DEFAULT_CXX_DEBUG_RUNTIME_LIBRARY") | ||
create_property_reader("DEFAULT_CXX_RUNTIME_LIBRARY") | ||
create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING") | ||
create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT") | ||
|
||
set_config_specific_property("DEFAULT_CXX_DEBUG_RUNTIME_LIBRARY" "/MDd") | ||
set_config_specific_property("DEFAULT_CXX_RUNTIME_LIBRARY" "/MD") | ||
set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") | ||
set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake") | ||
|
||
set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_CURRENT_SOURCE_DIR}$<$<NOT:$<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}") | ||
|
||
get_target_property(${PROPS_TARGET}_BINARY_DIR ${PROPS_TARGET} BINARY_DIR) | ||
set(DEFAULT_FORTRAN_MODULES_DIR "${${PROPS_TARGET}_BINARY_DIR}/${PROPS_TARGET}.Modules.dir") | ||
set_target_properties(${PROPS_TARGET} PROPERTIES Fortran_MODULE_DIRECTORY ${DEFAULT_FORTRAN_MODULES_DIR}) | ||
|
||
if (${CMAKE_GENERATOR} MATCHES "Visual Studio") | ||
# Hack for visual studio generator (https://gitlab.kitware.com/cmake/cmake/issues/19552) | ||
add_custom_command(TARGET ${PROPS_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_PROPERTY:${PROPS_TARGET},Fortran_MODULE_DIRECTORY>/${CMAKE_CFG_INTDIR}) | ||
endif () |
Oops, something went wrong.