Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
arakov committed Jul 19, 2024
2 parents cd8ad3a + bcfe302 commit 0b5daf2
Showing 1 changed file with 53 additions and 85 deletions.
138 changes: 53 additions & 85 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,96 +1,64 @@
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
#------------------------------------------------------------------------------#
# ELENA CMake file #
#------------------------------------------------------------------------------#

set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE)
cmake_minimum_required(VERSION 3.10)
project(ELENA)

project(elenasrc2 CXX)
function(add_elena_target arch)
add_custom_target(elc_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/elc/codeblocks all -f elc_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

################################################################################
# Set target arch type if empty. Visual studio solution generator provides it.
################################################################################
if(NOT CMAKE_VS_PLATFORM_NAME)
set(CMAKE_VS_PLATFORM_NAME "x86")
endif()
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
add_custom_target(sg_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/sg/codeblocks all -f sg_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86"))
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
endif()
add_custom_target(og_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/og/codeblocks all -f og_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

################################################################################
# Global configuration types
################################################################################
set(CMAKE_CONFIGURATION_TYPES
"Debug"
"Release"
CACHE STRING "" FORCE
)
add_custom_target(asmc_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/asmc/codeblocks all -f asmc_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

################################################################################
# Global compiler options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
add_custom_target(ecv_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/ecv/codeblocks all -f ecv_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

################################################################################
# Global linker options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_MODULE_LINKER_FLAGS "")
set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_STATIC_LINKER_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}")
endif()
add_custom_target(elenart_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/elenart/codeblocks all -f elenart_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

################################################################################
# Nuget packages function stub.
################################################################################
function(use_package TARGET PACKAGE VERSION)
message(WARNING "No implementation of use_package. Create yours. "
"Package \"${PACKAGE}\" with version \"${VERSION}\" "
"for target \"${TARGET}\" is ignored!")
endfunction()

################################################################################
# Common utils
################################################################################
include(elenasrc2/CMake/Utils.cmake)
add_custom_target(elenasm_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/elenasm/codeblocks all -f elenasm_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

################################################################################
# Additional Global Settings(add specific info there)
################################################################################
include(elenasrc2/CMake/GlobalSettingsInclude.cmake OPTIONAL)
add_custom_target(all_${arch}
DEPENDS elc_${arch} sg_${arch} og_${arch} asmc_${arch} ecv_${arch} elenart_${arch} elenasm_${arch}
)

################################################################################
# Use solution folders feature
################################################################################
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

################################################################################
# Sub-projects
################################################################################
add_subdirectory(elenasrc2/elc/cmake)
add_subdirectory(elenasrc2/elenagm/cmake)
add_subdirectory(elenasrc2/elenart/cmake)
add_subdirectory(elenasrc2/elenasm/cmake)
add_subdirectory(elenasrc2/elenavm/cmake)
add_subdirectory(elenasrc2/ide/cmake)
add_subdirectory(elenasrc2/tools/api2html/cmake)
add_subdirectory(elenasrc2/tools/asm2bin/cmake)
add_subdirectory(elenasrc2/tools/ecv/cmake)
add_subdirectory(elenasrc2/tools/elt/cmake)
add_subdirectory(elenasrc2/tools/og/cmake)
add_subdirectory(elenasrc2/tools/sg/cmake)
add_custom_target(clean_${arch}
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/elc/codeblocks clean -f elc_${arch}.mak
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/sg/codeblocks clean -f sg_${arch}.mak
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/og/codeblocks clean -f og_${arch}.mak
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/asmc/codeblocks clean -f asmc_${arch}.mak
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/tools/ecv/codeblocks clean -f ecv_${arch}.mak
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/elenart/codeblocks clean -f elenart_${arch}.mak
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/elenasrc3/elenasm/codeblocks clean -f elenasm_${arch}.mak
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endfunction()

# Add targets for each architecture
add_elena_target(i386)
add_elena_target(amd64)
add_elena_target(ppc64le)
add_elena_target(arm64)

0 comments on commit 0b5daf2

Please sign in to comment.