Skip to content

Commit

Permalink
Deleted footer from ysclass-library CMake script.
Browse files Browse the repository at this point in the history
  • Loading branch information
captainys committed Sep 13, 2024
1 parent 29b05a8 commit 19a248c
Showing 1 changed file with 2 additions and 169 deletions.
171 changes: 2 additions & 169 deletions src/ysclass/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,172 +273,5 @@ yshastextmetadata.h
yscommandline.h
)



#YSBEGIN "CMake Footer" Ver 20170110
if(YS_CXX_FLAGS)
foreach(SRC ${SRCS})
if(${SRC} MATCHES .cpp$)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/${SRC} PROPERTIES COMPILE_FLAGS "${YS_CXX_FLAGS}")
endif()
endforeach(SRC)
endif()

# When template sources are unavoidable >>
if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND NOT IS_LIBRARY_PROJECT)
get_property(XAML_TEMPLATE_DIR TARGET fslazywindow PROPERTY FS_XAML_TEMPLATE_DIR)
get_property(XAML_ASSET_FILES TARGET fslazywindow PROPERTY FS_XAML_ASSET_FILES)
get_property(XAML_APP_DEF_SOURCE TARGET fslazywindow PROPERTY FS_XAML_APP_DEF_SOURCE)
get_property(XAML_CLATTER_SOURCE TARGET fslazywindow PROPERTY FS_XAML_CLATTER_SOURCE)
get_property(XAML_PER_PROJ_SOURCE TARGET fslazywindow PROPERTY FS_XAML_PER_PROJ_SOURCE)
foreach(SRC ${XAML_PER_PROJ_SOURCE})
file(COPY ${XAML_TEMPLATE_DIR}/${SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND COPIED_XAML_PER_PROJ_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${SRC})
endforeach(SRC)
list(APPEND SRCS ${XAML_APP_DEF_SOURCE} ${XAML_CLATTER_SOURCE} ${COPIED_XAML_PER_PROJ_SOURCE} ${XAML_ASSET_FILES})
include_directories(${XAML_TEMPLATE_DIR})
set_source_files_properties(${XAML_ASSET_FILES} PROPERTIES VS_DEPLOYMENT_CONTENT 1)
set_source_files_properties(${XAML_ASSET_FILES} PROPERTIES VS_DEPLOYMENT_LOCATION "Assets")
set_source_files_properties(${XAML_APP_DEF_SOURCE} PROPERTIES VS_XAML_TYPE ApplicationDefinition)
endif()
# When template sources are unavoidable <<

foreach(ONE_TARGET ${TARGET_NAME})
message([${ONE_TARGET}])

if(SINGLE_TARGET)
if(NOT IS_LIBRARY_PROJECT)
add_executable(${ONE_TARGET} ${EXE_TYPE} ${SRCS} ${HEADERS})
else()
add_library(${ONE_TARGET} ${LIB_OPTION} ${SRCS} ${HEADERS})
endif()
endif()

if(NOT IS_LIBRARY_PROJECT)
if(EXE_COPY_DIR)
# 2015/02/01 CMAKE_CONFIGURATION_TYPES may be empty.
set_target_properties(${ONE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_COPY_DIR}")
set_target_properties(${ONE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${EXE_COPY_DIR}")
set_target_properties(${ONE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${EXE_COPY_DIR}")
foreach(CFGTYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${CFGTYPE} UCFGTYPE)
set_target_properties(${ONE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UCFGTYPE} "${EXE_COPY_DIR}")
endforeach(CFGTYPE)
endif()
else()
set(INHERITING_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ${OWN_HEADER_PATH} ${ADDITIONAL_HEADER_PATH})

foreach(DEPEND_TARGET ${INCLUDE_DEPENDENCY})
get_property(TARGET_INCLUDE_DIR TARGET ${DEPEND_TARGET} PROPERTY INCLUDE_DIRECTORIES)
list(APPEND INHERITING_INCLUDE_DIR ${TARGET_INCLUDE_DIR})
endforeach(DEPEND_TARGET)

list(REMOVE_DUPLICATES INHERITING_INCLUDE_DIR)
target_include_directories(${ONE_TARGET} PUBLIC ${INHERITING_INCLUDE_DIR})

if(VERBOSE_MODE)
message("Inheriting include directories ${INHERITING_INCLUDE_DIR}")
endif()
endif()

set(${ONE_TARGET}_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE)

if(SUB_FOLDER)
if(VERBOSE_MODE)
message("Putting in folder ${SUB_FOLDER}")
endif()
set_property(TARGET ${ONE_TARGET} PROPERTY FOLDER ${SUB_FOLDER})
endif()

if(VERBOSE_MODE)
foreach(LINKLIB ${LIB_DEPENDENCY})
message(Lib=${LINKLIB})
endforeach(LINKLIB)
endif()
target_link_libraries(${ONE_TARGET} ${LIB_DEPENDENCY})

# We suffered enough from the shared stdc++
if(UNIX AND NOT APPLE AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
target_link_libraries(${ONE_TARGET} pthread -static-libstdc++ -static-libgcc)
endif()

if(ADDITIONAL_HEADER_PATH)
if(VERBOSE_MODE)
message(Additional Include=${ADDITIONAL_HEADER_PATH})
endif()
include_directories(${ADDITIONAL_HEADER_PATH})
endif()
endforeach(ONE_TARGET)

if(DATA_FILE_LOCATION)
foreach(ONE_DATA_FILE_LOCATION ${DATA_FILE_LOCATION})
foreach(ONE_TARGET ${TARGET_NAME})
get_property(IS_MACOSX_BUNDLE TARGET ${ONE_TARGET} PROPERTY MACOSX_BUNDLE)

if(DATA_COPY_DIR)
set(DATA_DESTINATION ${DATA_COPY_DIR})
else()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
if(NOT YS_ANDROID_ASSET_DIRECTORY)
MESSAGE(FATAL_ERROR "YS_ANDROID_ASSET_DIRECTORY not defined or empty.")
endif()
set(DATA_DESTINATION ${YS_ANDROID_ASSET_DIRECTORY})
elseif(NOT EXE_COPY_DIR)
if(APPLE AND IS_MACOSX_BUNDLE)
set(DATA_DESTINATION "$<TARGET_FILE_DIR:${ONE_TARGET}>/../Resources")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set(DATA_DESTINATION "$<TARGET_FILE_DIR:${ONE_TARGET}>/Assets")
elseif(MSVC)
set(DATA_DESTINATION "$<TARGET_FILE_DIR:${ONE_TARGET}>")
else()
set(DATA_DESTINATION "$<TARGET_FILE_DIR:${ONE_TARGET}>")
endif()
else()
if(IS_MACOSX_BUNDLE)
set(DATA_DESTINATION "${EXE_COPY_DIR}/${ONE_TARGET}.app/Contents/Resources")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set(DATA_DESTINATION "${EXE_COPY_DIR}/Assets")
else()
set(DATA_DESTINATION "${EXE_COPY_DIR}")
endif()
endif()
endif()

# 2016/02/13 Use of generator-expression causes / be used in the DATA_DESTINATION
# What's worse is it is not replaced with \\ by REGEX because it
# is expanded at build time, not cmake time.
#if(MSVC)
# string(REGEX REPLACE "/" "\\\\" WIN_ONE_DATA_FILE_LOCATION "${ONE_DATA_FILE_LOCATION}")
# string(REGEX REPLACE "/" "\\\\" WIN_DATA_DESTINATION "${DATA_DESTINATION}")
# add_custom_command(TARGET ${ONE_TARGET} POST_BUILD
# COMMAND echo [File Copy]
# COMMAND echo From: "${WIN_ONE_DATA_FILE_LOCATION}\\*"
# COMMAND echo To: "${WIN_DATA_DESTINATION}\\."
# COMMAND xcopy "${WIN_ONE_DATA_FILE_LOCATION}\\*" "${WIN_DATA_DESTINATION}\\." /E /D /C /Y
# )
#else()
# add_custom_command(TARGET ${ONE_TARGET} POST_BUILD
# COMMAND echo [File Copy]
# COMMAND echo From: "${ONE_DATA_FILE_LOCATION}"
# COMMAND echo To: "${DATA_DESTINATION}"
# COMMAND mkdir -p "${DATA_DESTINATION}"
# COMMAND rsync -r "${ONE_DATA_FILE_LOCATION}/*" "${DATA_DESTINATION}"
# )
#endif()

# "cmake -E copy_directory" does the job in any cmake-supporting platforms, but what if the command-line cmake is not installed like MacOSX App?
# 2016/02/13 Probably using ${CMAKE_COMMAND} is the solution.
set_property(TARGET ${ONE_TARGET} PROPERTY YS_DATA_COPY_DIR "${DATA_DESTINATION}")
add_custom_command(TARGET ${ONE_TARGET} POST_BUILD
COMMAND echo For: ${ONE_TARGET}
COMMAND echo Copy
COMMAND echo From: ${ONE_DATA_FILE_LOCATION}
COMMAND echo To: ${DATA_DESTINATION}
COMMAND "${CMAKE_COMMAND}" -E make_directory \"${DATA_DESTINATION}\"
COMMAND "${CMAKE_COMMAND}" -E copy_directory \"${ONE_DATA_FILE_LOCATION}\" \"${DATA_DESTINATION}\")

endforeach(ONE_TARGET)
endforeach(ONE_DATA_FILE_LOCATION)
endif()

#YSEND
add_library(ysclass ${SRCS} ${HEADERS})
target_link_libraries(ysclass PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

0 comments on commit 19a248c

Please sign in to comment.