diff --git a/.github/workflows/checkCI.yml b/.github/workflows/checkCI.yml index 66998281c4..7a79993628 100644 --- a/.github/workflows/checkCI.yml +++ b/.github/workflows/checkCI.yml @@ -86,7 +86,7 @@ jobs: cmake -S "$SRCDIR" -B build -DMODELICA_UTILITIES_INCLUDE_DIR="$TESTDIR" -DMODELICA_DEBUG_TIME_EVENTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_C_FLAGS="-std=c89 -Wall -Wextra" fi env: - SRCDIR: ${{ github.workspace }}/Modelica/Resources/BuildProjects/CMake + SRCDIR: ${{ github.workspace }}/Modelica/Resources TESTDIR: ${{ github.workspace }}/.CI/Test - name: Build with ${{ matrix.compiler }} run: | @@ -124,7 +124,7 @@ jobs: shell: C:\cygwin\bin\bash.exe -eo pipefail -o igncr '{0}' env: CYGWIN_NOWINPATH: 1 - SRCDIR: ${{ github.workspace }}/Modelica/Resources/BuildProjects/CMake + SRCDIR: ${{ github.workspace }}/Modelica/Resources TESTDIR: ${{ github.workspace }}/.CI/Test - name: Build with gcc run: | diff --git a/Modelica/Resources/BuildProjects/CMake/src.cmake b/Modelica/Resources/BuildProjects/CMake/src.cmake index ccc5e400e0..aa4d55544b 100644 --- a/Modelica/Resources/BuildProjects/CMake/src.cmake +++ b/Modelica/Resources/BuildProjects/CMake/src.cmake @@ -41,8 +41,10 @@ elseif(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS /W3) endif() +set(MODELICA_SOURCE_DIR "${MODELICA_RESOURCES_DIR}/C-Sources") + if(MODELICA_BUILD_ZLIB) - set(ZLIB_INCLUDE_DIR "${MODELICA_RESOURCES_DIR}/C-Sources/zlib") + set(ZLIB_INCLUDE_DIR "${MODELICA_SOURCE_DIR}/zlib") file(TO_CMAKE_PATH ${ZLIB_INCLUDE_DIR} ZLIB_INCLUDE_DIR) include_directories(${ZLIB_INCLUDE_DIR}) elseif(DEFINED ZLIB_INCLUDE_DIR) @@ -63,57 +65,57 @@ else() endif() set(EXTC_SOURCES - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaFFT.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaFFT.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaInternal.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaInternal.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaRandom.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaRandom.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaStrings.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaStrings.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/gconstructor.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/stdint_msvc.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/stdint_wrap.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/uthash.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/win32_dirent.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/win32_dirent.h" + "${MODELICA_SOURCE_DIR}/ModelicaFFT.c" + "${MODELICA_SOURCE_DIR}/ModelicaFFT.h" + "${MODELICA_SOURCE_DIR}/ModelicaInternal.c" + "${MODELICA_SOURCE_DIR}/ModelicaInternal.h" + "${MODELICA_SOURCE_DIR}/ModelicaRandom.c" + "${MODELICA_SOURCE_DIR}/ModelicaRandom.h" + "${MODELICA_SOURCE_DIR}/ModelicaStrings.c" + "${MODELICA_SOURCE_DIR}/ModelicaStrings.h" + "${MODELICA_SOURCE_DIR}/gconstructor.h" + "${MODELICA_SOURCE_DIR}/stdint_msvc.h" + "${MODELICA_SOURCE_DIR}/stdint_wrap.h" + "${MODELICA_SOURCE_DIR}/uthash.h" + "${MODELICA_SOURCE_DIR}/win32_dirent.c" + "${MODELICA_SOURCE_DIR}/win32_dirent.h" "${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h" ) set(TABLES_SOURCES - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaStandardTables.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaStandardTables.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaStandardTablesUsertab.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaMatIO.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/gconstructor.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/stdint_msvc.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/stdint_wrap.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/uthash.h" + "${MODELICA_SOURCE_DIR}/ModelicaStandardTables.c" + "${MODELICA_SOURCE_DIR}/ModelicaStandardTables.h" + "${MODELICA_SOURCE_DIR}/ModelicaStandardTablesUsertab.c" + "${MODELICA_SOURCE_DIR}/ModelicaMatIO.h" + "${MODELICA_SOURCE_DIR}/gconstructor.h" + "${MODELICA_SOURCE_DIR}/stdint_msvc.h" + "${MODELICA_SOURCE_DIR}/stdint_wrap.h" + "${MODELICA_SOURCE_DIR}/uthash.h" "${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h" ) set(MATIO_SOURCES - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaMatIO.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaMatIO.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/read_data_impl.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/safe-math.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/snprintf.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/stdint_msvc.h" + "${MODELICA_SOURCE_DIR}/ModelicaMatIO.c" + "${MODELICA_SOURCE_DIR}/ModelicaMatIO.h" + "${MODELICA_SOURCE_DIR}/read_data_impl.h" + "${MODELICA_SOURCE_DIR}/safe-math.h" + "${MODELICA_SOURCE_DIR}/snprintf.c" + "${MODELICA_SOURCE_DIR}/stdint_msvc.h" "${ZLIB_INCLUDE_DIR}/zlib.h" "${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h" ) set(IO_SOURCES - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaIO.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaIO.h" - "${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaMatIO.h" + "${MODELICA_SOURCE_DIR}/ModelicaIO.c" + "${MODELICA_SOURCE_DIR}/ModelicaIO.h" + "${MODELICA_SOURCE_DIR}/ModelicaMatIO.h" "${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h" ) if(MODELICA_BUILD_ZLIB) file(GLOB ZLIB_SOURCES - "${MODELICA_RESOURCES_DIR}/C-Sources/zlib/*.c" - "${MODELICA_RESOURCES_DIR}/C-Sources/zlib/*.h" + "${MODELICA_SOURCE_DIR}/zlib/*.c" + "${MODELICA_SOURCE_DIR}/zlib/*.h" ) endif() diff --git a/Modelica/Resources/BuildProjects/CMake/test.cmake b/Modelica/Resources/BuildProjects/CMake/test.cmake index 3c767109e9..0e57ddb6c4 100644 --- a/Modelica/Resources/BuildProjects/CMake/test.cmake +++ b/Modelica/Resources/BuildProjects/CMake/test.cmake @@ -1,9 +1,9 @@ include(CTest) if(BUILD_TESTING) - set(MODELICA_TEST_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../../../.CI/Test") - get_filename_component(ABSOLUTE_MODELICA_TEST_SOURCE_DIR "${MODELICA_TEST_SOURCE_DIR}" ABSOLUTE) - if(EXISTS "${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}") + set(MODELICA_TEST_DIR_AUX "${MODELICA_RESOURCES_DIR}/../../.CI/Test") + get_filename_component(MODELICA_TEST_DIR "${MODELICA_TEST_DIR_AUX}" ABSOLUTE) + if(EXISTS "${MODELICA_TEST_DIR}") set(MODELICA_TESTS FileSystem ModelicaStrings @@ -15,7 +15,7 @@ if(BUILD_TESTING) TablesNoUsertab ) foreach(TEST ${MODELICA_TESTS}) - add_executable(Test${TEST} "${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}/${TEST}.c") + add_executable(Test${TEST} "${MODELICA_TEST_DIR}/${TEST}.c") target_link_libraries(Test${TEST} ModelicaExternalC ModelicaStandardTables @@ -33,12 +33,12 @@ if(BUILD_TESTING) add_test( NAME Test${TEST} COMMAND Test${TEST} - WORKING_DIRECTORY "${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}" + WORKING_DIRECTORY "${MODELICA_TEST_DIR}" ) endforeach() else() message(WARNING - " Testsuite not found in \"${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}\"." + " Testsuite not found in \"${MODELICA_TEST_DIR}\"." " Set BUILD_TESTING to OFF to silence this warning." ) endif() diff --git a/Modelica/Resources/BuildProjects/CMake/CMakeLists.txt b/Modelica/Resources/CMakeLists.txt similarity index 73% rename from Modelica/Resources/BuildProjects/CMake/CMakeLists.txt rename to Modelica/Resources/CMakeLists.txt index bb27850d64..ef02239a1b 100644 --- a/Modelica/Resources/BuildProjects/CMake/CMakeLists.txt +++ b/Modelica/Resources/CMakeLists.txt @@ -9,8 +9,8 @@ endif() project(Modelica_Standard_Library_Tables C) -include(Modelica_platform.cmake) -include(Modelica_utilities.cmake) +include(BuildProjects/CMake/Modelica_platform.cmake) +include(BuildProjects/CMake/Modelica_utilities.cmake) set(MODELICA_RESOURCES_DIR "${PROJECT_SOURCE_DIR}/../..") get_filename_component(ABSOLUTE_MODELICA_RESOURCES_DIR "${MODELICA_RESOURCES_DIR}" ABSOLUTE) @@ -27,7 +27,7 @@ set( "Library installation path (don't change)" FORCE ) -include(compiler_options.cmake) -include(options.cmake) -include(test.cmake) -include(src.cmake) +include(BuildProjects/CMake/compiler_options.cmake) +include(BuildProjects/CMake/options.cmake) +include(BuildProjects/CMake/test.cmake) +include(BuildProjects/CMake/src.cmake)